Skip to content

Commit

Permalink
.github: Add lint workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaofengli committed Sep 2, 2024
1 parent 1899dd7 commit 20ada8e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Lint

on:
pull_request:
push:
jobs:
lint:
name: Lint

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4.1.1

- uses: DeterminateSystems/nix-installer-action@v9
continue-on-error: true # Self-hosted runners already have Nix installed

- name: Install Attic
run: |
if ! command -v attic &> /dev/null; then
./.github/install-attic-ci.sh
fi
- name: Configure Attic
run: |
: "${ATTIC_SERVER:=https://staging.attic.rs/}"
: "${ATTIC_CACHE:=attic-ci}"
echo ATTIC_CACHE=$ATTIC_CACHE >>$GITHUB_ENV
export PATH=$HOME/.nix-profile/bin:$PATH # FIXME
attic login --set-default ci "$ATTIC_SERVER" "$ATTIC_TOKEN"
attic use "$ATTIC_CACHE"
env:
ATTIC_SERVER: ${{ secrets.ATTIC_SERVER }}
ATTIC_CACHE: ${{ secrets.ATTIC_CACHE }}
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}

- name: Cache dev shell
run: |
.ci/cache-shell.sh
system=$(nix-instantiate --eval -E 'builtins.currentSystem')
echo system=$system >>$GITHUB_ENV
- name: Check rustfmt
run: .ci/run just ci-rustfmt
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ ci-unit-tests matrix:
system=$(nix-instantiate --eval -E 'builtins.currentSystem')
tests=$(nix build .#internalMatrix."$system".\"{{ matrix }}\".attic-tests --no-link --print-out-paths -L)
find "$tests/bin" -exec {} \;
# (CI) Run rustfmt check
ci-rustfmt:
cargo fmt --check

0 comments on commit 20ada8e

Please sign in to comment.