Skip to content

Commit 7f70c7d

Browse files
committed
.github/workflows: add a ci workflow…
… The goal is to remove the prow jobs. This is imported from tektoncd/pipeline. Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
1 parent 4d1f6af commit 7f70c7d

File tree

8 files changed

+518
-7
lines changed

8 files changed

+518
-7
lines changed

.github/workflows/ci.yaml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: ci
2+
3+
on: [pull_request] # yamllint disable-line rule:truthy
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.event.pull-request.number || github.ref }}
7+
cancel-in-progress: true
8+
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
permissions:
14+
contents: read
15+
checks: write # Used to annotate code in the PR
16+
17+
jobs:
18+
build:
19+
name: build
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
24+
with:
25+
go-version-file: "go.mod"
26+
- name: build
27+
run: |
28+
go build -v ./...
29+
linting:
30+
needs: [build]
31+
name: lint
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
36+
with:
37+
go-version-file: "go.mod"
38+
- name: gofmt
39+
run: |
40+
gofmt_out=$(gofmt -d $(find * -name '*.go' ! -path 'vendor/*' ! -path 'third_party/*'))
41+
if [[ -n "$gofmt_out" ]]; then
42+
failed=1
43+
fi
44+
echo "$gofmt_out"
45+
- name: golangci-lint
46+
uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0
47+
with:
48+
version: v1.64.6
49+
only-new-issues: true
50+
args: --timeout=10m
51+
- name: yamllint
52+
run: |
53+
apt update && apt install -y yamllint
54+
yamllint -c .yamllint $(find . -path ./vendor -prune -o -type f -regex ".*y[a]ml" -print | tr '\n' ' ')
55+
- name: check-license
56+
run: |
57+
go install github.com/google/go-licenses@v1.0.0
58+
go-licenses check ./...
59+
tests:
60+
needs: [build]
61+
name: test
62+
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
65+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
66+
with:
67+
go-version-file: "go.mod"
68+
- name: build
69+
run: |
70+
make test-unit-verbose-and-race
71+
generated:
72+
needs: [build]
73+
name: Check generated code
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
77+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
78+
with:
79+
go-version-file: "go.mod"
80+
- name: generated
81+
run: |
82+
go install github.com/google/go-licenses@v1.0.0 # Not sure why it is needed here
83+
./hack/verify-codegen.sh
84+
multi-arch-build:
85+
needs: [build]
86+
name: Multi-arch build
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
90+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
91+
with:
92+
go-version-file: "go.mod"
93+
- name: make cross
94+
run: |
95+
make cross
96+
e2e-tests:
97+
needs: [build]
98+
uses: ./.github/workflows/e2e-matrix.yml

.github/workflows/e2e-matrix.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Tekton Integration
2+
# Adapted from https://github.com/mattmoor/mink/blob/master/.github/workflows/minkind.yaml
3+
4+
on: [workflow_call]
5+
6+
defaults:
7+
run:
8+
shell: bash
9+
10+
jobs:
11+
e2e-tests:
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ matrix.k8s-name }}-${{ matrix.feature-flags }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
name: e2e tests
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false # Keep running if one leg fails.
19+
matrix:
20+
k8s-name:
21+
- k8s-oldest
22+
- k8s-plus-one
23+
24+
include:
25+
- k8s-name: k8s-oldest
26+
k8s-version: v1.28.x
27+
- k8s-name: k8s-plus-one
28+
k8s-version: v1.29.x
29+
env:
30+
KO_DOCKER_REPO: registry.local:5000/tekton
31+
CLUSTER_DOMAIN: c${{ github.run_id }}.local
32+
ARTIFACTS: ${{ github.workspace }}/artifacts
33+
34+
steps:
35+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
36+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
37+
with:
38+
go-version-file: "go.mod"
39+
- uses: ko-build/setup-ko@v0.8
40+
41+
- name: Install Dependencies
42+
working-directory: ./
43+
run: |
44+
echo '::group:: install go-junit-report'
45+
go install github.com/jstemmer/go-junit-report@v0.9.1
46+
echo '::endgroup::'
47+
48+
echo '::group:: created required folders'
49+
mkdir -p "${ARTIFACTS}"
50+
echo '::endgroup::'
51+
52+
echo "${GOPATH}/bin" >> "$GITHUB_PATH"
53+
54+
- name: Run tests
55+
run: |
56+
./hack/setup-kind.sh \
57+
--registry-url $(echo ${KO_DOCKER_REPO} | cut -d'/' -f 1) \
58+
--cluster-suffix c${{ github.run_id }}.local \
59+
--nodes 3 \
60+
--k8s-version ${{ matrix.k8s-version }} \
61+
--e2e-script ./test/e2e-tests.sh \
62+
--e2e-env ./test/e2e-tests-kind-prow.env
63+
64+
- name: Upload test results
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: ${{ matrix.k8s-version }}-${{ matrix.feature-flags }}
68+
path: ${{ env.ARTIFACTS }}
69+
70+
- uses: chainguard-dev/actions/kind-diag@main
71+
if: ${{ failure() }}
72+
with:
73+
artifact-name: ${{ matrix.k8s-version }}-${{ matrix.feature-flags }}-logs
74+
75+
- name: Dump Artifacts
76+
if: ${{ failure() }}
77+
run: |
78+
if [[ -d ${{ env.ARTIFACTS }} ]]; then
79+
cd ${{ env.ARTIFACTS }}
80+
for x in $(find . -type f); do
81+
echo "::group:: artifact $x"
82+
cat $x
83+
echo '::endgroup::'
84+
done
85+
fi

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ lint-yaml: ${YAML_FILES} ; $(info $(M) running yamllint…) ## runs yamllint on
118118
@yamllint -c .yamllint $(YAML_FILES)
119119

120120
## Tests
121-
TEST_UNIT_TARGETS := test-unit-verbose test-unit-race
121+
TEST_UNIT_TARGETS := test-unit-verbose test-unit-race test-unit-verbose-and-race
122122
test-unit-verbose: ARGS=-v
123123
test-unit-race: ARGS=-race
124+
test-unit-verbose-and-race: ARGS=-v -race
124125
$(TEST_UNIT_TARGETS): test-unit
125126
.PHONY: $(TEST_UNIT_TARGETS) test-unit
126127
test-unit: ; $(info $(M) running unit tests…) ## Run unit tests

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
github.com/tektoncd/chains v0.24.0
2727
github.com/tektoncd/hub v1.20.0
2828
github.com/tektoncd/pipeline v0.68.0
29-
github.com/tektoncd/plumbing v0.0.0-20250116154805-bf07e665a460
29+
github.com/tektoncd/plumbing v0.0.0-20250313115811-582146ce551e
3030
github.com/tektoncd/triggers v0.31.0
3131
github.com/theupdateframework/go-tuf v0.7.0
3232
go.opencensus.io v0.24.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,8 +1320,8 @@ github.com/tektoncd/hub v1.20.0 h1:/I5QAglWk62rlfFwN8+ekmQHyaULZpB9hIjqWzyqLbs=
13201320
github.com/tektoncd/hub v1.20.0/go.mod h1:cYjg75tI2IBHAuwmae+8lLKdriv2JoAfnxnVbx6b9+s=
13211321
github.com/tektoncd/pipeline v0.68.0 h1:bVzj+HbS/NQAPV2CfEW8HZrREm7uagPCzEggyxVTBdc=
13221322
github.com/tektoncd/pipeline v0.68.0/go.mod h1:MScUtGGW4VeaNcaNrulmNLBSn14EGTXXKy+kh+YZ8Gg=
1323-
github.com/tektoncd/plumbing v0.0.0-20250116154805-bf07e665a460 h1:J9Gk3j1x4Yi1qzcUn0w4KekxVdD7qTMdoGCChw3G32A=
1324-
github.com/tektoncd/plumbing v0.0.0-20250116154805-bf07e665a460/go.mod h1:Ks1fp1nPnhJxxT810eOkq2skeIiDuYjq3cIgpS5Gxk4=
1323+
github.com/tektoncd/plumbing v0.0.0-20250313115811-582146ce551e h1:3Zws3++VzABI9V2LLBjW2E7C1RcTKvI/8IHljCHf5V4=
1324+
github.com/tektoncd/plumbing v0.0.0-20250313115811-582146ce551e/go.mod h1:KTAEcFHz49nBdj/+ZX9LjVGjP5aaXm0JFnpqNnMNPuM=
13251325
github.com/tektoncd/triggers v0.31.0 h1:UiOn9sjavdJDEoAT+FZf+L3I1QQvzI31oJm8+GpNa7s=
13261326
github.com/tektoncd/triggers v0.31.0/go.mod h1:Oi+Umveu/vIefYAeS6XOa907tecAvx26sW7J62005tg=
13271327
github.com/thales-e-security/pool v0.0.2 h1:RAPs4q2EbWsTit6tpzuvTFlgFRJ3S8Evf5gtvVDbmPg=

0 commit comments

Comments
 (0)