Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempt to fix ga hermit cache #1926

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/actions/hermit/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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') }}"
pre_commit="${{ hashFiles('.pre-commit-config.yaml') }}"
hash="$(echo "${bin_hashes} ${poetry_security_polices} ${poetry_tests} ${pre_commit}" | sha256sum | cut -d' ' -f1)"

echo "\$bin_hashes ${bin_hashes}"
echo "\$poetry_security_polices ${poetry_security_polices}"
echo "\$poetry_tests ${poetry_tests}"
echo "\$pre_commit ${pre_commit}"

echo "hash=$hash" >> "$GITHUB_OUTPUT"
- if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v4
with:
path: |
~/.cache/hermit/pkg
./.hermit
~/.cache/go-build
~/go/pkg/
~/.cache/pre-commit
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
23 changes: 8 additions & 15 deletions .github/workflows/azure-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,18 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4

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

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"

- name: Install Poetry
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry --version
pip3 install poetry
cd tests
poetry install

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

- name: Run Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
Expand Down Expand Up @@ -72,7 +66,6 @@ jobs:
env:
USE_K8S: false
run: |
poetry install
poetry run pytest -k "azure" --alluredir=./allure/results/ --clean-alluredir

- name: Print cloudbeat logs
Expand Down
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
12 changes: 4 additions & 8 deletions .github/workflows/eks-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,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
16 changes: 6 additions & 10 deletions .github/workflows/k8s-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,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 Expand Up @@ -365,8 +361,8 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4

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

- name: Set Kind Configuration
run: |
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,8 @@ 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: Init Hermit
run: ./bin/hermit env -r >> $GITHUB_ENV
- name: Hermit Environment
uses: ./.github/actions/hermit

- name: Packaging
run: |
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/periodic-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,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: Setup OPA
uses: open-policy-agent/setup-opa@v2
with:
version: 0.44 # this should be aligned with the version in go.mod
- name: Hermit Environment
uses: ./.github/actions/hermit

- name: build cloudbeat
run: mage Build
Expand Down
31 changes: 11 additions & 20 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,12 @@ 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: Hermit Environment
uses: ./.github/actions/hermit

- name: Mage build bundle before unit tests
uses: magefile/mage-action@v3
with:
args: buildOpaBundle
- name: build cloudbeat binary
shell: bash
run: mage buildOpaBundle

- name: Unit-Test
run: |
Expand All @@ -57,8 +54,8 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4

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

- name: Install goveralls
run: go install github.com/mattn/goveralls@latest
Expand Down Expand Up @@ -107,14 +104,8 @@ jobs:
repository: ${{ (github.event.pull_request_target || github.event.pull_request).head.repo.full_name }}
ref: ${{ (github.event.pull_request_target || github.event.pull_request).head.sha }}

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: .go-version
cache: false

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

- name: Go linter
run: golangci-lint run --whole-files --out-format github-actions
Expand All @@ -138,8 +129,8 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

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

- name: Terraform fmt
run: terraform fmt -check -recursive
Loading