Build Binaries #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly Build | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
jobs: | |
check-changes: | |
runs-on: ubuntu-latest | |
env: | |
CACHE_FILE: ${{ github.workspace }}/.last-built-commit | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: Check if relevant code has changed | |
id: changed | |
run: | | |
if git diff --quiet HEAD~1..HEAD -- crates/ .cargo/ .github/workflows/ Cargo.toml; then | |
echo "changed=false" >> $GITHUB_OUTPUT | |
else | |
echo "changed=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Get last built commit | |
id: last-built | |
if: steps.changed.outputs.changed == 'true' | |
run: | | |
echo "commit=$(cat ${{ env.CACHE_FILE }})" >> $GITHUB_OUTPUT | |
build: | |
name: Build Nightly Releases | |
runs-on: ${{ matrix.os.runner }} | |
needs: check-changes | |
if: ${{ needs.check-changes.outputs.changed == 'true' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- name: linux | |
runner: ubuntu-latest | |
target: i686-unknown-linux-gnu | |
- name: win | |
runner: windows-latest | |
target: i686-pc-windows-msvc | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Rust toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
target: ${{ matrix.os.target }} | |
- name: Build | |
run: cargo build --release --package aneri --target ${{ matrix.os.target }} | |
- name: Cache last built commit | |
id: cache-commit | |
run: | | |
echo "$GITHUB_SHA" > ${{ github.workspace }}/.last-built-commit | |
echo "::set-output name=commit::$GITHUB_SHA" | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: aneri-${{ matrix.os.name }} | |
if-no-files-found: error | |
path: | | |
target/${{ matrix.os.target }}/release/aneri.dll | |
target/${{ matrix.os.target }}/release/aneri.pdb | |
target/${{ matrix.os.target }}/release/libaneri.so |