Skip to content

Commit

Permalink
Merge pull request #471 from JakeStanger/ci/build-changes
Browse files Browse the repository at this point in the history
Rewrite CI build workflow
  • Loading branch information
JakeStanger authored Feb 25, 2024
2 parents 18e8244 + 163a70e commit 39cb35b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 40 deletions.
85 changes: 46 additions & 39 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,24 @@ on:

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: '-Dwarnings'

jobs:
build:
rustfmt:
runs-on: ubuntu-latest

name: 'Formatting'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Check formatting
run: cargo fmt --check


clippy-base:
runs-on: ubuntu-latest
name: 'Clippy (Base features)'
steps:
- uses: actions/checkout@v4

- uses: Swatinem/rust-cache@v2
name: Cache dependencies
Expand All @@ -30,49 +36,50 @@ jobs:
sudo apt-get update
sudo apt-get install libgtk-3-dev libgtk-layer-shell-dev
- name: Check formatting
run: cargo fmt --check
- name: Clippy
run: cargo clippy --no-default-features --features config+json
env:
# Allow some warnings through as we'll never get it perfect in a zero-feature situation
RUSTFLAGS: '-A unused-imports -A unused-variables -A unused-mut -A dead-code'

- name: Clippy (base features)
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --no-default-features --features config+json

- name: Clippy (all features)
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
clippy-all:
runs-on: ubuntu-latest
name: 'Clippy (All features)'
steps:
- uses: actions/checkout@v4

- name: Build
run: cargo build --verbose
- uses: Swatinem/rust-cache@v2
name: Cache dependencies

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
- name: Install build deps
run: |
sudo apt-get update
sudo apt-get install libgtk-3-dev libgtk-layer-shell-dev
- name: Clippy
run: cargo clippy --all-targets --all-features


build-nix:
build:
name: 'Build & Test'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: cachix/install-nix-action@v20
with:
install_url: https://nixos.org/nix/install
extra_nix_config: |
auto-optimise-store = true
experimental-features = nix-command flakes
- uses: Swatinem/rust-cache@v2
name: Cache dependencies

- uses: cachix/cachix-action@v12
with:
name: jakestanger
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- name: Install build deps
run: |
sudo apt-get update
sudo apt-get install libgtk-3-dev libgtk-layer-shell-dev
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build
run: cargo build --verbose

- run: nix build --print-build-logs
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ A flake is included with the repo which can be used with Home Manager.

</details>

There is a Cachix cache available at `https://app.cachix.org/cache/jakestanger`.
CI builds are automatically cached by Garnix.
You can use their binary cache by following the steps [here](https://garnix.io/docs/caching).

### Source

Expand Down

0 comments on commit 39cb35b

Please sign in to comment.