Skip to content

Commit 72e15af

Browse files
committed
ci: use GH action to perform build for macos
Signed-off-by: deadprogram <[email protected]>
1 parent 6cb604c commit 72e15af

File tree

2 files changed

+108
-106
lines changed

2 files changed

+108
-106
lines changed

.circleci/config.yml

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -99,104 +99,6 @@ commands:
9999
- ~/.cache/go-build
100100
- /go/pkg/mod
101101
- run: make fmt-check
102-
build-macos:
103-
steps:
104-
- checkout
105-
- submodules
106-
- run:
107-
name: "Install dependencies"
108-
command: |
109-
curl https://dl.google.com/go/go1.17.darwin-amd64.tar.gz -o go1.17.darwin-amd64.tar.gz
110-
sudo tar -C /usr/local -xzf go1.17.darwin-amd64.tar.gz
111-
ln -s /usr/local/go/bin/go /usr/local/bin/go
112-
HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake ninja
113-
- install-xtensa-toolchain:
114-
variant: "macos"
115-
- restore_cache:
116-
keys:
117-
- go-cache-macos-v3-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
118-
- go-cache-macos-v3-{{ checksum "go.mod" }}
119-
- restore_cache:
120-
keys:
121-
- llvm-source-13-macos-v1
122-
- run:
123-
name: "Fetch LLVM source"
124-
command: make llvm-source
125-
- save_cache:
126-
key: llvm-source-13-macos-v1
127-
paths:
128-
- llvm-project/clang/lib/Headers
129-
- llvm-project/clang/include
130-
- llvm-project/lld/include
131-
- llvm-project/llvm/include
132-
- restore_cache:
133-
keys:
134-
- llvm-build-13-macos-v1
135-
- run:
136-
name: "Build LLVM"
137-
command: |
138-
if [ ! -f llvm-build/lib/liblldELF.a ]
139-
then
140-
# fetch LLVM source (may only have headers right now)
141-
rm -rf llvm-project
142-
make llvm-source
143-
# build!
144-
make llvm-build
145-
find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
146-
fi
147-
- save_cache:
148-
key: llvm-build-13-macos-v1
149-
paths:
150-
llvm-build
151-
- restore_cache:
152-
keys:
153-
- binaryen-macos-v1
154-
- run:
155-
name: "Build Binaryen"
156-
command: |
157-
if [ ! -f build/wasm-opt ]
158-
then
159-
make binaryen
160-
fi
161-
- save_cache:
162-
key: binaryen-macos-v1
163-
paths:
164-
- build/wasm-opt
165-
- restore_cache:
166-
keys:
167-
- wasi-libc-sysroot-macos-v4
168-
- run:
169-
name: "Build wasi-libc"
170-
command: make wasi-libc
171-
- save_cache:
172-
key: wasi-libc-sysroot-macos-v4
173-
paths:
174-
- lib/wasi-libc/sysroot
175-
- run:
176-
name: "Test TinyGo"
177-
command: make test GOTESTFLAGS="-v -short"
178-
no_output_timeout: 20m
179-
- run:
180-
name: "Build TinyGo release"
181-
command: |
182-
make release -j3
183-
cp -p build/release.tar.gz /tmp/tinygo.darwin-amd64.tar.gz
184-
- store_artifacts:
185-
path: /tmp/tinygo.darwin-amd64.tar.gz
186-
- run:
187-
name: "Extract release tarball"
188-
command: |
189-
mkdir -p ~/lib
190-
tar -C /usr/local/opt -xf /tmp/tinygo.darwin-amd64.tar.gz
191-
ln -s /usr/local/opt/tinygo/bin/tinygo /usr/local/bin/tinygo
192-
tinygo version
193-
- run: make tinygo-test
194-
- run: make smoketest AVR=0
195-
- save_cache:
196-
key: go-cache-macos-v3-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
197-
paths:
198-
- ~/.cache/go-build
199-
- /go/pkg/mod
200102

201103
jobs:
202104
test-llvm11-go115:
@@ -211,17 +113,9 @@ jobs:
211113
steps:
212114
- test-linux:
213115
llvm: "12"
214-
build-macos:
215-
macos:
216-
xcode: "11.4.1" # macOS 10.15.4
217-
steps:
218-
- build-macos
219-
220-
221116

222117
workflows:
223118
test-all:
224119
jobs:
225120
- test-llvm11-go115
226121
- test-llvm12-go116
227-
- build-macos

.github/workflows/build-macos.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: macOS
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- dev
8+
- release
9+
10+
jobs:
11+
build-macos:
12+
name: build-macos
13+
runs-on: macos-10.15
14+
steps:
15+
- name: Install Go
16+
uses: actions/setup-go@v2
17+
with:
18+
go-version: '1.17'
19+
- name: Install QEMU
20+
shell: bash
21+
run: |
22+
HOMEBREW_NO_AUTO_UPDATE=1 brew install qemu
23+
- name: Install Xtensa toolchain
24+
shell: bash
25+
run: |
26+
curl -L https://github.com/espressif/crosstool-NG/releases/download/esp-2020r2/xtensa-esp32-elf-gcc8_2_0-esp-2020r2-macos.tar.gz -o xtensa-esp32-elf-gcc8_2_0-esp-2020r2-macos.tar.gz
27+
sudo tar -C /usr/local -xf xtensa-esp32-elf-gcc8_2_0-esp-2020r2-macos.tar.gz
28+
sudo ln -s /usr/local/xtensa-esp32-elf/bin/xtensa-esp32-elf-ld /usr/local/bin/xtensa-esp32-elf-ld
29+
rm xtensa-esp32-elf-gcc8_2_0-esp-2020r2-macos.tar.gz
30+
- name: Checkout
31+
uses: actions/checkout@v2
32+
with:
33+
submodules: true
34+
- name: Cache LLVM source
35+
uses: actions/cache@v2
36+
id: cache-llvm-source
37+
with:
38+
key: llvm-source-13-macos-v1
39+
path: |
40+
llvm-project/clang/lib/Headers
41+
llvm-project/clang/include
42+
llvm-project/lld/include
43+
llvm-project/llvm/include
44+
- name: Download LLVM source
45+
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
46+
run: make llvm-source
47+
- name: Cache LLVM build
48+
uses: actions/cache@v2
49+
id: cache-llvm-build
50+
with:
51+
key: llvm-build-13-macos-v2
52+
path: llvm-build
53+
- name: Build LLVM
54+
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
55+
shell: bash
56+
run: |
57+
# fetch LLVM source
58+
rm -rf llvm-project
59+
make llvm-source
60+
# install dependencies
61+
HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake ninja
62+
# build!
63+
make llvm-build
64+
find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
65+
- name: Cache wasi-libc sysroot
66+
uses: actions/cache@v2
67+
id: cache-wasi-libc
68+
with:
69+
key: wasi-libc-sysroot-v1
70+
path: lib/wasi-libc/sysroot
71+
- name: Build wasi-libc
72+
if: steps.cache-wasi-libc.outputs.cache-hit != 'true'
73+
run: make wasi-libc
74+
- name: Cache Binaryen
75+
uses: actions/cache@v2
76+
id: cache-binaryen
77+
with:
78+
key: binaryen-macos-v1
79+
path: build/wasm-opt
80+
- name: Build Binaryen
81+
if: steps.cache-binaryen.outputs.cache-hit != 'true'
82+
run: |
83+
# install dependencies
84+
HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake ninja
85+
# build!
86+
make binaryen
87+
- name: Test TinyGo
88+
shell: bash
89+
run: make test GOTESTFLAGS="-v -short"
90+
- name: Build TinyGo release tarball
91+
run: make release -j3
92+
- name: Make release artifact
93+
shell: bash
94+
run: cp -p build/release.tar.gz build/tinygo.darwin-amd64.tar.gz
95+
- name: Publish release artifact
96+
# Note: this release artifact is double-zipped, see:
97+
# https://github.com/actions/upload-artifact/issues/39
98+
# We can essentially pick one of these:
99+
# - have a double-zipped artifact when downloaded from the UI
100+
# - have a very slow artifact upload
101+
# We're doing the former here, to keep artifact uploads fast.
102+
uses: actions/upload-artifact@v2
103+
with:
104+
name: release-double-zipped
105+
path: build/tinygo.darwin-amd64.tar.gz
106+
- name: Smoke tests
107+
shell: bash
108+
run: make smoketest TINYGO=build/tinygo AVR=0

0 commit comments

Comments
 (0)