Use GO 1.23 #3
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: Go | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: {} | |
pull_request: | |
branches: | |
- master | |
env: | |
# Common versions | |
GO_VERSION: '1.20' | |
GOLANGCI_VERSION: 'v1.49' | |
KIND_VERSION: 'v0.19.0' | |
jobs: | |
detect-noop: | |
runs-on: ubuntu-22.04 | |
outputs: | |
noop: ${{ steps.noop.outputs.should_skip }} | |
steps: | |
- name: Detect No-op Changes | |
id: noop | |
uses: fkirc/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]' | |
do_not_skip: '["workflow_dispatch", "schedule", "push"]' | |
concurrent_skipping: false | |
test: | |
runs-on: ubuntu-22.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v1 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
id: go | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Cache Go Dependencies | |
uses: actions/cache@v2 | |
with: | |
path: .work/pkg | |
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-pkg- | |
- name: install Kubebuilder | |
uses: RyanSiu1995/[email protected] | |
with: | |
version: 3.1.0 | |
kubebuilderOnly: false | |
kubernetesVersion: v1.22.0 | |
- name: Run Make test | |
run: make test | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: cover.out | |
flags: unit-test | |
name: codecov-umbrella | |
fail_ci_if_error: true | |
verbose: true | |
- name: Run Make | |
run: make | |
e2e-cluster-gateway: | |
runs-on: ubuntu-22.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v1 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
id: go | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Cache Go Dependencies | |
uses: actions/cache@v2 | |
with: | |
path: .work/pkg | |
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-pkg- | |
- name: Create k8s Kind Cluster | |
uses: helm/[email protected] | |
- name: Build Image | |
run: | | |
make image | |
kind load docker-image ghcr.io/kluster-manager/cluster-gateway:latest --name chart-testing | |
- name: Prepare ClusterGateway E2E Environment | |
run: | | |
helm install --create-namespace -n cluster-gateway \ | |
cluster-gateway ./charts/cluster-gateway \ | |
--set featureGate.healthiness=true \ | |
--set tag=latest | |
kubectl wait --for=condition=Available apiservice/v1alpha1.gateway.open-cluster-management.io | |
go run ./e2e/env/prepare | kubectl apply -f - | |
- name: Run Make test | |
run: | | |
kubectl get clustergateway | |
make test-e2e | |
e2e-ocm-addon-cluster-gateway: | |
runs-on: ubuntu-22.04 | |
needs: detect-noop | |
if: needs.detect-noop.outputs.noop != 'true' | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v1 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
id: go | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Cache Go Dependencies | |
uses: actions/cache@v2 | |
with: | |
path: .work/pkg | |
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-pkg- | |
- name: Install clusteradm | |
run: curl -L https://raw.githubusercontent.com/open-cluster-management-io/clusteradm/main/install.sh | bash | |
- name: Create k8s Kind Cluster | |
uses: helm/[email protected] | |
- name: Prepare OCM testing environment | |
run: | | |
clusteradm init --output-join-command-file join.sh --wait | |
sh -c "$(cat join.sh) loopback --force-internal-endpoint-lookup" | |
clusteradm accept --clusters loopback --wait 30 | |
kubectl wait --for=condition=ManagedClusterConditionAvailable managedcluster/loopback | |
- name: Build image | |
run: | | |
make image | |
kind load docker-image ghcr.io/kluster-manager/cluster-gateway:latest --name chart-testing | |
kind load docker-image ghcr.io/kluster-manager/cluster-gateway-manager:latest --name chart-testing | |
- name: Install latest cluster-gateway | |
run: | | |
helm install --create-namespace -n open-cluster-management-addon \ | |
cluster-gateway ./charts/addon-manager \ | |
--set tag=latest | |
go run ./e2e/env/prepare | kubectl apply -f - | |
- name: Run e2e test | |
run: | | |
make test-e2e-ocm |