Add build dependency for Linux #927
Workflow file for this run
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
on: | |
- push | |
- pull_request | |
name: Main | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
rust-target: x86_64-pc-windows-msvc | |
artifact-name: win64 | |
artifact-file: ludusavi.exe | |
tar: false | |
- os: windows-latest | |
rust-target: i686-pc-windows-msvc | |
artifact-name: win32 | |
artifact-file: ludusavi.exe | |
tar: false | |
- os: ubuntu-20.04 | |
rust-target: x86_64-unknown-linux-gnu | |
artifact-name: linux | |
artifact-file: ludusavi | |
tar: true | |
- os: macos-12 | |
rust-target: x86_64-apple-darwin | |
artifact-name: mac | |
artifact-file: ludusavi | |
tar: true | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.7' | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: mtkennerly/dunamai-action@v1 | |
with: | |
env-var: LUDUSAVI_VERSION | |
args: --style semver | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable-${{ matrix.rust-target }} | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.os }}-${{ matrix.rust-target }} | |
- if: ${{ matrix.os == 'ubuntu-20.04' }} | |
run: sudo apt-get update && sudo apt-get install -y gcc libxcb-composite0-dev libgtk-3-dev librust-atk-dev | |
- run: cargo build --release | |
- if: ${{ matrix.tar }} | |
run: | | |
cd target/release | |
tar --create --gzip --file=ludusavi-v${{ env.LUDUSAVI_VERSION }}-${{ matrix.artifact-name }}.tar.gz ${{ matrix.artifact-file }} | |
- if: ${{ matrix.tar }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ludusavi-v${{ env.LUDUSAVI_VERSION }}-${{ matrix.artifact-name }} | |
path: target/release/ludusavi-v${{ env.LUDUSAVI_VERSION }}-${{ matrix.artifact-name }}.tar.gz | |
- if: ${{ !matrix.tar }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ludusavi-v${{ env.LUDUSAVI_VERSION }}-${{ matrix.artifact-name }} | |
path: target/release/${{ matrix.artifact-file }} | |
test: | |
strategy: | |
matrix: | |
os: | |
- windows-latest | |
- ubuntu-latest | |
- macos-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.os }} | |
- if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: sudo apt-get update && sudo apt-get install -y gcc libxcb-composite0-dev libgtk-3-dev librust-atk-dev | |
- if: ${{ matrix.os == 'windows-latest' }} | |
run: reg import tests/ludusavi.reg | |
- if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
cd tests/root3/game5 && cmd /c "mklink /J data-symlink data" | |
- if: ${{ matrix.os != 'windows-latest' }} | |
run: | | |
cd tests/root3/game5 && ln -s data data-symlink | |
- run: cargo test | |
lint: | |
strategy: | |
matrix: | |
os: | |
- windows-latest | |
- ubuntu-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.os }} | |
- run: cargo fmt --all -- --check | |
- run: cargo clippy --workspace -- --deny warnings |