|
| 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