From 48121af433e9c2bd5237a5c18e748ef852459d51 Mon Sep 17 00:00:00 2001 From: David Simansky Date: Tue, 17 Oct 2023 19:41:02 +0200 Subject: [PATCH] chore: Add go setup as composite action --- .github/composite/go-setup/action.yaml | 9 ++++++ .github/workflows/build.yaml | 5 +-- .github/workflows/check.yaml | 5 +-- .github/workflows/ci.yaml | 31 +++++-------------- .github/workflows/schema.yaml | 5 +-- .../workflows/test-e2e-oncluster-runtime.yaml | 5 +-- .github/workflows/test-e2e-oncluster.yaml | 5 +-- .github/workflows/test-e2e-runtime.yaml | 4 +-- .github/workflows/test-e2e.yaml | 5 +-- .github/workflows/test-embedded-fs.yaml | 7 ++--- .github/workflows/test-integration.yaml | 5 +-- .github/workflows/test-podman.yaml | 7 ++--- .github/workflows/test-unit.yaml | 5 +-- .github/workflows/update-builder.yaml | 4 +-- 14 files changed, 30 insertions(+), 72 deletions(-) create mode 100644 .github/composite/go-setup/action.yaml diff --git a/.github/composite/go-setup/action.yaml b/.github/composite/go-setup/action.yaml new file mode 100644 index 0000000000..de0a6cba69 --- /dev/null +++ b/.github/composite/go-setup/action.yaml @@ -0,0 +1,9 @@ +name: "Golang setup" + +runs: + using: "composite" + steps: + - uses: actions/setup-go@v4 + with: + go-version: 1.21.x + check-latest: true diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index af21b46478..85a9d18eab 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -7,7 +7,6 @@ jobs: name: Build strategy: matrix: - go: [1.20.x] os: ["ubuntu-latest", "windows-latest", "macos-latest"] runs-on: ${{ matrix.os }} steps: @@ -23,9 +22,7 @@ jobs: echo "/usr/local/bin" >> $GITHUB_PATH echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} + - uses: ./.github/composite/go-setup - name: Build run: make build diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index d7016e9368..a1e41bcbc2 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -7,14 +7,11 @@ jobs: name: Check Source strategy: matrix: - go: [1.20.x] os: ["ubuntu-latest"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} + - uses: ./.github/composite/go-setup - name: Check run: make check diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fec48ad45e..98b8ba5f21 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,9 +9,7 @@ jobs: runs-on: "ubuntu-latest" steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: "1.20.x" + - uses: ./.github/composite/go-setup - name: Lint run: make check && make check-templates - name: Check that 'func.yaml schema' is up-to-date @@ -22,16 +20,13 @@ jobs: test-unit: strategy: matrix: - go: [ 1.20.x ] java: [ 17 ] os: [ "ubuntu-latest", "windows-latest", "macos-latest" ] runs-on: ${{ matrix.os }} steps: - run: git config --global core.autocrlf false - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} + - uses: ./.github/composite/go-setup - uses: actions/setup-java@v1 with: java-version: ${{ matrix.java }} @@ -48,9 +43,7 @@ jobs: runs-on: "ubuntu-latest" steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: "1.20.x" + - uses: ./.github/composite/go-setup - name: Install Binaries run: ./hack/binaries.sh - name: Allocate Cluster @@ -67,14 +60,11 @@ jobs: e2e-test: strategy: matrix: - go: [1.20.x] os: ["ubuntu-latest"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} + - uses: ./.github/composite/go-setup - name: Install Binaries run: ./hack/binaries.sh - name: Allocate Cluster @@ -91,14 +81,11 @@ jobs: e2e-on-cluster-test: strategy: matrix: - go: [1.20.x] os: ["ubuntu-latest"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} + - uses: ./.github/composite/go-setup - uses: imjasonh/setup-ko@v0.6 - name: Install Binaries run: ./hack/binaries.sh @@ -124,9 +111,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: "1.20.x" + - uses: ./.github/composite/go-setup # Standard build tasks - name: Build run: make cross-platform @@ -165,8 +150,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: "1.20.x" + - uses: ./.github/composite/go-setup - uses: imjasonh/setup-ko@v0.6 - run: ko build --platform=linux/ppc64le,linux/s390x,linux/amd64,linux/arm64 -B ./cmd/func diff --git a/.github/workflows/schema.yaml b/.github/workflows/schema.yaml index 8a53403ece..6649528ceb 100644 --- a/.github/workflows/schema.yaml +++ b/.github/workflows/schema.yaml @@ -7,13 +7,10 @@ jobs: name: Check Schema strategy: matrix: - go: [1.20.x] os: ["ubuntu-latest"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} + - uses: ./.github/composite/go-setup - name: Check that 'func.yaml schema' is up-to-date run: make schema-check diff --git a/.github/workflows/test-e2e-oncluster-runtime.yaml b/.github/workflows/test-e2e-oncluster-runtime.yaml index 7eb883a443..518faba0af 100644 --- a/.github/workflows/test-e2e-oncluster-runtime.yaml +++ b/.github/workflows/test-e2e-oncluster-runtime.yaml @@ -8,15 +8,12 @@ jobs: continue-on-error: true strategy: matrix: - go: [1.20.x] os: ["ubuntu-latest"] func_builder: ["pack", "s2i"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} + - uses: ./.github/composite/go-setup - uses: imjasonh/setup-ko@v0.6 - name: Install Binaries run: ./hack/binaries.sh diff --git a/.github/workflows/test-e2e-oncluster.yaml b/.github/workflows/test-e2e-oncluster.yaml index 35c4bdc746..32470bc26f 100644 --- a/.github/workflows/test-e2e-oncluster.yaml +++ b/.github/workflows/test-e2e-oncluster.yaml @@ -7,14 +7,11 @@ jobs: name: On Cluster Test strategy: matrix: - go: [1.20.x] os: ["ubuntu-latest"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} + - uses: ./.github/composite/go-setup - uses: imjasonh/setup-ko@v0.6 - name: Install Binaries run: ./hack/binaries.sh diff --git a/.github/workflows/test-e2e-runtime.yaml b/.github/workflows/test-e2e-runtime.yaml index 2b558bd5e2..0dc87dff7b 100644 --- a/.github/workflows/test-e2e-runtime.yaml +++ b/.github/workflows/test-e2e-runtime.yaml @@ -16,9 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: 1.20.x + - uses: ./.github/composite/go-setup - name: Install Binaries run: ./hack/binaries.sh - name: Allocate Cluster diff --git a/.github/workflows/test-e2e.yaml b/.github/workflows/test-e2e.yaml index b2d0ea51a2..851ea178fa 100644 --- a/.github/workflows/test-e2e.yaml +++ b/.github/workflows/test-e2e.yaml @@ -7,14 +7,11 @@ jobs: name: E2E Test strategy: matrix: - go: [1.20.x] os: ["ubuntu-latest"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} + - uses: ./.github/composite/go-setup - name: Install Binaries run: ./hack/binaries.sh - name: Allocate Cluster diff --git a/.github/workflows/test-embedded-fs.yaml b/.github/workflows/test-embedded-fs.yaml index 91d11e2431..04bb6147da 100644 --- a/.github/workflows/test-embedded-fs.yaml +++ b/.github/workflows/test-embedded-fs.yaml @@ -7,18 +7,15 @@ jobs: name: Func Embedded FS Test strategy: matrix: - go: [1.20.x] os: ["ubuntu-latest"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} + - uses: ./.github/composite/go-setup - name: Check embedded templates content run: | if ! go test -run "^\QTestFileSystems\E$/^\Qembedded\E$" ./pkg/filesystem; then echo "Content of templates directory and embedded FS (zz_filesystem_generated.go) doesn't match!" - echo "Consult https://github.com/knative/func/blob/main/docs/CONTRIBUTING.md#templates ." + echo "Consult https:.github.com/knative/func/blob/main/docs/CONTRIBUTING.md#templates ." exit 1 fi diff --git a/.github/workflows/test-integration.yaml b/.github/workflows/test-integration.yaml index 86f4a77d63..a1b305ee1b 100644 --- a/.github/workflows/test-integration.yaml +++ b/.github/workflows/test-integration.yaml @@ -7,14 +7,11 @@ jobs: name: Integration Test strategy: matrix: - go: [1.20.x] os: ["ubuntu-latest"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} + - uses: ./.github/composite/go-setup - uses: imjasonh/setup-ko@v0.6 - name: Install Binaries run: ./hack/binaries.sh diff --git a/.github/workflows/test-podman.yaml b/.github/workflows/test-podman.yaml index f19a195f37..13984970e8 100644 --- a/.github/workflows/test-podman.yaml +++ b/.github/workflows/test-podman.yaml @@ -7,17 +7,14 @@ jobs: name: Podman Test strategy: matrix: - go: [1.20.x] os: ["ubuntu-latest"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} + - uses: ./.github/composite/go-setup - name: Install Podman run: | - # TODO uncomment following once https://github.com/containers/podman/pull/16781 is in the kubic repository + # TODO uncomment following once https:.github.com/containers/podman/pull/16781 is in the kubic repository #. /etc/os-release #sudo mkdir -p /etc/apt/keyrings #curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_${VERSION_ID}/Release.key \ diff --git a/.github/workflows/test-unit.yaml b/.github/workflows/test-unit.yaml index e401092302..2f3936978d 100644 --- a/.github/workflows/test-unit.yaml +++ b/.github/workflows/test-unit.yaml @@ -7,7 +7,6 @@ jobs: name: Unit Test strategy: matrix: - go: [1.20.x] java: [17] os: ["ubuntu-latest", "windows-latest", "macos-latest"] runs-on: ${{ matrix.os }} @@ -25,9 +24,7 @@ jobs: echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH - run: git config --global core.autocrlf false - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go }} + - uses: ./.github/composite/go-setup - uses: actions/setup-java@v1 with: java-version: ${{ matrix.java }} diff --git a/.github/workflows/update-builder.yaml b/.github/workflows/update-builder.yaml index 0cbe9380c0..0a4337dd3d 100644 --- a/.github/workflows/update-builder.yaml +++ b/.github/workflows/update-builder.yaml @@ -12,9 +12,7 @@ jobs: runs-on: "ubuntu-latest" steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: - go-version: "1.20.x" + - uses: ./.github/composite/go-setup - name: Build and Push env: GITHUB_TOKEN: ${{ github.token }}