|
4 | 4 | pull_request: |
5 | 5 | branches: ['main'] |
6 | 6 | push: |
7 | | - branches: [ main ] |
| 7 | + branches: [main] |
8 | 8 | schedule: |
9 | 9 | - cron: '0 0 * * *' |
10 | 10 |
|
11 | | -jobs: |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 13 | + cancel-in-progress: true |
12 | 14 |
|
| 15 | +jobs: |
13 | 16 | build: |
| 17 | + name: Build & Test |
| 18 | + runs-on: ubuntu-latest |
14 | 19 | defaults: |
15 | 20 | run: |
16 | 21 | working-directory: image/git-init |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
| 24 | + - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 |
| 25 | + with: |
| 26 | + go-version-file: "image/git-init/go.mod" |
| 27 | + cache-dependency-path: "image/git-init/go.sum" |
| 28 | + - run: go build ./... |
| 29 | + - run: go vet ./... |
| 30 | + - run: go test ./... |
17 | 31 |
|
18 | | - name: Build |
| 32 | + e2e: |
| 33 | + name: E2E (${{ matrix.pipeline-version }}) |
| 34 | + needs: [build] |
19 | 35 | runs-on: ubuntu-latest |
20 | | - |
| 36 | + strategy: |
| 37 | + fail-fast: false |
| 38 | + matrix: |
| 39 | + # All supported Tekton Pipelines LTS versions |
| 40 | + # Update quarterly when new LTS is released |
| 41 | + pipeline-version: |
| 42 | + - v1.12.0 # LTS, EOL 2027-05-04 |
| 43 | + - v1.9.3 # LTS, EOL 2027-01-30 |
| 44 | + - v1.6.2 # LTS, EOL 2026-10-31 |
| 45 | + - v1.3.4 # LTS, EOL 2026-08-04 |
21 | 46 | steps: |
22 | 47 | - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
| 48 | + |
23 | 49 | - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 |
24 | 50 | with: |
25 | 51 | go-version-file: "image/git-init/go.mod" |
26 | 52 | cache-dependency-path: "image/git-init/go.sum" |
27 | 53 |
|
28 | | - # FIXME: figure out how to configure or use golangci-lint |
29 | | - # - uses: golang/govulncheck-action@dd3ead030e4f2cf713062f7a3395191802364e13 # v1 |
30 | | - # with: |
31 | | - # go-package: ./image/git-init/... |
32 | | - # go-version-input: ${{ matrix.go-version }} |
| 54 | + - uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9 |
33 | 55 |
|
34 | | - - run: go build ./... |
35 | | - - run: go vet ./... |
36 | | - - run: go test ./... |
| 56 | + - name: Create Kind cluster |
| 57 | + uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0 |
| 58 | + with: |
| 59 | + cluster_name: kind |
| 60 | + wait: 120s |
| 61 | + |
| 62 | + - name: Build and load image into Kind |
| 63 | + env: |
| 64 | + KO_DOCKER_REPO: kind.local |
| 65 | + run: | |
| 66 | + cd image/git-init |
| 67 | + ko build --sbom=none -B -t e2e . |
| 68 | + echo "GIT_INIT_IMAGE=kind.local/git-init:e2e" >> "$GITHUB_ENV" |
| 69 | +
|
| 70 | + - name: Run e2e tests |
| 71 | + env: |
| 72 | + PIPELINE_VERSION: ${{ matrix.pipeline-version }} |
| 73 | + TIMEOUT: 180s |
| 74 | + run: ./test/e2e-tests.sh |
| 75 | + |
| 76 | + ci-summary: |
| 77 | + name: CI summary |
| 78 | + needs: [build, e2e] |
| 79 | + runs-on: ubuntu-latest |
| 80 | + if: always() |
| 81 | + steps: |
| 82 | + - name: Check CI results |
| 83 | + run: | |
| 84 | + results=( |
| 85 | + "build=${NEEDS_BUILD_RESULT}" |
| 86 | + "e2e=${NEEDS_E2E_RESULT}" |
| 87 | + ) |
| 88 | + failed=0 |
| 89 | + for r in "${results[@]}"; do |
| 90 | + name="${r%%=*}" |
| 91 | + result="${r#*=}" |
| 92 | + echo "${name}: ${result}" |
| 93 | + if [ "$result" != "success" ] && [ "$result" != "skipped" ]; then |
| 94 | + failed=1 |
| 95 | + fi |
| 96 | + done |
| 97 | + if [ "$failed" -eq 1 ]; then |
| 98 | + echo "" |
| 99 | + echo "Some CI jobs failed or were cancelled" |
| 100 | + exit 1 |
| 101 | + fi |
| 102 | + echo "" |
| 103 | + echo "All CI checks passed" |
| 104 | + env: |
| 105 | + NEEDS_BUILD_RESULT: ${{ needs.build.result }} |
| 106 | + NEEDS_E2E_RESULT: ${{ needs.e2e.result }} |
0 commit comments