feat: jfrog plugin + helm upload handler #4203
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: lint-and-test | |
on: | |
pull_request: | |
workflow_call: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
pull-requests: read | |
jobs: | |
test: | |
name: Run tests | |
runs-on: large_runner | |
steps: | |
- name: Self Hosted Runner Post Job Cleanup Action | |
uses: TooMuch4U/actions-clean@v2.2 | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: '${{ github.workspace }}/go.mod' | |
cache: false | |
- name: Get go environment for use with cache | |
run: | | |
echo "go_cache=$(go env GOCACHE)" >> $GITHUB_ENV | |
echo "go_modcache=$(go env GOMODCACHE)" >> $GITHUB_ENV | |
# This step will only reuse the go mod and build cache from main made during the Build, | |
# see lint_and_test.yaml => "test" Job | |
# This means it never caches by itself and PRs cannot cause cache pollution / thrashing | |
# This is because we have huge storage requirements for our cache because of the mass of dependencies | |
# | |
# NOTE: This is different from our regular build cache (which contains all archs and is built in a different job) | |
# This is because it requires caching of test dependencies, which are compiled only for linux-amd64 for test runs in CI. | |
- name: Restore / Reuse Cache from central build | |
id: cache-golang-restore | |
uses: actions/cache/restore@v4 # Only Restore, not build another cache (too big) | |
with: | |
path: | | |
${{ env.go_cache }} | |
${{ env.go_modcache }} | |
key: ${{ env.cache_name }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-${{ hashFiles('**/go.mod') }} | |
restore-keys: | | |
${{ env.cache_name }}-${{ runner.os }}-go- | |
env: | |
cache_name: run-tests-go-cache # needs to be the same key in the end as in the build step | |
- name: Build | |
run: make build -j | |
- name: Test | |
run: make install-requirements test | |
# NOTE: This is different from our regular build cache (which contains all archs and is built in a different job) | |
# This is because it requires caching of test dependencies, which are compiled only for linux-amd64 for test runs in CI. | |
- name: Save Cache of Build (only on main) | |
id: cache-golang-save | |
if: github.ref == 'refs/heads/main' # Only run on main, never in PR | |
uses: actions/cache/save@v4 # Only saves cache build-test (linux-amd64) | |
with: | |
path: | | |
${{ env.go_cache }} | |
${{ env.go_modcache }} | |
key: ${{ env.cache_name }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-${{ hashFiles('**/go.mod') }} | |
upload-chunk-size: 256000000 # default of 32MB is not really optimal for our large cache, choose 256MB instead | |
env: | |
cache_name: run-tests-go-cache # needs to be the same key in the end as in the build step | |
go-lint: | |
name: Lint Golang | |
runs-on: large_runner | |
steps: | |
- name: Self Hosted Runner Post Job Cleanup Action | |
uses: TooMuch4U/actions-clean@v2.2 | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: '${{ github.workspace }}/go.mod' | |
cache: false | |
- name: Get go environment for use with cache | |
run: | | |
echo "go_cache=$(go env GOCACHE)" >> $GITHUB_ENV | |
echo "go_modcache=$(go env GOMODCACHE)" >> $GITHUB_ENV | |
# This step will only reuse the go mod and build cache from main made during the Build, | |
# see push_ocm.yaml => "ocm-cli-latest" Job | |
# This means it never caches by itself and PRs cannot cause cache pollution / thrashing | |
# This is because we have huge storage requirements for our cache because of the mass of dependencies | |
- name: Restore / Reuse Cache from central build | |
id: cache-golang-restore | |
uses: actions/cache/restore@v4 # Only Restore, not build another cache (too big) | |
with: | |
path: | | |
${{ env.go_cache }} | |
${{ env.go_modcache }} | |
key: ${{ env.cache_name }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-${{ hashFiles('**/go.mod') }} | |
restore-keys: | | |
${{ env.cache_name }}-${{ runner.os }}-go- | |
env: | |
cache_name: ocm-cli-latest-go-cache # needs to be the same key in the end as in the build step | |
- name: Install goimports | |
run: go install golang.org/x/tools/cmd/goimports@latest | |
- name: Lint | |
run: make check |