mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-09-10 22:49:30 +00:00
0a956961c6
The macos-15-intel job was the critical path of CI at 1h21m44s. It ran gen-device, make test, make release, make tinygo-test, and make smoketest-quick one after the other. Split the work into four jobs, the same pattern as windows.yml. build-macos publishes the release tarball, stdlib-test-macos and smoke-test-macos download it, and test-macos restores the LLVM cache and runs at the same time as build-macos. The LLVM steps move to a new setup-llvm-macos composite action, with a save-cache input so that only build-macos writes the cache. Most of smoketest-quick is cross compilation, which gives the same result on every host. Add a smoketest-host target with the host dependent part plus a Cortex-M and a wasm canary, and use it on the intel runner. The arm64 runner keeps the full set. The intel runner still tests darwin/amd64 with make test, make tinygo-test, and smoketest-host.
204 lines
6.6 KiB
YAML
204 lines
6.6 KiB
YAML
name: macOS
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- dev
|
|
- release
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build-macos:
|
|
# Build the release tarball. The jobs below download it, so that they do not
|
|
# have to build the compiler again.
|
|
name: build-macos
|
|
strategy:
|
|
matrix:
|
|
# macos-14: arm64 (oldest supported version as of 18-11-2025)
|
|
# macos-15-intel: amd64 (last intel version to be supported by github runners)
|
|
# See https://github.com/actions/runner-images/issues/13046
|
|
os: [macos-14, macos-15-intel]
|
|
include:
|
|
- os: macos-14
|
|
goarch: arm64
|
|
- os: macos-15-intel
|
|
goarch: amd64
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Install Dependencies
|
|
run: |
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install qemu binaryen
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
submodules: true
|
|
- name: Extract TinyGo version
|
|
id: version
|
|
run: ./.github/workflows/tinygo-extract-version.sh | tee -a "$GITHUB_OUTPUT"
|
|
- name: Install Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: '1.27.1'
|
|
cache: true
|
|
- uses: ./.github/actions/setup-llvm-macos
|
|
with:
|
|
os: ${{ matrix.os }}
|
|
- name: make gen-device
|
|
run: make -j3 gen-device
|
|
- name: Build TinyGo release tarball
|
|
run: make release -j3
|
|
- name: Make release artifact
|
|
run: cp -p build/release.tar.gz build/tinygo${{ steps.version.outputs.version }}.darwin-${{ matrix.goarch }}.tar.gz
|
|
- name: Publish release artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: darwin-${{ matrix.goarch }}-double-zipped-${{ steps.version.outputs.version }}
|
|
path: build/tinygo${{ steps.version.outputs.version }}.darwin-${{ matrix.goarch }}.tar.gz
|
|
archive: false
|
|
|
|
test-macos:
|
|
# The compiler test suite. It needs LLVM, thus it cannot use the release
|
|
# tarball. It restores the LLVM cache and runs at the same time as
|
|
# build-macos. Only build-macos saves that cache.
|
|
name: test-macos
|
|
strategy:
|
|
matrix:
|
|
os: [macos-14, macos-15-intel]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Install Dependencies
|
|
run: |
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install qemu binaryen
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
submodules: true
|
|
- name: Install Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: '1.27.1'
|
|
cache: true
|
|
- uses: ./.github/actions/setup-llvm-macos
|
|
with:
|
|
os: ${{ matrix.os }}
|
|
save-cache: "false"
|
|
- name: make gen-device
|
|
run: make -j3 gen-device
|
|
- name: Test TinyGo
|
|
run: make test GOTESTFLAGS="-only-current-os"
|
|
|
|
stdlib-test-macos:
|
|
# Test the standard library, compiled and run on the host itself.
|
|
name: stdlib-test-macos
|
|
needs: build-macos
|
|
strategy:
|
|
matrix:
|
|
os: [macos-14, macos-15-intel]
|
|
include:
|
|
- os: macos-14
|
|
goarch: arm64
|
|
- os: macos-15-intel
|
|
goarch: amd64
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
- name: Extract TinyGo version
|
|
id: version
|
|
run: ./.github/workflows/tinygo-extract-version.sh | tee -a "$GITHUB_OUTPUT"
|
|
- name: Install Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: '1.27.1'
|
|
cache: true
|
|
- name: Download TinyGo build
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: darwin-${{ matrix.goarch }}-double-zipped-${{ steps.version.outputs.version }}
|
|
path: build/
|
|
- name: Unpack TinyGo build
|
|
run: tar -xzf build/tinygo${{ steps.version.outputs.version }}.darwin-${{ matrix.goarch }}.tar.gz -C build
|
|
- name: Test stdlib packages
|
|
run: make tinygo-test TINYGO=$(PWD)/build/tinygo/bin/tinygo
|
|
|
|
smoke-test-macos:
|
|
# Cross compilation gives the same result on every host. Thus only one macOS
|
|
# runner does the full set, and the other one does the host dependent part
|
|
# plus a canary. See the smoketest-linux comment in linux.yml.
|
|
name: smoke-test-macos
|
|
needs: build-macos
|
|
strategy:
|
|
matrix:
|
|
os: [macos-14, macos-15-intel]
|
|
include:
|
|
- os: macos-14
|
|
goarch: arm64
|
|
smoketest: smoketest-quick
|
|
- os: macos-15-intel
|
|
goarch: amd64
|
|
smoketest: smoketest-host
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Install Dependencies
|
|
run: |
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install binaryen
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
- name: Extract TinyGo version
|
|
id: version
|
|
run: ./.github/workflows/tinygo-extract-version.sh | tee -a "$GITHUB_OUTPUT"
|
|
- name: Install Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: '1.27.1'
|
|
cache: true
|
|
- name: Download TinyGo build
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: darwin-${{ matrix.goarch }}-double-zipped-${{ steps.version.outputs.version }}
|
|
path: build/
|
|
- name: Unpack TinyGo build
|
|
run: tar -xzf build/tinygo${{ steps.version.outputs.version }}.darwin-${{ matrix.goarch }}.tar.gz -C build
|
|
- name: Smoke tests
|
|
run: make ${{ matrix.smoketest }} TINYGO=$(PWD)/build/tinygo/bin/tinygo
|
|
|
|
test-macos-homebrew:
|
|
name: homebrew-install
|
|
runs-on: macos-latest
|
|
strategy:
|
|
matrix:
|
|
version: [16, 17, 18, 19, 20]
|
|
steps:
|
|
- name: Set up Homebrew
|
|
uses: Homebrew/actions/setup-homebrew@main
|
|
- name: Fix Python symlinks
|
|
run: |
|
|
# Github runners have broken symlinks, so relink
|
|
# see: https://github.com/actions/setup-python/issues/577
|
|
brew list -1 | grep python | while read formula; do brew unlink $formula; brew link --overwrite $formula; done
|
|
- name: Install LLVM
|
|
run: |
|
|
brew install llvm@${{ matrix.version }}
|
|
brew link llvm@${{ matrix.version }}
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
- name: Install Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: '1.27.1'
|
|
cache: true
|
|
- name: Build TinyGo (LLVM ${{ matrix.version }})
|
|
run: go install -tags=llvm${{ matrix.version }}
|
|
- name: Check binary
|
|
run: tinygo version
|
|
- name: Build TinyGo (default LLVM)
|
|
if: matrix.version == 20
|
|
run: go install
|
|
- name: Check binary
|
|
if: matrix.version == 20
|
|
run: tinygo version
|