Update GitHub release action to v2 #39
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: CI build | |
on: | |
pull_request: | |
push: | |
branches: | |
- "master" | |
env: | |
CROSS_CONTAINER_ENGINE: podman | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
[ | |
"aarch64-linux-android", | |
"aarch64-unknown-linux-musl", | |
"arm-unknown-linux-musleabi", | |
"arm-unknown-linux-musleabihf", | |
"armv5te-unknown-linux-musleabi", | |
"armv7-unknown-linux-musleabi", | |
"armv7-unknown-linux-musleabihf", | |
"i586-unknown-linux-musl", | |
"i686-pc-windows-gnu", | |
"i686-unknown-freebsd", | |
"i686-unknown-linux-musl", | |
"powerpc64le-unknown-linux-gnu", | |
"powerpc64-unknown-linux-gnu", | |
"powerpc-unknown-linux-gnu", | |
"s390x-unknown-linux-gnu", | |
"sparc64-unknown-linux-gnu", | |
"x86_64-linux-android", | |
"x86_64-pc-windows-gnu", | |
"x86_64-unknown-freebsd", | |
"x86_64-unknown-linux-musl", | |
"x86_64-unknown-netbsd", | |
] | |
include: | |
- runner: "ubuntu-24.04" | |
- toolchain: "stable" | |
- buildFlags: "--release" | |
runs-on: ${{matrix.runner}} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: ${{runner.os}}-cargo-${{hashFiles('**/Cargo.lock')}} | |
- uses: actions/cache@v4 | |
with: | |
path: target/ | |
key: ${{matrix.target}}-target-${{hashFiles('**/Cargo.lock')}} | |
- name: Install cargo tools | |
id: cargo-tools | |
run: | | |
cargo install rust-latest || echo rust-latest already installed | |
cargo install cross --git https://github.com/cross-rs/cross || echo cross already installed | |
echo "rust-latest=$(rust-latest)" >> $GITHUB_OUTPUT | |
shell: bash | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.rustup/ | |
key: ${{matrix.target}}-rustup-${{steps.cargo-tools.outputs.rust-latest}} | |
- name: Setup rust toolchain | |
run: | | |
rustup set profile minimal | |
rustup toolchain install ${{matrix.toolchain}} | |
rustup default ${{matrix.toolchain}} | |
- name: Install cross toolchain on macOS | |
if: runner.os == 'macOS' | |
run: | | |
rustup target add ${{matrix.target}} | |
- name: Build | |
run: | | |
cross build ${{matrix.buildFlags}} --target ${{matrix.target}} | |
- name: Check if build succeeded | |
run: | | |
shopt -s extglob | |
ls target/${{matrix.target}}/release/rust_unciv_server?(.exe) | |
shopt -u extglob | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: rust_unciv_server-${{matrix.target}} | |
path: target/${{matrix.target}}/release/rust_unciv_server | |
if-no-files-found: ignore | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: rust_unciv_server-${{matrix.target}}.exe | |
path: target/${{matrix.target}}/release/rust_unciv_server.exe | |
if-no-files-found: ignore |