Skip to content

Commit a0c7d5d

Browse files
committed
Add test job and fix tests
Signed-off-by: Dr. Stefan Schimanski <[email protected]>
1 parent 0c5a145 commit a0c7d5d

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

.github/workflows/test..yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: test
2+
on:
3+
pull_request:
4+
types: [opened, edited, synchronize, reopened]
5+
branches:
6+
- main
7+
8+
permissions:
9+
# Required: allow read access to the content for analysis.
10+
contents: read
11+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
12+
pull-requests: read
13+
# Optional: Allow write access to checks to allow the action to annotate code in the PR.
14+
checks: write
15+
16+
jobs:
17+
test:
18+
name: make test
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2
22+
- name: Calculate go version
23+
id: vars
24+
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
25+
- name: Set up Go
26+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # tag=v5.3.0
27+
with:
28+
go-version: ${{ steps.vars.outputs.go_version }}
29+
- name: make test
30+
run: MAKEFLAGS="-s" make test

hack/check-everything.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,16 @@ header_text "installing envtest tools@${ENVTEST_K8S_VERSION} with setup-envtest
3636
tmp_bin=/tmp/cr-tests-bin
3737
(
3838
# don't presume to install for the user
39-
cd ${hack_dir}/../tools/setup-envtest
40-
GOBIN=${tmp_bin} go install .
39+
GOBIN=${tmp_bin} go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
4140
)
4241
export KUBEBUILDER_ASSETS="$(${tmp_bin}/setup-envtest use --use-env -p path "${ENVTEST_K8S_VERSION}")"
4342

4443
# Run tests.
4544
${hack_dir}/test-all.sh
4645

4746
header_text "confirming examples compile (via go install)"
48-
go install ${MOD_OPT} ./examples/builtins
49-
go install ${MOD_OPT} ./examples/crd
47+
pushd examples/kind; go install ${MOD_OPT} .; popd
48+
pushd examples/namespace; go install ${MOD_OPT} .; popd
5049

5150
echo "passed"
5251
exit 0

0 commit comments

Comments
 (0)