|
| 1 | +name: Code Linter |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: ['opened', 'edited', 'reopened', 'synchronize'] |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - develop |
| 9 | + - 'release/**' |
| 10 | + |
| 11 | +env: |
| 12 | + CI: 1 |
| 13 | + |
| 14 | +jobs: |
| 15 | + rust-lint: |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + os: [github-arm64-2c-8gb, ubuntu-latest] |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + submodules: 'recursive' |
| 24 | + - run: | |
| 25 | + echo "NIX_PATH=nixpkgs=$(jq -r '.nixpkgs.url' nix/sources.json)" >> $GITHUB_ENV |
| 26 | + - uses: cachix/install-nix-action@v31 |
| 27 | + with: |
| 28 | + nix_path: ${{ env.NIX_PATH }} |
| 29 | + - run: nix-build shell.nix |
| 30 | + - name: cargo-fmt |
| 31 | + run: nix-shell --pure --run "FMT_OPTS=--check ./scripts/rust-style.sh" |
| 32 | + - name: cargo-clippy |
| 33 | + run: nix-shell --pure --run ./scripts/rust-linter.sh |
| 34 | + |
| 35 | + rust-dev: |
| 36 | + strategy: |
| 37 | + matrix: |
| 38 | + os: [github-arm64-2c-8gb, ubuntu-latest] |
| 39 | + runs-on: ${{ matrix.os }} |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + with: |
| 43 | + submodules: 'recursive' |
| 44 | + - run: | |
| 45 | + echo "NIX_PATH=nixpkgs=$(jq -r '.nixpkgs.url' nix/sources.json)" >> $GITHUB_ENV |
| 46 | + - uses: cachix/install-nix-action@v31 |
| 47 | + with: |
| 48 | + nix_path: ${{ env.NIX_PATH }} |
| 49 | + - run: | |
| 50 | + echo "SPDK_REV=$(nix-instantiate --eval -A libspdk.rev | cut -d '"' -f2)" >> $GITHUB_ENV |
| 51 | + - uses: actions/checkout@v4 |
| 52 | + with: |
| 53 | + submodules: 'recursive' |
| 54 | + repository: ${{ github.repository_owner }}/spdk |
| 55 | + path: 'spdk' |
| 56 | + ref: ${{ env.SPDK_REV }} |
| 57 | + - run: nix-build shell.nix --argstr spdk-path ./spdk |
| 58 | + - run: | |
| 59 | + target="$(uname -m)-unknown-linux-gnu" |
| 60 | + nix-shell --argstr spdk-path spdk --run "./build_scripts/build_spdk.sh configure -t $target" |
| 61 | + - run: nix-shell --argstr spdk-path spdk --run "./build_scripts/build_spdk.sh make" |
| 62 | + - run: nix-shell --argstr spdk-path spdk --run "cargo build --all" |
| 63 | + # - name: Setup tmate session |
| 64 | + # if: ${{ failure() }} |
| 65 | + # timeout-minutes: 120 |
| 66 | + # uses: mxschmitt/action-tmate@v3 |
| 67 | + |
| 68 | + nix-lint: |
| 69 | + runs-on: ubuntu-latest |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@v4 |
| 72 | + with: |
| 73 | + submodules: 'recursive' |
| 74 | + - run: | |
| 75 | + echo "NIX_PATH=nixpkgs=$(jq -r '.nixpkgs.url' nix/sources.json)" >> $GITHUB_ENV |
| 76 | + - uses: cachix/install-nix-action@v31 |
| 77 | + with: |
| 78 | + nix_path: ${{ env.NIX_PATH }} |
| 79 | + - name: nix-shell |
| 80 | + run: nix-shell --pure -p nixpkgs-fmt --run "nixpkgs-fmt --check ." |
0 commit comments