Skip to content

Commit

Permalink
ci test
Browse files Browse the repository at this point in the history
  • Loading branch information
nothub committed Feb 4, 2024
1 parent 317c891 commit ceff402
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 9 deletions.
27 changes: 22 additions & 5 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
name: '🚔'
on: [ push ]
jobs:
check:
release:
if: startsWith(github.ref, 'refs/tags/v') == false
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]

- uses: cachix/install-nix-action@v22
with:
go-version-file: 'go.mod'
check-latest: true
cache: true
nix_path: "nixpkgs=channel:nixos-23.11"

- name: 'Activate Nix store cache'
uses: actions/cache@v3
id: nix-cache
with:
path: "/tmp/nixcache"
key: "nix-store-${{ hashFiles(format('{0}/tools/build.sh', github.workspace)) }}"

- name: "Import Nix store cache"
if: "steps.nix-cache.outputs.cache-hit == 'true'"
run: nix-store --import < /tmp/nixcache

- run: |
make check
- name: "Export Nix store cache"
if: >
( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' )
&& steps.nix-cache.outputs.cache-hit != 'true'
run: nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nixcache
27 changes: 23 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,34 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]

- uses: cachix/install-nix-action@v22
with:
go-version-file: 'go.mod'
check-latest: true
cache: true
nix_path: "nixpkgs=channel:nixos-23.11"

- name: 'Activate Nix store cache'
uses: actions/cache@v3
id: nix-cache
with:
path: "/tmp/nixcache"
key: "nix-store-${{ hashFiles(format('{0}/tools/build.sh', github.workspace)) }}"

- name: "Import Nix store cache"
if: "steps.nix-cache.outputs.cache-hit == 'true'"
run: nix-store --import < /tmp/nixcache

- run: |
make check
- run: |
make release
- name: "Export Nix store cache"
if: >
( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' )
&& steps.nix-cache.outputs.cache-hit != 'true'
run: nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nixcache

- uses: softprops/action-gh-release@v1
with:
body: 'Built at commit: ${{ github.sha }}'
Expand Down

0 comments on commit ceff402

Please sign in to comment.