-
Notifications
You must be signed in to change notification settings - Fork 405
153 lines (125 loc) · 5.38 KB
/
nightly-emscripten.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
name: Emscripten nightly build + push to solc-bin
on:
schedule:
# Run once a day, at midnight
- cron: '0 0 * * *'
env:
TARGET_BRANCH: gh-pages
COMMITTER_NAME: emscripten nightly action
COMMITTER_EMAIL: builds@ethereum.org
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build-emscripten-nightly:
runs-on: ubuntu-latest
outputs:
solidity-version: ${{ env.SOLIDITY_VERSION }}
nightly-version: ${{ env.NIGHTLY_VERSION }}
nightly-already-exists: ${{ env.NIGHTLY_ALREADY_EXISTS }}
steps:
- name: Symlink solc-bin to /mnt/solc-bin
# It's now too big to fit on the main partition on Ubuntu, which is mostly filled with software.
# NOTE: We don't clone to /mnt/solc-bin directly because the checkout action does not support that.
# See https://github.com/actions/checkout/issues/197
run: |
sudo mkdir /mnt/solc-bin/
sudo chown "$USER" /mnt/solc-bin/
ln -s /mnt/solc-bin/ solc-bin
- uses: actions/checkout@v4
with:
repository: 'ethereum/solidity'
ref: 'develop'
path: 'solidity/'
submodules: 'recursive'
- name: Clone solc-bin repository without checking out a working copy
run: |
git clone --no-checkout --branch "$TARGET_BRANCH" "https://github.com/${GITHUB_REPOSITORY}.git" solc-bin/
# For some reason git stages all files for deletion when you use --no-checkout
cd solc-bin/
git reset HEAD --quiet
- name: Determine Solidity version
run: |
cd solidity/
last_commit_timestamp=$(git log -1 --date=iso --format=%ad HEAD)
last_commit_date=$(date --date="$last_commit_timestamp" --utc +%Y.%-m.%-d)
last_commit_hash=$(git rev-parse --short=8 HEAD)
solidity_version=$("scripts/get_version.sh")
nightly_version="v${solidity_version}-nightly.${last_commit_date}+commit.${last_commit_hash}"
echo "LAST_COMMIT_DATE=${last_commit_date}" >> $GITHUB_ENV
echo "LAST_COMMIT_HASH=${last_commit_hash}" >> $GITHUB_ENV
echo "SOLIDITY_VERSION=${solidity_version}" >> $GITHUB_ENV
echo "NIGHTLY_VERSION=${nightly_version}" >> $GITHUB_ENV
- name: Check if there's already a nightly with the same date or commit ID
run: |
cd solc-bin/
matching_nightlies_in_the_repo="$(
git ls-files "bin/soljson-v${SOLIDITY_VERSION}-nightly.${LAST_COMMIT_DATE}+commit.*.js";
git ls-files "bin/soljson-v${SOLIDITY_VERSION}-nightly.*+commit.${LAST_COMMIT_HASH}.js"
)"
nightly_already_exists="$(test -n "$matching_nightlies_in_the_repo" && echo true || echo false)"
# There's no way to just stop a job without failing and that would spam everyone with
# spurious e-mail notifications about the failure. Instead we have to make do with `if`s.
echo "NIGHTLY_ALREADY_EXISTS=${nightly_already_exists}" >> $GITHUB_ENV
- name: Build soljson.js
if: "env.NIGHTLY_ALREADY_EXISTS == 'false'"
run: |
cd solidity/
# Note that this script will spawn and build inside a docker image (which works just fine in github actions).
scripts/build_emscripten.sh --prerelease-source "nightly"
- name: Upload soljson.js as an artifact
if: "env.NIGHTLY_ALREADY_EXISTS == 'false'"
uses: actions/upload-artifact@v4
with:
name: soljson.js
path: solidity/upload/soljson.js
test-emscripten-nightly:
runs-on: ubuntu-latest
needs: build-emscripten-nightly
env:
SOLIDITY_VERSION: ${{ needs.build-emscripten-nightly.outputs.solidity-version }}
if: "needs.build-emscripten-nightly.outputs.nightly-already-exists == 'false'"
steps:
- uses: actions/checkout@v4
with:
repository: 'ethereum/solidity'
submodules: 'recursive'
- name: Download soljson.js artifact
uses: actions/download-artifact@v4
with:
name: soljson.js
- name: Run solc-js tests
run: |
test/externalTests/solc-js/solc-js.sh "${PWD}/soljson.js" "$SOLIDITY_VERSION"
add-nightly-and-push:
runs-on: ubuntu-latest
needs:
- build-emscripten-nightly
- test-emscripten-nightly
env:
NIGHTLY_VERSION: ${{ needs.build-emscripten-nightly.outputs.nightly-version }}
if: "needs.build-emscripten-nightly.outputs.nightly-already-exists == 'false'"
steps:
- uses: actions/setup-node@v4
- name: Symlink solc-bin to /mnt/solc-bin
# It's now too big to fit on the main partition on Ubuntu, which is mostly filled with software.
run: |
sudo mkdir /mnt/solc-bin/
sudo chown "$USER" /mnt/solc-bin/
ln -s /mnt/solc-bin/ solc-bin
- uses: actions/checkout@v4
with:
ref: ${{ env.TARGET_BRANCH }}
path: 'solc-bin'
- name: Download soljson.js artifact
uses: actions/download-artifact@v4
with:
name: soljson.js
- name: Set committer name and e-mail
run: |
cd solc-bin/
git config --local user.name "$COMMITTER_NAME"
git config --local user.email "$COMMITTER_EMAIL"
- name: Run add-nightly-and-push.sh
run: |
soljson_path="${PWD}/soljson.js"
cd solc-bin/
./add-nightly-and-push.sh "$soljson_path" "$NIGHTLY_VERSION"