Skip to content

Commit

Permalink
fix github actions workflows (#2363)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Feb 22, 2023
1 parent 0264ddc commit 25c1907
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 53 deletions.
133 changes: 93 additions & 40 deletions .github/workflows/build-x86-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ concurrency:
cancel-in-progress: true

env:
GOSEC_VERSION: '2.14.0'
HELM_VERSION: v3.10.1
GOSEC_VERSION: '2.15.0'
HELM_VERSION: v3.10.3

jobs:
build-kube-ovn:
Expand Down Expand Up @@ -60,7 +60,12 @@ jobs:
- name: Install gosec
run: |
curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin 'v${{ env.GOSEC_VERSION }}'
tmp=$(mktemp -d)
archive="gosec_${{ env.GOSEC_VERSION }}_$(go env GOHOSTOS)_$(go env GOHOSTARCH).tar.gz"
wget -q -O "$tmp/$archive" https://github.com/securego/gosec/releases/download/v${{ env.GOSEC_VERSION }}/$archive
tar --no-same-owner -C "$tmp" -xzf "$tmp/$archive"
install "$tmp/gosec" /usr/local/bin
rm -rf $tmp
- name: Build
run: |
Expand Down Expand Up @@ -93,9 +98,57 @@ jobs:
name: vpc-nat-gateway
path: vpc-nat-gateway.tar

build-e2e-binaries:
name: Build E2E Binaries
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v3

- name: Create the default branch directory
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
run: mkdir -p test/e2e/source

- name: Check out the default branch
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.repository.default_branch }}
fetch-depth: 1
path: test/e2e/source

- name: Export E2E directory
run: |
if [ '${{ github.base_ref || github.ref_name }}' = '${{ github.event.repository.default_branch }}' ]; then
echo "E2E_DIR=." >> "$GITHUB_ENV"
else
echo "E2E_DIR=test/e2e/source" >> "$GITHUB_ENV"
fi
- uses: actions/setup-go@v3
with:
go-version-file: ${{ env.E2E_DIR }}/go.mod
check-latest: true

- name: Export Go full version
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"

- name: Go cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-

- run: make e2e-compile

k8s-conformance-e2e:
name: Kubernetes Conformance E2E
needs: build-kube-ovn
needs:
- build-kube-ovn
- build-e2e-binaries
runs-on: ubuntu-22.04
timeout-minutes: 60
strategy:
Expand All @@ -112,9 +165,11 @@ jobs:
- uses: actions/checkout@v3

- name: Create the default branch directory
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
run: mkdir -p test/e2e/source

- name: Check out the default branch
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.repository.default_branch }}
Expand Down Expand Up @@ -143,18 +198,14 @@ jobs:
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"

- name: Go cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-

- name: Build e2e binaries
working-directory: ${{ env.E2E_DIR }}
run: make e2e-compile

- name: Install kind
uses: helm/kind-action@v1
with:
Expand Down Expand Up @@ -190,7 +241,9 @@ 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
needs:
- build-kube-ovn
- build-e2e-binaries
runs-on: ubuntu-22.04
timeout-minutes: 60
strategy:
Expand All @@ -204,9 +257,11 @@ jobs:
- uses: actions/checkout@v3

- name: Create the default branch directory
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
run: mkdir -p test/e2e/source

- name: Check out the default branch
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.repository.default_branch }}
Expand Down Expand Up @@ -235,18 +290,14 @@ jobs:
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"

- name: Go cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-

- name: Build e2e binaries
working-directory: ${{ env.E2E_DIR }}
run: make e2e-compile

- name: Install kind
uses: helm/kind-action@v1
with:
Expand Down Expand Up @@ -292,9 +343,11 @@ jobs:
- uses: actions/checkout@v3

- name: Create the default branch directory
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
run: mkdir -p test/e2e/source

- name: Check out the default branch
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.repository.default_branch }}
Expand Down Expand Up @@ -339,7 +392,9 @@ jobs:

kube-ovn-conformance-e2e:
name: Kube-OVN Conformance E2E
needs: build-kube-ovn
needs:
- build-kube-ovn
- build-e2e-binaries
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
Expand All @@ -353,9 +408,11 @@ jobs:
- uses: actions/checkout@v3

- name: Create the default branch directory
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
run: mkdir -p test/e2e/source

- name: Check out the default branch
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.repository.default_branch }}
Expand All @@ -379,18 +436,14 @@ jobs:
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"

- name: Go cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-

- name: Build e2e binaries
working-directory: ${{ env.E2E_DIR }}
run: make e2e-compile

- name: Install kind
uses: helm/kind-action@v1
with:
Expand Down Expand Up @@ -427,16 +480,20 @@ jobs:

kube-ovn-ic-conformance-e2e:
name: Kube-OVN IC Conformance E2E
needs: build-kube-ovn
needs:
- build-kube-ovn
- build-e2e-binaries
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v3

- name: Create the default branch directory
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
run: mkdir -p test/e2e/source

- name: Check out the default branch
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.repository.default_branch }}
Expand All @@ -460,18 +517,14 @@ jobs:
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"

- name: Go cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-

- name: Build e2e binaries
working-directory: ${{ env.E2E_DIR }}
run: make e2e-compile

- name: Install kind
uses: helm/kind-action@v1
with:
Expand Down Expand Up @@ -720,7 +773,9 @@ jobs:

cilium-chaining-e2e:
name: Cilium Chaining E2E
needs: build-kube-ovn
needs:
- build-kube-ovn
- build-e2e-binaries
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
Expand All @@ -730,9 +785,11 @@ jobs:
version: '${{ env.HELM_VERSION }}'

- name: Create the default branch directory
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
run: mkdir -p test/e2e/source

- name: Check out the default branch
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.repository.default_branch }}
Expand Down Expand Up @@ -761,18 +818,14 @@ jobs:
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"

- name: Go cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-

- name: Build e2e binaries
working-directory: ${{ env.E2E_DIR }}
run: make e2e-compile

- name: Install kind
uses: helm/kind-action@v1
with:
Expand Down Expand Up @@ -806,7 +859,9 @@ jobs:

kube-ovn-security-e2e:
name: Kube-OVN Security E2E
needs: build-kube-ovn
needs:
- build-kube-ovn
- build-e2e-binaries
runs-on: ubuntu-22.04
timeout-minutes: 30
strategy:
Expand All @@ -826,9 +881,11 @@ jobs:
- uses: actions/checkout@v3

- name: Create the default branch directory
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
run: mkdir -p test/e2e/source

- name: Check out the default branch
if: github.base_ref == github.event.repository.default_branch || github.ref_name == github.event.repository.default_branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.repository.default_branch }}
Expand All @@ -852,18 +909,14 @@ jobs:
run: echo "GO_FULL_VER=$(go version | awk '{print $3}')" >> "$GITHUB_ENV"

- name: Go cache
uses: actions/cache@v3
uses: actions/cache/restore@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-${{ hashFiles(format('{0}/**/go.sum', env.E2E_DIR)) }}
restore-keys: ${{ runner.os }}-e2e-${{ env.GO_FULL_VER }}-x86-

- name: Build e2e binaries
working-directory: ${{ env.E2E_DIR }}
run: make e2e-compile

- name: Install kind
uses: helm/kind-action@v1
with:
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ jobs:
# a pull request then we can checkout the head.
fetch-depth: 2

- uses: actions/setup-go@v3
with:
go-version-file: go.mod
check-latest: true

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
Expand All @@ -48,8 +53,8 @@ jobs:

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# - name: Autobuild
# uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -58,9 +63,9 @@ jobs:
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
- name: Build
run: |
make build-go
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

0 comments on commit 25c1907

Please sign in to comment.