Skip to content

Commit

Permalink
attempt to fix ga hernmit cache
Browse files Browse the repository at this point in the history
  • Loading branch information
moukoublen committed Feb 13, 2024
1 parent 33d3d28 commit 605d74d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 15 deletions.
36 changes: 36 additions & 0 deletions .github/actions/hermit/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Hermit Environment'
description: 'Activate hermit environment'
inputs:
cache:
description: 'Cache hermit files'
required: false
default: 'true'
runs:
using: composite
steps:
- if: ${{ inputs.cache == 'true' }}
id: hermit-hash
shell: bash
run: |
bin_hashes="${{ hashFiles('./bin/*') }}"
poetry_security_polices="${{ hashFiles('./security-policies/poetry.lock', './security-policies/pyproject.toml') }}"
poetry_tests="${{ hashFiles('./tests/poetry.lock', './tests/pyproject.toml') }}"
hash="$(echo "${bin_hashes} ${poetry_security_polices} ${poetry_tests}" | sha256sum | cut -d' ' -f1)"
echo "hash=$hash" >> "$GITHUB_OUTPUT"
- if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v4
with:
path: |
~/.cache/hermit/pkg
./.hermit
~/.cache/go-build
~/go/pkg/
key: hermit-env-${{ runner.os }}-${{ steps.hermit-hash.outputs.hash }}
restore-keys: |
hermit-env-${{ runner.os }}
- shell: bash
run: ./bin/hermit env --raw >> "$GITHUB_ENV"
- shell: bash
run: hermit install
- shell: bash
run: go env
21 changes: 6 additions & 15 deletions .github/workflows/cloudbeat-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4

- name: Set up GO (with caching)
uses: magnetikonline/action-golang-cache@v4
with:
go-version-file: .go-version

- name: Init Hermit
run: ./bin/hermit env -r >> $GITHUB_ENV
- name: Hermit Environment
uses: ./.github/actions/hermit

- name: Install poetry
run: |
Expand Down Expand Up @@ -77,16 +72,12 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4

- name: Setup GO (with caching)
uses: magnetikonline/action-golang-cache@v4
with:
go-version-file: .go-version
- name: Hermit Environment
uses: ./.github/actions/hermit

- name: build cloudbeat binary
uses: magefile/mage-action@v3
with:
version: latest
args: build
shell: bash
run: mage build

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down

0 comments on commit 605d74d

Please sign in to comment.