Skip to content

Commit

Permalink
chore: Add go setup as composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
dsimansk committed Oct 17, 2023
1 parent 788f18c commit f2122c5
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 73 deletions.
9 changes: 9 additions & 0 deletions .github/composite/go-setup/action.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 1 addition & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ jobs:
name: Build
strategy:
matrix:
go: [1.20.2]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -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

5 changes: 1 addition & 4 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ jobs:
name: Check Source
strategy:
matrix:
go: [1.20.2]
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

31 changes: 7 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.20.2"
- uses: ./.github/composite/go-setup
- name: Lint
run: make check && make check-templates
- name: Check that 'func.yaml schema' is up-to-date
Expand All @@ -22,16 +20,13 @@ jobs:
test-unit:
strategy:
matrix:
go: [ 1.20.2 ]
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 }}
Expand All @@ -48,9 +43,7 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.20.2"
- uses: ./.github/composite/go-setup
- name: Install Binaries
run: ./hack/binaries.sh
- name: Allocate Cluster
Expand All @@ -67,14 +60,11 @@ jobs:
e2e-test:
strategy:
matrix:
go: [1.20.2]
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
Expand All @@ -91,14 +81,11 @@ jobs:
e2e-on-cluster-test:
strategy:
matrix:
go: [1.20.2]
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/[email protected]
- name: Install Binaries
run: ./hack/binaries.sh
Expand All @@ -124,9 +111,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.20.2"
- uses: ./.github/composite/go-setup
# Standard build tasks
- name: Build
run: make cross-platform
Expand Down Expand Up @@ -165,8 +150,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.20.2"
- uses: ./.github/composite/go-setup
- uses: imjasonh/[email protected]
- run: ko build --platform=linux/ppc64le,linux/s390x,linux/amd64,linux/arm64 -B ./cmd/func
2 changes: 1 addition & 1 deletion .github/workflows/knative-verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

# This file is automagically synced here from github.com/knative-extensions/.github
# repo by knobots: https://github.com/knative-extensions/knobots and will be overwritten.
# repo by knobots: https:.github.com/knative-extensions/knobots and will be overwritten.

name: Verify

Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ jobs:
name: Check Schema
strategy:
matrix:
go: [1.20.2]
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
5 changes: 1 addition & 4 deletions .github/workflows/test-e2e-oncluster-runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ jobs:
continue-on-error: true
strategy:
matrix:
go: [1.20.2]
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/[email protected]
- name: Install Binaries
run: ./hack/binaries.sh
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/test-e2e-oncluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ jobs:
name: On Cluster Test
strategy:
matrix:
go: [1.20.2]
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/[email protected]
- name: Install Binaries
run: ./hack/binaries.sh
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test-e2e-runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.20.2
- uses: ./.github/composite/go-setup
- name: Install Binaries
run: ./hack/binaries.sh
- name: Allocate Cluster
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/test-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ jobs:
name: E2E Test
strategy:
matrix:
go: [1.20.2]
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
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/test-embedded-fs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@ jobs:
name: Func Embedded FS Test
strategy:
matrix:
go: [1.20.2]
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
5 changes: 1 addition & 4 deletions .github/workflows/test-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ jobs:
name: Integration Test
strategy:
matrix:
go: [1.20.2]
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/[email protected]
- name: Install Binaries
run: ./hack/binaries.sh
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/test-podman.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@ jobs:
name: Podman Test
strategy:
matrix:
go: [1.20.2]
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 \
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/test-unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ jobs:
name: Unit Test
strategy:
matrix:
go: [1.20.2]
java: [17]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
runs-on: ${{ matrix.os }}
Expand All @@ -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 }}
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/update-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down

0 comments on commit f2122c5

Please sign in to comment.