Skip to content

Commit 51f9f10

Browse files
committed
chore: break build & test into its own workflow
Signed-off-by: Matthew H. Irby <matt.irby@keyfactor.com>
1 parent 135ccf7 commit 51f9f10

2 files changed

Lines changed: 69 additions & 42 deletions

File tree

.github/workflows/keyfactor-bootstrap-workflow.yml

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,8 @@ on:
1010
- 'release-*.*'
1111

1212
jobs:
13-
14-
build:
15-
name: Build and Check CRDs
16-
runs-on: ubuntu-latest
17-
timeout-minutes: 8
18-
steps:
19-
- uses: actions/checkout@v4
20-
- uses: actions/setup-go@v4.2.1
21-
with:
22-
go-version-file: 'go.mod'
23-
cache: true
24-
- run: go mod download
25-
- run: go build -v ./cmd/main.go
26-
- name: Regenerate CRDs
27-
run: make generate manifests
28-
- name: Check for CRD drift
29-
run: |
30-
git diff --compact-summary --exit-code || \
31-
(echo; echo "Unexpected difference in directories after code generation. Run 'make generate manifests' and commit."; exit 1)
32-
# - name: Run linters
33-
# uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
34-
# with:
35-
# version: latest
36-
37-
test:
38-
name: Go Test
39-
needs: build
40-
runs-on: ubuntu-latest
41-
timeout-minutes: 5
42-
steps:
43-
- name: Checkout
44-
uses: actions/checkout@v4
45-
- name: Set up Go 1.x
46-
uses: actions/setup-go@v4.2.1
47-
with:
48-
go-version-file: 'go.mod'
49-
cache: true
50-
- run: go mod download
51-
- name: Run go test
52-
run: go test -v ./...
53-
5413
call-starter-workflow:
5514
uses: keyfactor/actions/.github/workflows/starter.yml@3.2.0
56-
needs: test
5715
secrets:
5816
token: ${{ secrets.V2BUILDTOKEN}}
5917
gpg_key: ${{ secrets.KF_GPG_PRIVATE_KEY }}

.github/workflows/test.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build and Test
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
push:
6+
branches:
7+
- 'main'
8+
- 'release-*.*'
9+
jobs:
10+
build:
11+
name: Build and Lint
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 5
14+
steps:
15+
# Checkout code
16+
# https://github.com/actions/checkout
17+
- name: Checkout code
18+
uses: actions/checkout@v5
19+
20+
# Setup GoLang build environment
21+
# https://github.com/actions/setup-go
22+
- name: Set up Go 1.x
23+
uses: actions/setup-go@v6
24+
with:
25+
go-version-file: 'go.mod'
26+
cache: true
27+
28+
# Download dependencies
29+
- run: go mod download
30+
31+
# Build Go binary
32+
- run: go build -v cmd/main.go
33+
34+
# Run Go linters
35+
# https://github.com/golangci/golangci-lint-action
36+
- name: Run linters
37+
uses: golangci/golangci-lint-action@v7
38+
with:
39+
version: v2.4.0
40+
41+
- name: Regenerate CRDs
42+
run: make generate manifests
43+
- name: Check for CRD drift
44+
run: |
45+
git diff --compact-summary --exit-code || \
46+
(echo; echo "Unexpected difference in directories after code generation. Run 'make generate manifests' and commit."; exit 1)
47+
48+
test:
49+
name: Go Test
50+
needs: build
51+
runs-on: ubuntu-latest
52+
timeout-minutes: 15
53+
steps:
54+
# Checkout code
55+
# https://github.com/actions/checkout
56+
- name: Checkout code
57+
uses: actions/checkout@v5
58+
59+
# Setup GoLang build environment
60+
# https://github.com/actions/setup-go
61+
- name: Set up Go 1.x
62+
uses: actions/setup-go@v6
63+
with:
64+
go-version-file: 'go.mod'
65+
cache: true
66+
67+
# Run Go tests
68+
- name: Run go test
69+
run: go test -v ./...

0 commit comments

Comments
 (0)