-
Notifications
You must be signed in to change notification settings - Fork 1
178 lines (144 loc) · 4.41 KB
/
release.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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Release
on:
push:
branches:
- '*'
paths:
- '**'
- '!website/**'
env:
NOCACHE: "Cache-Control: no-cache, no-store"
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
CGO_ENABLED: "0"
HEPH_PROFILES: "release,ci"
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: magnetikonline/action-golang-cache@v4
with:
go-version: ~1.22
cache-key-suffix: -build
- name: Cache
uses: actions/cache@v3
with:
path: /tmp/heph-cache
key: heph-cache-build-${{ github.run_id }}
restore-keys: |
heph-cache-build-
- name: Bootstrap Build
run: go build -v -o heph github.com/hephbuild/heph/cmd/heph
- name: Build all OS/ARCH
run: |
mkdir -p dist
./heph r //:cp_builds $(pwd)/dist
ls ./dist
- name: Upload assets
uses: actions/upload-artifact@v3
with:
name: heph
path: dist/*
- name: Set version
id: version
run: |
VERSION=$(cat $(./heph run --print-out //:version))
echo $VERSION
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Setup tmate session
if: ${{ failure() }}
run: |
curl -L https://github.com/tmate-io/tmate/releases/download/2.4.0/tmate-2.4.0-static-linux-amd64.tar.xz | tar -xJ --strip-components 1
./tmate -F
upload_gcs:
name: Upload binaries
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: heph
path: dist
- name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
- name: Copy to bucket
id: upload
run: |
VERSION=${{needs.build.outputs.version}}
echo $VERSION
[ -z "$VERSION" ] && echo "Empty version" && exit 1
gsutil -h "${NOCACHE}" rsync -r './dist' gs://heph-build/${VERSION}
release:
name: Release
runs-on: ubuntu-latest
needs: [ build, upload_gcs, test ]
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
- name: Copy to bucket
run: |
VERSION=${{needs.build.outputs.version}}
echo $VERSION > ./latest_version
gsutil -h "${NOCACHE}" cp './latest_version' gs://heph-build/latest_version
gsutil -h "${NOCACHE}" cp './install.sh' gs://heph-build/install.sh
gsutil -h "${NOCACHE}" cp './hephw' gs://heph-build/hephw
test:
name: Test
needs: [ build ]
runs-on: ubuntu-latest
env:
HEPH_PROFILES: "ci"
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: magnetikonline/action-golang-cache@v4
with:
go-version: ~1.22
cache-key-suffix: -test
- uses: actions/download-artifact@v3
with:
name: heph
path: dist
- name: Setup heph bin
run: |
chmod +x dist/*
mkdir -p /home/runner/.local/bin
cp dist/heph_linux_amd64 /home/runner/.local/bin/heph
echo "HEPH_DIST_ROOT=$(pwd)/dist" >> $GITHUB_ENV
echo "HEPH_DIST_NOVERSION=1" >> $GITHUB_ENV
- name: Cache
uses: actions/cache@v3
with:
path: /tmp/heph-cache
key: heph-cache-test-${{ github.run_id }}
restore-keys: |
heph-cache-test-
- name: Go Tests
run: "heph run //:test_go"
- name: Light E2E Test
run: "heph run //:test_light_e2e"
- name: Light E2E ReTest
run: "heph run //:test_light_e2e"
- name: E2E Test
run: "heph run //:test_e2e"
- name: intg Test
run: "heph run //:test_intg"
- name: intg ReTest
run: "heph run //:test_intg"
- name: Cleanup .heph
run: |
rm -rf .heph/cache/test