Skip to content

Commit 979e366

Browse files
committed
refactor: make workflows independent and minimize the unnecessary runs
1 parent f12a1cd commit 979e366

File tree

4 files changed

+130
-92
lines changed

4 files changed

+130
-92
lines changed

.github/workflows/e2e-tests.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: E2E tests
2+
3+
on:
4+
release:
5+
types: [created]
6+
pull_request:
7+
branches:
8+
- master
9+
paths:
10+
- "Dockerfile"
11+
- "**.go"
12+
- "!**_test.go" # exclude test files to ignore unit test changes
13+
- "e2e/**_test.go" # include test files in e2e again
14+
- ".github/workflows/e2e-tests.yaml"
15+
16+
env:
17+
GO111MODULE: on
18+
GOFLAGS: -mod=vendor
19+
20+
jobs:
21+
test-e2e:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26+
- name: Checkout repo
27+
uses: actions/checkout@v2
28+
29+
# Creates KinD with using k8s versions from the matrix above
30+
- name: Set up kind with K8s version v1.21.1
31+
uses: engineerd/[email protected]
32+
with:
33+
version: "v0.11.0"
34+
image: kindest/node:v1.21.1
35+
- name: Testing kind cluster set-up
36+
run: |
37+
kubectl cluster-info
38+
kubectl get pods -n kube-system
39+
echo "current-context:" $(kubectl config current-context)
40+
echo "environment-kubeconfig:" ${KUBECONFIG}
41+
42+
- name: Set up Go
43+
uses: actions/setup-go@v2
44+
with:
45+
go-version: 1.17
46+
47+
- name: e2e test
48+
working-directory: ./e2e
49+
run: go test -v -ginkgo.v

.github/workflows/lint.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Lint
2+
3+
on:
4+
release:
5+
types: [created]
6+
pull_request:
7+
branches:
8+
- master
9+
paths:
10+
- "**.go"
11+
- ".github/workflows/lint.yaml"
12+
- ".golangci.yml"
13+
14+
jobs:
15+
golangci:
16+
name: lint
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: golangci-lint
21+
uses: golangci/golangci-lint-action@v2
22+
with:
23+
version: v1.29
24+
args:
25+
-v
26+
--config=.golangci.yml
27+
--max-same-issues=50

.github/workflows/pr-checks.yml

Lines changed: 0 additions & 92 deletions
This file was deleted.

.github/workflows/unit-tests.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Unit test
2+
3+
on:
4+
release:
5+
types: [created]
6+
pull_request:
7+
branches:
8+
- master
9+
paths:
10+
- "**.go"
11+
- "!e2e/**" # exclude files from e2e tests
12+
- ".github/workflows/unit-tests.yaml"
13+
14+
env:
15+
GO111MODULE: on
16+
GOFLAGS: -mod=vendor
17+
18+
jobs:
19+
test-unit:
20+
strategy:
21+
matrix:
22+
os: [macos-latest, ubuntu-latest]
23+
24+
name: unit-test-${{ matrix.os }}
25+
runs-on: ${{ matrix.os }}
26+
27+
steps:
28+
- name: Set up Go
29+
uses: actions/setup-go@v1
30+
with:
31+
go-version: 1.17
32+
33+
- name: Check out code into the Go module directory
34+
uses: actions/checkout@v1
35+
36+
- name: Test
37+
run: ./hack/coverage.bash
38+
39+
test-unit-windows:
40+
runs-on: windows-latest
41+
name: unit-test-windows-latest
42+
43+
steps:
44+
- name: Set up Go
45+
uses: actions/setup-go@v1
46+
with:
47+
go-version: 1.17
48+
49+
- name: Check out code into the Go module directory
50+
uses: actions/checkout@v1
51+
52+
- name: Test
53+
run: ./hack/coverage.bash
54+
shell: bash

0 commit comments

Comments
 (0)