mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-09-11 06:59:31 +00:00
d88abc2320
upload-artifact gives an artifact uploaded with "archive: false" the name of the file, not the name in the "name" input. Download the tarball by its file name, and find it on disk instead of assuming where it lands.
218 lines
7.2 KiB
YAML
218 lines
7.2 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:
|
|
# An artifact uploaded with "archive: false" takes the name of the
|
|
# file, not the name given to upload-artifact. See the comment on
|
|
# "Collect the release files" in release.yml.
|
|
name: tinygo${{ steps.version.outputs.version }}.darwin-${{ matrix.goarch }}.tar.gz
|
|
path: build/
|
|
skip-decompress: true
|
|
- name: Unpack TinyGo build
|
|
run: |
|
|
tarball=$(find build -type f -name 'tinygo*.darwin-*.tar.gz' | head -1)
|
|
test -n "$tarball"
|
|
tar -xzf "$tarball" -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:
|
|
# An artifact uploaded with "archive: false" takes the name of the
|
|
# file, not the name given to upload-artifact. See the comment on
|
|
# "Collect the release files" in release.yml.
|
|
name: tinygo${{ steps.version.outputs.version }}.darwin-${{ matrix.goarch }}.tar.gz
|
|
path: build/
|
|
skip-decompress: true
|
|
- name: Unpack TinyGo build
|
|
run: |
|
|
tarball=$(find build -type f -name 'tinygo*.darwin-*.tar.gz' | head -1)
|
|
test -n "$tarball"
|
|
tar -xzf "$tarball" -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
|