Skip to content

Commit

Permalink
ci: eval devshell after checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyangli committed Nov 11, 2024
1 parent 37dbf57 commit 4b4adbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 29 deletions.
34 changes: 5 additions & 29 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ env:
NEMU_HOME: "${{ github.workspace }}/nemu"

jobs:
openperf_build_test:
test:
runs-on: ubuntu-latest

strategy:
max-parallel: 4
matrix:
test_name: ["mcf", "x264", "tcc", "stream", "linpack", "gemm", "whetstone"]
test_size: ["test", "ref"]
Expand All @@ -21,20 +22,14 @@ jobs:
- test_size: "ref"
test_name: "tcc"
steps:
- uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-unstable

- uses: nixbuild/nix-quick-install-action@v27

- uses: cachix/cachix-action@v14
with:
name: ysyx
authToken: '${{ secrets.CACHIX_SIGNING_KEY }}'

- name: Eval devshell
id: eval-devshell
run: |
echo "devshell-output=$(nix eval ./openperf#devShells.x86_64-linux.${{ matrix.arch }} --json)" >> "$GITHUB_OUTPUT"
- name: Checkout Main Repo (openperf)
id: checkout-openperf
uses: actions/checkout@v4
Expand All @@ -58,25 +53,6 @@ jobs:
repository: xinyangli/openperf-abstract-machine
path: abstract-machine

- name: Restore and cache Nix store
uses: nix-community/cache-nix-action@v5
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until Nix store size (in bytes) is at most this number
# before trying to save a new cache
gc-max-store-size-linux: 1073741824
# do purge caches
purge: true
# purge all versions of the cache
purge-prefixes: cache-${{ runner.os }}-
# created more than this number of seconds ago relative to the start of the `Post Restore` phase
purge-created: 0
# except the version with the `primary-key`, if it exists
purge-primary-key: never

- name: Prepare devshell
run: |
mkdir -p /tmp/env
Expand All @@ -85,7 +61,7 @@ jobs:
- name: Cache common libraries
uses: actions/cache@v4
with:
key: openperf-common-${{ matrix.arch }}-${{ steps.eval-devshell.outputs.devshell-output }}-${{ steps.checkout-openperf.outputs.commit }}-${{ steps.checkout-am.outputs.commit }}
key: openperf-common-${{ matrix.arch }}-${{ hashFiles('**/*.nix') }}-${{ steps.checkout-openperf.outputs.commit }}-${{ steps.checkout-am.outputs.commit }}
path: |
openperf/src/common
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ build/
!.gitignore
.vscode
abstract-machine/
!.gitea
!.github

0 comments on commit 4b4adbc

Please sign in to comment.