Bump actions/checkout from 2 to 4 #115
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: CI | |
on: | |
push: | |
branches: | |
- main | |
- release-* | |
pull_request: {} | |
env: | |
# Common versions | |
GOLANGCI_VERSION: 'v1.52.2' | |
jobs: | |
detect-noop: | |
runs-on: ubuntu-latest | |
outputs: | |
cli-noop: ${{ steps.cli-noop.outputs.should_skip }} | |
operator-noop: ${{ steps.operator-noop.outputs.should_skip }} | |
steps: | |
- name: Detect CLI Noop Changes | |
id: cli-noop | |
uses: fkirc/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
paths_ignore: '["**.md", "**.png", "**.jpg"]' | |
paths: '["cli/**"]' | |
do_not_skip: '["workflow_dispatch", "schedule", "push"]' | |
concurrent_skipping: false | |
- name: Detect Operator Noop Changes | |
id: operator-noop | |
uses: fkirc/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
paths_ignore: '["**.md", "**.png", "**.jpg"]' | |
paths: '["operator/**"]' | |
do_not_skip: '["workflow_dispatch", "schedule", "push"]' | |
concurrent_skipping: false | |
operator-lint: | |
runs-on: ubuntu-latest | |
needs: detect-noop | |
if: needs.detect-noop.outputs.operator-noop != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: "operator/go.mod" | |
- name: Find the Go Cache | |
id: go | |
run: | | |
echo "::set-output name=build-cache::$(go env GOCACHE)" | |
echo "::set-output name=mod-cache::$(go env GOMODCACHE)" | |
- name: Cache the Go Build Cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.go.outputs.build-cache }} | |
key: ${{ runner.os }}-build-${{ github.sha }}-${{ hashFiles('**/go.sum') }} | |
- name: Cache Go Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.go.outputs.mod-cache }} | |
key: ${{ runner.os }}-mod-${{ github.sha }}-${{ hashFiles('**/go.sum') }} | |
- name: Lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: ${{ env.GOLANGCI_VERSION }} | |
working-directory: operator | |
skip-pkg-cache: true | |
skip-build-cache: true | |
args: --timeout=30m | |
operator-unit-tests: | |
runs-on: ubuntu-latest | |
needs: detect-noop | |
if: needs.detect-noop.outputs.operator-noop != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Fetch History | |
run: git fetch --prune --unshallow | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: "operator/go.mod" | |
- name: Find the Go Cache | |
id: go | |
run: | | |
echo "::set-output name=build-cache::$(go env GOCACHE)" | |
echo "::set-output name=mod-cache::$(go env GOMODCACHE)" | |
- name: Cache the Go Build Cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.go.outputs.build-cache }} | |
key: ${{ runner.os }}-build-${{ github.sha }}-${{ hashFiles('**/go.sum') }} | |
- name: Cache Go Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.go.outputs.mod-cache }} | |
key: ${{ runner.os }}-mod-${{ github.sha }}-${{ hashFiles('**/go.sum') }} | |
- name: Run Unit Tests | |
run: | | |
make -C ./operator test | |
cli-lint: | |
runs-on: ubuntu-latest | |
needs: detect-noop | |
if: needs.detect-noop.outputs.cli-noop != 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: "cli/go.mod" | |
- name: Find the Go Cache | |
id: go | |
run: | | |
echo "::set-output name=build-cache::$(go env GOCACHE)" | |
echo "::set-output name=mod-cache::$(go env GOMODCACHE)" | |
- name: Cache the Go Build Cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.go.outputs.build-cache }} | |
key: ${{ runner.os }}-build-${{ github.sha }}-${{ hashFiles('**/go.sum') }} | |
- name: Cache Go Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.go.outputs.mod-cache }} | |
key: ${{ runner.os }}-mod-${{ github.sha }}-${{ hashFiles('**/go.sum') }} | |
- name: Lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: ${{ env.GOLANGCI_VERSION }} | |
working-directory: cli | |
skip-pkg-cache: true | |
skip-build-cache: true | |
args: --timeout=30m |