Skip to content

Update to latest Nazara version #83

Update to latest Nazara version

Update to latest Nazara version #83

Workflow file for this run

name: Build & Push binaries
permissions:
contents: write
on:
pull_request:
push:
paths-ignore:
- '.gitignore'
- 'LICENSE'
- 'README.md'
jobs:
build:
strategy:
fail-fast: false
matrix:
platform:
- { runner: windows-latest, os: windows, arch: x64, archive_ext: .zip }
- { runner: ubuntu-latest, os: linux, arch: x86_64, archive_ext: .tar.gz }
- { runner: macos-latest, os: macos, arch: x86_64, archive_ext: .tar.gz }
#- { runner: macos-latest, os: macos, arch: arm64, archive_ext: .tar.gz }
mode: [debug, releasedbg]
runs-on: ${{ matrix.platform.runner }}
steps:
- name: Get current date as package key
id: cache_key
run: echo "key=$(date +'%W')" >> $GITHUB_OUTPUT
shell: bash
- name: "Set OUTPUT_FILE variable"
run: echo "OUTPUT_FILE=${{ matrix.platform.os }}_${{ matrix.platform.arch }}_${{ matrix.mode }}${{ matrix.platform.archive_ext }}" >> $GITHUB_ENV
shell: bash
# Force xmake to a specific folder (for cache)
- name: Set xmake env
run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV
shell: bash
- name: Checkout repository
uses: actions/checkout@v4
# Install xmake
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
actions-cache-folder: .xmake-cache-W${{ steps.cache_key.outputs.key }}
# Update xmake repository (in order to have the file that will be cached)
- name: Update xmake repository
run: xmake repo --update
# Fetch xmake dephash
- name: Retrieve dependencies hash
id: dep_hash
run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT
shell: bash
# Retrieve xmake dependencies
- name: Restore cached xmake dependencies
id: restore-depcache
uses: actions/cache/restore@v4
with:
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
key: ${{ matrix.platform.os }}-${{ matrix.platform.arch }}-${{ matrix.mode }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.cache_key.outputs.key }}
- name: Configure xmake and install dependencies
run: xmake config --arch=${{ matrix.platform.arch }} --mode=${{ matrix.mode }} --yes -vD
# Save dependencies
- name: Save cached xmake dependencies
if: ${{ !steps.restore-depcache.outputs.cache-hit }}
uses: actions/cache/save@v4
with:
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
key: ${{ steps.restore-depcache.outputs.cache-primary-key }}
- name: Build
run: xmake
- name: Install
run: |
xmake install -vo dest/
if [ "$RUNNER_OS" == "Linux" ]; then
mv ./dest/lib/*.so ./dest/bin/
elif [ "$RUNNER_OS" == "macOS" ]; then
mv ./dest/lib/*.dylib ./dest/bin/
fi
rm -rf dest/include/
rm -rf dest/lib/
shell: bash
- name: Archive result
uses: ihiroky/archive-action@v1
with:
root_dir: dest/bin
file_path: ${{ env.OUTPUT_FILE }}
verbose: true
- name: Compute checksum of archive
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
sha256sum -b "$OUTPUT_FILE" > "$OUTPUT_FILE.sha256"
else
shasum -a 256 -b "$OUTPUT_FILE" > "$OUTPUT_FILE.sha256"
fi
shell: bash
# Nightly tags (for commits to dev branch)
- name: Upload binaries to release (Dev)
uses: svenstaro/upload-release-action@v2
if: ${{ (github.ref == 'refs/heads/dev') && github.event_name == 'push' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.OUTPUT_FILE }}
asset_name: ${{ env.OUTPUT_FILE }}
tag: "0.0.0-nightly"
overwrite: true
- name: Upload checksum to release (Dev)
uses: svenstaro/upload-release-action@v2
if: ${{ (github.ref == 'refs/heads/dev') && github.event_name == 'push' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.OUTPUT_FILE }}.sha256
asset_name: ${{ env.OUTPUT_FILE }}.sha256
tag: "0.0.0-nightly"
overwrite: true
body: "Dev branch"
# Release tags (for tags)
- name: Upload binaries to release (Tag)
uses: svenstaro/upload-release-action@v2
if: ${{ startsWith(github.event.ref, 'refs/tags/') && matrix.mode == 'releasedbg' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.OUTPUT_FILE }}
asset_name: ${{ env.OUTPUT_FILE }}
tag: ${{ github.ref }}
overwrite: true
- name: Upload checksum to release (Tag)
uses: svenstaro/upload-release-action@v2
if: ${{ startsWith(github.event.ref, 'refs/tags/') && matrix.mode == 'releasedbg' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.OUTPUT_FILE }}.sha256
asset_name: ${{ env.OUTPUT_FILE }}.sha256
tag: ${{ github.ref }}
overwrite: true