...
1#
2# Copyright 2021 The Sigstore Authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16name: CI
17
18on:
19 push:
20 branches:
21 - main
22 - 'release-**'
23 pull_request:
24 branches:
25 - main
26 - 'release-**'
27
28permissions:
29 contents: read
30
31jobs:
32 build:
33 runs-on: ubuntu-latest
34
35 steps:
36 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
37 - name: Extract version of Go to use
38 run: echo "GOVERSION=$(cat Dockerfile|grep golang | awk ' { print $2 } ' | cut -d '@' -f 1 | cut -d ':' -f 2 | uniq)" >> $GITHUB_ENV
39 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
40 with:
41 go-version: ${{ env.GOVERSION }}
42
43 - name: Build
44 run: make -C $GITHUB_WORKSPACE all
45 - name: Fuzz-Build
46 run: make -C $GITHUB_WORKSPACE fuzz
47 - name: Test
48 run: go test -v -coverprofile=coverage.txt -covermode=atomic ./...
49 - name: Upload Coverage Report
50 uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab # v4.1.0
51 with:
52 flags: unittests
53 - name: Ensure no files were modified as a result of the build
54 run: git update-index --refresh && git diff-index --quiet HEAD -- || git diff --exit-code
55
56 container-build:
57 runs-on: ubuntu-latest
58 steps:
59 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
60 - name: Extract version of Go to use
61 run: echo "GOVERSION=$(cat Dockerfile|grep golang | awk ' { print $2 } ' | cut -d '@' -f 1 | cut -d ':' -f 2 | uniq)" >> $GITHUB_ENV
62 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
63 with:
64 go-version: ${{ env.GOVERSION }}
65
66 - uses: ko-build/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6
67
68 - name: container
69 run: |
70 make ko-local
71 docker run --rm $(cat rekorImagerefs) version
72 docker run --rm $(cat cliImagerefs) version
73 docker run --rm $(cat redisImagerefs) --version
74
75 e2e:
76 runs-on: ubuntu-latest
77 needs: build
78
79 steps:
80 - name: download minisign
81 # run: sudo add-apt-repository ppa:dysfunctionalprogramming/minisign && sudo apt-get update && sudo apt-get install minisign
82 run: sudo add-apt-repository ppa:savoury1/minisign && sudo apt-get update && sudo apt-get install minisign
83
84 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
85 - name: Extract version of Go to use
86 run: echo "GOVERSION=$(cat Dockerfile|grep golang | awk ' { print $2 } ' | cut -d '@' -f 1 | cut -d ':' -f 2 | uniq)" >> $GITHUB_ENV
87 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
88 with:
89 go-version: ${{ env.GOVERSION }}
90 - name: install gocovmerge
91 run: make gocovmerge
92
93 - name: CLI
94 run: ./tests/e2e-test.sh
95 - name: Refactor-e2e # this will a WIP to move all the tests to respective packages
96 run: ./e2e-test.sh
97 - name: Upload logs if they exist
98 uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
99 if: failure()
100 with:
101 name: E2E Docker Compose logs
102 path: /tmp/docker-compose.log
103 - name: Upload Coverage Report
104 uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab # v4.1.0
105 with:
106 files: /tmp/rekor-merged.cov,/tmp/pkg-rekor-merged.cov
107 flags: e2etests
108
109 sharding-e2e:
110 runs-on: ubuntu-latest
111 needs: build
112
113 steps:
114 - name: download minisign
115 # run: sudo add-apt-repository ppa:dysfunctionalprogramming/minisign && sudo apt-get update && sudo apt-get install minisign
116 run: sudo add-apt-repository ppa:savoury1/minisign && sudo apt-get update && sudo apt-get install minisign
117 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
118 - name: Docker Build
119 run: docker-compose build
120 - name: Extract version of Go to use
121 run: echo "GOVERSION=$(cat Dockerfile|grep golang | awk ' { print $2 } ' | cut -d '@' -f 1 | cut -d ':' -f 2 | uniq)" >> $GITHUB_ENV
122 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
123 with:
124 go-version: ${{ env.GOVERSION }}
125
126 - name: Sharding Test
127 run: ./tests/sharding-e2e-test.sh
128 - name: Upload logs if they exist
129 uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
130 if: failure()
131 with:
132 name: Sharding E2E Docker Compose logs
133 path: /tmp/docker-compose.log
134
135 issue-872-e2e:
136 runs-on: ubuntu-latest
137 needs: build
138
139 steps:
140 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
141 - name: Docker Build
142 run: docker-compose build
143 - name: Extract version of Go to use
144 run: echo "GOVERSION=$(cat Dockerfile|grep golang | awk ' { print $2 } ' | cut -d '@' -f 1 | cut -d ':' -f 2 | uniq)" >> $GITHUB_ENV
145 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
146 with:
147 go-version: ${{ env.GOVERSION }}
148
149 - name: Test for Attestation begin returned that was previously persisted in tlog
150 run: ./tests/issue-872-e2e-test.sh
151 - name: Upload logs if they exist
152 uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
153 if: failure()
154 with:
155 name: Docker Compose logs
156 path: /tmp/*docker-compose.log
157
158 harness:
159 runs-on: ubuntu-latest
160 needs: build
161 steps:
162 - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
163 - name: Create git branch
164 run: git switch -c harness-test-branch
165 - name: Extract version of Go to use
166 run: echo "GOVERSION=$(cat Dockerfile|grep golang | awk ' { print $2 } ' | cut -d '@' -f 1 | cut -d ':' -f 2 | uniq)" >> $GITHUB_ENV
167 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
168 with:
169 go-version: ${{ env.GOVERSION }}
170
171 - name: Run test harness
172 run: ./tests/rekor-harness.sh
173 - name: Upload logs if they exist
174 uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
175 if: failure()
176 with:
177 name: E2E Docker Compose logs
178 path: /tmp/docker-compose.log
View as plain text