-
Notifications
You must be signed in to change notification settings - Fork 3
71 lines (62 loc) · 2.17 KB
/
test-and-tag.yml
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
name: test & tag
on:
merge_group:
pull_request:
push:
branches:
- "main"
tags-ignore:
- "v*"
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
# renovate: go-version
go-version: 1.22.6
- name: Run go tests
run: |
go test ./... -race -covermode=atomic -coverprofile=coverage.out
- name: Upload coverage to Codecov
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
files: coverage.out
token: ${{ secrets.CODECOV_TOKEN }}
# This builds the binary and starts it. If it does not exit within 3 seconds, consider it
# successful
#
# With this, we prevent regressions like in 9c9e365c6ada93d94e90eae85704f14b8afaa4c9.
- name: Verify binary works
run: |
make build
API_URL=https://example.com/api timeout 3 ./backend || code=$?; if [[ $code -ne 124 && $code -ne 0 ]]; then exit $code; fi
tag:
runs-on: ubuntu-latest
needs: test
if: github.repository == 'envelope-zero/backend' && github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
token: ${{ secrets.EZ_BOT_TOKEN }}
- name: Install svu
run: |
# renovate: datasource=github-releases depName=caarlos0/svu
export SVU_VERSION="v2.1.1"
curl -Lo ./svu.tar.gz "https://github.com/caarlos0/svu/releases/download/${SVU_VERSION}/svu_${SVU_VERSION#v}_linux_amd64.tar.gz"
tar -C "$HOME" -xzf svu.tar.gz
rm svu.tar.gz
- name: Tag new version
run: |
if [ $(git tag -l "$(~/svu next)") ]; then
echo "Tag already exists, no release necessary"
else
echo "Tagging new version"
git tag "$(~/svu next)"
git push --tags
fi