Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rust action in CI and simplify caching #249

Merged
merged 2 commits into from
Apr 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 22 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
pull_request:
push:

env:
CARGO_TERM_COLOR: always
NIGHTLY_TOOLCHAIN: nightly-2023-03-01

jobs:
test-native:
strategy:
Expand All @@ -12,19 +16,11 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-build-nightly-${{ hashFiles('**/Cargo.toml') }}
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-03-01
override: true
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
- name: Cache Cargo build files
uses: Leafwing-Studios/cargo-cache@v1
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
if: runner.os == 'linux'
Expand All @@ -33,26 +29,18 @@ jobs:
if: runner.os == 'macos'
- name: Install llvm tools
run: cargo install -f cargo-binutils && rustup component add llvm-tools-preview
if : runner.os == 'windows'
if: runner.os == 'windows'
- name: Build & run tests for native
run: cargo test
test-native-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-latest-cargo-build-nightly-${{ hashFiles('**/Cargo.toml') }}
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-03-01
override: true
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
- name: Cache Cargo build files
uses: Leafwing-Studios/cargo-cache@v1
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Run doc tests
Expand All @@ -61,25 +49,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
- uses: dtolnay/rust-toolchain@master
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-latest-cargo-build-nightly-${{ hashFiles('**/Cargo.toml') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2023-03-01
override: true
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
- name: Cache Cargo build files
uses: Leafwing-Studios/cargo-cache@v1
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
- name: Install trunk
uses: jetli/trunk-action@v0.1.0
with:
version: 'v0.16.0'
version: "v0.16.0"
- name: Add wasm target
run: |
rustup target add wasm32-unknown-unknown
Expand All @@ -89,20 +69,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-latest-cargo-build-nightly-${{ hashFiles('**/Cargo.toml') }}
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-03-01
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
components: rustfmt, clippy
override: true
- name: Cache Cargo build files
uses: Leafwing-Studios/cargo-cache@v1
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Check format
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/deploy-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: deploy-github-page
on:
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
NIGHTLY_TOOLCHAIN: nightly-2023-03-01

jobs:
build-web:
runs-on: ubuntu-latest
Expand All @@ -11,16 +15,15 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-03-01
override: true
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
- name: Install Dependencies
run: sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
- name: Install trunk
uses: jetli/trunk-action@v0.1.0
with:
version: 'v0.16.0'
version: "v0.16.0"
- name: Add wasm target
run: |
rustup target add wasm32-unknown-unknown
Expand Down
42 changes: 21 additions & 21 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ env:
GAME_EXECUTABLE_NAME: foxtrot
GAME_OSX_APP_NAME: Foxtrot

CARGO_TERM_COLOR: always
NIGHTLY_TOOLCHAIN: nightly-2023-03-01

permissions:
contents: write

Expand All @@ -19,8 +22,8 @@ jobs:
runs-on: macos-latest

env:
# macOS 11.0 Big Sur is the first version of macOS to support universal binaries
MACOSX_DEPLOYMENT_TARGET: 11.0
# macOS 11.0 Big Sur is the first version of macOS to support universal binaries
MACOSX_DEPLOYMENT_TARGET: 11.0
steps:
- name: Get tag
id: tag
Expand All @@ -36,9 +39,9 @@ jobs:
run: |
rm build.rs
- name: Install rust toolchain for Apple Silicon
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-03-01
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
target: aarch64-apple-darwin
override: true
- name: Install zld
Expand All @@ -48,9 +51,9 @@ jobs:
run: |
SDKROOT=$(xcrun -sdk macosx --show-sdk-path) RUSTFLAGS="-C link-arg=-fuse-ld=/usr/local/bin/zld -Z share-generics=y" cargo build --release --no-default-features --features native --target=aarch64-apple-darwin
- name: Install rust toolchain for Apple x86
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-03-01
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
target: x86_64-apple-darwin
override: true
- name: Build release for x86 Apple
Expand Down Expand Up @@ -93,10 +96,9 @@ jobs:
run: |
git lfs pull
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-03-01
override: true
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
- name: Install Dependencies
run: sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
- name: Build release
Expand Down Expand Up @@ -134,10 +136,9 @@ jobs:
run: |
git lfs pull
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-03-01
override: true
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
- name: Install dotnet
uses: actions/setup-dotnet@v3
with:
Expand Down Expand Up @@ -167,11 +168,11 @@ jobs:
- name: Upload installer
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: installer/en-US/installer.msi
asset_name: ${{ env.GAME_EXECUTABLE_NAME }}_${{ steps.tag.outputs.tag }}_windows.msi
tag: ${{ github.ref }}
overwrite: true
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: installer/en-US/installer.msi
asset_name: ${{ env.GAME_EXECUTABLE_NAME }}_${{ steps.tag.outputs.tag }}_windows.msi
tag: ${{ github.ref }}
overwrite: true
build-web:
runs-on: ubuntu-latest

Expand All @@ -184,16 +185,15 @@ jobs:
run: |
git lfs pull
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-03-01
override: true
toolchain: ${{ env.NIGHTLY_TOOLCHAIN }}
- name: Install Dependencies
run: sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
- name: Install trunk
uses: jetli/trunk-action@v0.1.0
with:
version: 'v0.16.0'
version: "v0.16.0"
- name: Add wasm target
run: |
rustup target add wasm32-unknown-unknown
Expand Down