From c89dfc1afd5f8b14fde756b6bd82c29ffc0814d7 Mon Sep 17 00:00:00 2001 From: Sebastian Sch Date: Mon, 2 Oct 2023 11:38:47 +0300 Subject: [PATCH] Speed up GitHub action runs and save resources - Require short running actions (golangci, test, build) before starting slower virtual-k8s-cluster and only run virtual-ocp when virtual-k8s-cluster succeed - Allow cancellation These two changes together reduce the amount of resources used Signed-off-by: Sebastian Sch --- .github/workflows/{go.yml => test.yml} | 59 +++++++++++++++++++++++++- .github/workflows/virtual-cluster.yml | 45 -------------------- 2 files changed, 58 insertions(+), 46 deletions(-) rename .github/workflows/{go.yml => test.yml} (62%) delete mode 100644 .github/workflows/virtual-cluster.yml diff --git a/.github/workflows/go.yml b/.github/workflows/test.yml similarity index 62% rename from .github/workflows/go.yml rename to .github/workflows/test.yml index d3e7d9b96..678a53268 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,11 @@ -name: Go +name: Test SR-IOV Operator on: [push, pull_request] +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: build: @@ -88,3 +92,56 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} path-to-lcov: lcov.out + + virtual-k8s-cluster: + name: k8s + needs: [ + build, + test, + golangci, + ] + runs-on: [ sriov ] + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Set up Go 1.20 + uses: actions/setup-go@v3 + with: + go-version: 1.20.x + + - name: run test + run: make test-e2e-conformance-virtual-k8s-cluster-ci + + - uses: actions/upload-artifact@v3 + if: always() + with: + name: artifact + path: ./artifacts.tar.gz + + virtual-ocp: + name: ocp + needs: [ + build, + test, + golangci, + ] + + runs-on: [ ocp ] + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Set up Go 1.20 + uses: actions/setup-go@v3 + with: + go-version: 1.20.x + + - name: run test + run: make test-e2e-conformance-virtual-ocp-cluster-ci + + - uses: actions/upload-artifact@v3 + if: always() + with: + name: artifact + path: ./artifacts.tar.gz \ No newline at end of file diff --git a/.github/workflows/virtual-cluster.yml b/.github/workflows/virtual-cluster.yml deleted file mode 100644 index 0d288e5c1..000000000 --- a/.github/workflows/virtual-cluster.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: sriov-operator-test -on: [pull_request] - -jobs: - virtual-k8s-cluster: - name: k8s - runs-on: [sriov] - steps: - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Set up Go 1.20 - uses: actions/setup-go@v3 - with: - go-version: 1.20.x - - - name: run test - run: make test-e2e-conformance-virtual-k8s-cluster-ci - - - uses: actions/upload-artifact@v3 - if: always() - with: - name: artifact - path: ./artifacts.tar.gz - - virtual-ocp: - name: ocp - runs-on: [ ocp ] - steps: - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Set up Go 1.20 - uses: actions/setup-go@v3 - with: - go-version: 1.20.x - - - name: run test - run: make test-e2e-conformance-virtual-ocp-cluster-ci - - - uses: actions/upload-artifact@v3 - if: always() - with: - name: artifact - path: ./artifacts.tar.gz