-
Notifications
You must be signed in to change notification settings - Fork 16
139 lines (135 loc) · 5.57 KB
/
ci.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
name: CI
on:
pull_request:
push:
# TODO: Once https://github.com/earthly/actions is more mature we can
# switch to it for installing earthly.
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
configuration_file:
[
'checker-index-tez.yaml',
'checker-index-fa2.yaml',
'checker-token-fa2.yaml',
]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Add git branch for earthly
run: |
branch=""
if [ -n "$GITHUB_HEAD_REF" ]; then
branch="$GITHUB_HEAD_REF"
else
branch="${GITHUB_REF##*/}"
fi
git checkout -b "$branch" || true
# FIXME: Might need to swap to a PAT here since GITHUB_TOKEN is still unreliable
# See: https://github.community/t/403-error-on-container-registry-push-from-github-action/173071
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install earthly
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.5.23/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
# Only push earthly cache from master
- if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: echo "push_flag=--push" >> $GITHUB_ENV
name: Enable push to build cache
- name: Choose configuration file
run: cp ${{ matrix.configuration_file }} checker.yaml
- name: Build dependencies
run: |
earthly --verbose --ci ${{ env.push_flag }} +flextesa
earthly --verbose --ci ${{ env.push_flag }} +deps-full
- name: Test checker_tools
run: earthly --verbose --ci ${{ env.push_flag }} +test-tools
- name: Formatting
run: |
earthly --verbose --ci +format-python-check
earthly --verbose --ci +format-ocaml-check
- name: Build
run: |
earthly --verbose --ci ${{ env.push_flag }} +generate-code
earthly --verbose --ci ${{ env.push_flag }} +build-ocaml
earthly --verbose --ci ${{ env.push_flag }} +build-ligo
earthly --verbose --ci --build-arg TAG=${{ github.sha }} ${{ env.push_flag }} +dev-container
earthly --verbose --ci --build-arg TAG=${{ github.sha }} ${{ env.push_flag }} +cli
- name: Export lazy entrypoint sizes
run: |
earthly --ci --artifact +build-ligo/michelson/functions.json functions.json
cat functions.json \
| jq --sort-keys '.lazy_functions | map({ key: .name, value: .chunks|add|length|(./2) }) | from_entries' \
| tee entrypoint-sizes.json
- uses: actions/[email protected]
if: github.event_name == 'push' && ${{ matrix.configuration_file }} == "checker-index-tez.yaml"
with:
name: stats
path: entrypoint-sizes.json
if-no-files-found: error
- name: Test
run: earthly --verbose --ci ${{ env.push_flag }} --artifact +test-coverage/test-coverage.json test-coverage.json
- uses: actions/[email protected]
if: github.event_name == 'push' && ${{ matrix.configuration_file }} == "checker-index-tez.yaml"
with:
name: stats
path: test-coverage.json
if-no-files-found: error
e2e:
runs-on: ubuntu-latest
strategy:
matrix:
configuration_file:
[
'checker-index-tez.yaml',
'checker-index-fa2.yaml',
'checker-token-fa2.yaml',
]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Add git branch for earthly
run: |
branch=""
if [ -n "$GITHUB_HEAD_REF" ]; then
branch="$GITHUB_HEAD_REF"
else
branch="${GITHUB_REF##*/}"
fi
git checkout -b "$branch" || true
# FIXME: Might need to swap to a PAT here since GITHUB_TOKEN is still unreliable
# See: https://github.community/t/403-error-on-container-registry-push-from-github-action/173071
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install earthly
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.5.23/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
# Note: Not pushing here to avoid clashing with pushes from the main `build` job
- name: Choose configuration file
run: cp ${{ matrix.configuration_file }} checker.yaml
- name: Run e2e tests
run: earthly --ci --artifact +test-e2e/ e2e-outputs
- uses: actions/[email protected]
# We only upload artifacts on 'push' events, this is simply to have one set of artifacts
# per commit.
if: github.event_name == 'push' && ${{ matrix.configuration_file }} == "checker-index-tez.yaml"
with:
name: stats
path: e2e-outputs/gas-costs.json
if-no-files-found: error
- uses: actions/[email protected]
if: github.event_name == 'push' && ${{ matrix.configuration_file }} == "checker-index-tez.yaml"
with:
name: gas-profile-plots
path: e2e-outputs/auction-gas-profiles.png
if-no-files-found: error