-
Notifications
You must be signed in to change notification settings - Fork 98
147 lines (134 loc) · 5.02 KB
/
test.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
name: "build"
on:
push:
branches: [ master ]
pull_request: {}
jobs:
tests:
strategy:
matrix:
os: [ ubuntu-latest, macos-12 ]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
# fetch full history so that git merge-base works
fetch-depth: 0
# fetch PR commit, not predicted merge commit
ref: ${{ github.event.pull_request.head.sha }}
- uses: cachix/install-nix-action@v30
# We are using the ic-hs-test cachix cache that is also used by
# dfinity/ic-hs. This is partly laziness (on need to set up a separate
# cache), but also to get the ic-ref-test binary without rebuilding
- uses: cachix/cachix-action@v15
with:
name: ic-hs-test
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
# Free up disk space on Ubuntu
- name: Free Disk Space (Ubuntu)
uses: insightsengineering/disk-space-reclaimer@v1
if: startsWith(matrix.os, 'ubuntu-')
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tools-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: false
# until https://github.com/cachix/cachix-action/issues/86 is fixed:
- run: cachix watch-store ic-hs-test &
- run: nix-env -iA nix-build-uncached -f nix/
- name: "pre-build `drun`"
if: startsWith(github.head_ref, 'update/ic-')
run: |
nix-build --max-jobs 1 -A drun
nix-store --gc --print-roots | grep /motoko/
- name: "nix-build"
run: nix-build-uncached --max-jobs 4 -A all-systems-go -build-flags -L
- name: Calculate performance delta
if: github.actor != 'dependabot[bot]' && runner.os == 'Linux' && github.event_name == 'pull_request'
run: |
from="$(git merge-base origin/${{ github.base_ref }} HEAD)"
to="${{ github.event.pull_request.head.sha }}"
echo "Comparing changes from $from to $to"
nix-build --max-jobs 4 perf-delta.nix -o perf-delta.txt \
--argstr ref HEAD \
--argstr from "$from" \
--argstr to "$to"
- name: Read performance delta
if: github.actor != 'dependabot[bot]' && runner.os == 'Linux' && github.event_name == 'pull_request'
id: perf
uses: juliangruber/read-file-action@v1
with:
path: ./perf-delta.txt
- name: Find performance comment
if: github.actor != 'dependabot[bot]' && runner.os == 'Linux' && github.event_name == 'pull_request'
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- perf comment -->'
# Forks can't add comments so this job does not run on forks, see
# motoko#2864.
- name: Create or update performance comment
if: github.actor != 'dependabot[bot]' && runner.os == 'Linux' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
<!-- perf comment -->
${{ steps.perf.outputs.content }}
edit-mode: replace
reports:
if: github.ref == 'refs/heads/master'
needs: tests
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- uses: cachix/cachix-action@v15
with:
name: ic-hs-test
- name: Fetch report
run: nix-build -A report-site -o report-site
- name: Resolve symlinks
run: cp -rL report-site report-site-copy
- name: Push report to GitHub pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: report-site-copy
single-commit: true
artifacts:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && contains(github.event.pull_request.labels.*.name, 'build_artifacts')
strategy:
matrix:
os: [ ubuntu-latest, macos-12 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- uses: cachix/cachix-action@v15
with:
name: ic-hs-test
- name: nix-build
run: |
nix-build --arg officialRelease true -A moc
# upload-artifact doesn't work for symlink dir
# https://github.com/actions/upload-artifact/issues/92
- run: echo "UPLOAD_PATH=$(readlink -f result)" >> $GITHUB_ENV
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: moc-${{ matrix.os }}
path: ${{ env.UPLOAD_PATH }}
retention-days: 5