-
Notifications
You must be signed in to change notification settings - Fork 2
114 lines (104 loc) · 3.04 KB
/
latest.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
schedule:
- cron: '0 0 * * *'
name: build-test-publish
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- run: go env
- name: go build
run: go build -v ./...
- name: go test
run: go test -v ./...
e2e:
name: e2e tests
runs-on: ubuntu-latest
needs: [ build ]
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: imjasonh/[email protected]
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- uses: chainguard-dev/actions/setup-kind@main
with:
k8s-version: v1.23.x
- uses: vdemeester/setup-tektoncd@main
with:
pipeline: v0.40.x
pipeline-feature-flags: '{"enable-api-fields": "alpha"}'
- name: install manual-approval-gate custom task
run: |
# FIXME: remove this once >= 0.41.x
kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/previous/v0.40.2/resolvers.yaml
ko apply --local -f config/
publish:
name: publish latest
runs-on: ubuntu-latest
needs: [ build ]
# https://docs.github.com/en/actions/reference/authentication-in-a-workflow
permissions:
id-token: write
packages: write
contents: read
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}/base
flavor: |
latest=${{ github.event_name != 'pull_request' }}
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v2
- uses: docker/build-push-action@v4
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
context: ./images/base
- uses: imjasonh/[email protected]
- run: |
ko publish --push=${{ github.event_name != 'pull_request' }} --base-import-paths ./cmd/controller
ko publish --push=${{ github.event_name != 'pull_request' }} --base-import-paths ./cmd/cache