Skip to content

Commit

Permalink
simplify github actions workflows (#2338)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Feb 22, 2023
1 parent 9db146c commit 6ac19b9
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 69 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/build-arm64-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

env:
GO_VERSION: '1.19'

jobs:
build:
name: Build arm64
Expand All @@ -30,9 +27,8 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '${{ env.GO_VERSION }}'
go-version-file: go.mod
check-latest: true
id: go

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -56,10 +52,10 @@ jobs:
restore-keys: ${{ runner.os }}-${{ env.GO_FULL_VER }}-arm64-

- name: Build
run: |
make release-arm || make release-arm
run: make release-arm || make release-arm

- name: Push
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'release') }}
if: github.ref == github.event.repository.default_branch || startsWith(github.ref, 'release-')
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-dpdk-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
run: |
make build-dpdk
- name: Push
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'release') }}
if: github.ref == github.event.repository.default_branch || startsWith(github.ref, 'release-')
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
Expand Down
99 changes: 44 additions & 55 deletions .github/workflows/build-x86-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Build x86 Image

on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
branches:
- master
- release-*
Expand All @@ -21,9 +26,7 @@ concurrency:
cancel-in-progress: true

env:
GO_VERSION: '1.19'
GOSEC_VERSION: '2.12.0'
KIND_VERSION: v0.17.0
GOSEC_VERSION: '2.14.0'
HELM_VERSION: v3.10.1

jobs:
Expand All @@ -35,9 +38,8 @@ jobs:
- uses: docker/setup-buildx-action@v2
- uses: actions/setup-go@v3
with:
go-version: '${{ env.GO_VERSION }}'
go-version-file: go.mod
check-latest: true
id: go

- name: Export Go full version
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
Expand Down Expand Up @@ -134,9 +136,8 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: '${{ env.GO_VERSION }}'
go-version-file: ${{ env.E2E_DIR }}/go.mod
check-latest: true
id: go

- name: Export Go full version
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
Expand All @@ -155,10 +156,9 @@ jobs:
run: make e2e-compile

- name: Install kind
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
uses: helm/kind-action@v1
with:
install_only: true

- name: Download image
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -189,6 +189,7 @@ jobs:

k8s-netpol-e2e:
name: Kubernetes Network Policy E2E
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'network policy')
needs: build-kube-ovn
runs-on: ubuntu-22.04
timeout-minutes: 60
Expand Down Expand Up @@ -227,9 +228,8 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: '${{ env.GO_VERSION }}'
go-version-file: ${{ env.E2E_DIR }}/go.mod
check-latest: true
id: go

- name: Export Go full version
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
Expand All @@ -248,10 +248,9 @@ jobs:
run: make e2e-compile

- name: Install kind
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
uses: helm/kind-action@v1
with:
install_only: true

- name: Download image
uses: actions/download-artifact@v3
Expand All @@ -278,6 +277,7 @@ jobs:

cyclonus-netpol-e2e:
name: Cyclonus Network Policy E2E
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'network policy')
needs: build-kube-ovn
runs-on: ubuntu-22.04
timeout-minutes: 30
Expand Down Expand Up @@ -310,10 +310,10 @@ jobs:
fi
- name: Install kind
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
uses: helm/kind-action@v1
with:
install_only: true

- name: Download image
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -349,9 +349,6 @@ jobs:
- ipv4
- ipv6
- dual
mode:
- overlay
- underlay
steps:
- uses: actions/checkout@v3

Expand All @@ -375,9 +372,8 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: '${{ env.GO_VERSION }}'
go-version-file: ${{ env.E2E_DIR }}/go.mod
check-latest: true
id: go

- name: Export Go full version
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
Expand All @@ -396,10 +392,9 @@ jobs:
run: make e2e-compile

- name: Install kind
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
uses: helm/kind-action@v1
with:
install_only: true

- name: Download image
uses: actions/download-artifact@v3
Expand All @@ -418,14 +413,13 @@ jobs:
sudo chown -R $(id -un). ~/.kube/
- name: Install Kube-OVN
run: make kind-install-${{ matrix.mode }}-${{ matrix.ip-family }}
run: make kind-install-${{ matrix.ip-family }}

- name: Run E2E
working-directory: ${{ env.E2E_DIR }}
env:
E2E_BRANCH: ${{ github.base_ref || github.ref_name }}
E2E_IP_FAMILY: ${{ matrix.ip-family }}
E2E_NETWORK_MODE: ${{ matrix.mode }}
run: make kube-ovn-conformance-e2e

- name: Cleanup
Expand All @@ -440,10 +434,9 @@ jobs:
- uses: actions/checkout@v3

- name: Install kind
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
uses: helm/kind-action@v1
with:
install_only: true

- name: Download image
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -476,10 +469,9 @@ jobs:
- uses: actions/checkout@v3

- name: Install kind
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
uses: helm/kind-action@v1
with:
install_only: true

- name: Download image
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -514,10 +506,9 @@ jobs:
- uses: actions/checkout@v3

- name: Install kind
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
uses: helm/kind-action@v1
with:
install_only: true

- name: Download image
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -552,10 +543,9 @@ jobs:
- uses: actions/checkout@v3

- name: Install kind
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
uses: helm/kind-action@v1
with:
install_only: true

- name: Download image
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -615,9 +605,8 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: '${{ env.GO_VERSION }}'
go-version-file: ${{ env.E2E_DIR }}/go.mod
check-latest: true
id: go

- name: Export Go full version
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"
Expand All @@ -636,10 +625,9 @@ jobs:
run: make e2e-compile

- name: Install kind
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
uses: helm/kind-action@v1
with:
install_only: true

- name: Download image
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -679,6 +667,7 @@ jobs:
- no-np-test
- cilium-chaining-e2e
name: push
if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -708,7 +697,7 @@ jobs:
make scan
- name: Push
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'release') }}
if: github.ref_name == github.event.repository.default_branch || startsWith(github.ref_name, 'release-')
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

env:
GO_VERSION: '1.19'

jobs:
golangci:
name: lint
Expand All @@ -23,9 +20,8 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '${{ env.GO_VERSION }}'
go-version-file: go.mod
check-latest: true
id: go

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand Down

0 comments on commit 6ac19b9

Please sign in to comment.