Skip to content

Commit

Permalink
enhance ci with test matrix
Browse files Browse the repository at this point in the history
Signed-off-by: zhaque44 <[email protected]>
  • Loading branch information
zhaque44 committed Sep 12, 2024
1 parent be80336 commit bf0ee68
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,46 @@ on:
jobs:

build-test:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: build
run: make build

unit-test:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
SKIP_TESTS: true
steps:
- name: Create k8s Kind Cluster
if: ${{ matrix.os == 'ubuntu-latest' }} # Only runs on Ubuntu
uses: helm/[email protected]
with:
cluster_name: cluster
- name: Set k8s provider
if: ${{ matrix.os == 'ubuntu-latest' }} # Only runs on Ubuntu
run: |
kubectl create namespace test-namespace
kubectl create secret generic mysecret -n test-namespace --from-literal=key=p4ssw0rd
Expand All @@ -40,5 +59,14 @@ jobs:
with:
go-version-file: 'go.mod'
cache: true
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: test
run: make test
run: make test

0 comments on commit bf0ee68

Please sign in to comment.