-
Notifications
You must be signed in to change notification settings - Fork 113
125 lines (111 loc) · 3.53 KB
/
build.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
name: build
on:
push:
branches:
- development
# Commented paths to avoid skipping required workflow
# See https://github.community/t/feature-request-conditional-required-checks/16761
# paths:
# - .github/workflows/build.yml
# - "**/*.go"
# - "chain/**"
# - "cmd/**"
# - "dot/**"
# - "internal/**"
# - "lib/**"
# - "pkg/**"
# - "tests/**"
# - .dockerignore
# - .codecov.yml
# - Dockerfile
# - go.mod
# - go.sum
# - Makefile
jobs:
builds:
timeout-minutes: 60
strategy:
matrix:
platform: [macos-latest, buildjet-4vcpu-ubuntu-2204]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"
stable: true
check-latest: true
- name: Set cache variables
id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- uses: actions/checkout@v4
- name: Go build cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-build
- name: Go modules cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-mod
- name: Run build
run: make build
publish-code-coverage:
timeout-minutes: 60
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"
stable: true
check-latest: true
- name: Set cache variables
id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- uses: actions/checkout@v4
- name: Go build cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-build
- name: Go modules cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-mod
- name: Install Subkey
run: |
wget -P $HOME/.local/bin/ https://chainbridge.ams3.digitaloceanspaces.com/subkey-v2.0.0
mv $HOME/.local/bin/subkey-v2.0.0 $HOME/.local/bin/subkey
chmod +x $HOME/.local/bin/subkey
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Generate coverage report
run: |
go test ./... -coverprofile=coverage.out -covermode=atomic -timeout=20m
- uses: codecov/[email protected]
with:
files: ./coverage.out
flags: unit-tests
name: coverage
verbose: true
docker-build-n-push:
runs-on: buildjet-4vcpu-ubuntu-2204
env:
DOCKER_BUILDKIT: "1"
steps:
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
push: true
tags: chainsafe/gossamer:latest