mirror of https://github.com/tinygo-org/tinygo.git
wasmstm32webassemblymicrocontrollerarmavrspiwasiadafruitarduinocircuitplayground-expressgpioi2cllvmmicrobitnrf51nrf52nrf52840samd21tinygo
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
476 lines
15 KiB
476 lines
15 KiB
version: 2.1
|
|
|
|
commands:
|
|
submodules:
|
|
steps:
|
|
- run:
|
|
name: "Pull submodules"
|
|
command: git submodule update --init
|
|
apt-dependencies:
|
|
parameters:
|
|
llvm:
|
|
type: string
|
|
steps:
|
|
- run:
|
|
name: "Install apt dependencies"
|
|
command: |
|
|
echo 'deb https://apt.llvm.org/buster/ llvm-toolchain-buster-<<parameters.llvm>> main' | sudo tee /etc/apt/sources.list.d/llvm.list
|
|
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
|
|
sudo apt-get update
|
|
sudo apt-get install \
|
|
llvm-<<parameters.llvm>>-dev \
|
|
clang-<<parameters.llvm>> \
|
|
libclang-<<parameters.llvm>>-dev \
|
|
lld-<<parameters.llvm>> \
|
|
gcc-arm-linux-gnueabihf \
|
|
gcc-aarch64-linux-gnu \
|
|
qemu-system-arm \
|
|
qemu-user \
|
|
gcc-avr \
|
|
avr-libc
|
|
sudo apt-get install --no-install-recommends libc6-dev-i386 lib32gcc-8-dev
|
|
install-node:
|
|
steps:
|
|
- run:
|
|
name: "Install node.js"
|
|
command: |
|
|
wget https://nodejs.org/dist/v10.15.1/node-v10.15.1-linux-x64.tar.xz
|
|
sudo tar -C /usr/local -xf node-v10.15.1-linux-x64.tar.xz
|
|
sudo ln -s /usr/local/node-v10.15.1-linux-x64/bin/node /usr/bin/node
|
|
rm node-v10.15.1-linux-x64.tar.xz
|
|
install-chrome:
|
|
steps:
|
|
- run:
|
|
name: "Install Chrome"
|
|
command: |
|
|
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
sudo apt install ./google-chrome-stable_current_amd64.deb
|
|
install-wasmtime:
|
|
steps:
|
|
- run:
|
|
name: "Install wasmtime"
|
|
command: |
|
|
curl https://wasmtime.dev/install.sh -sSf | bash
|
|
sudo ln -s ~/.wasmtime/bin/wasmtime /usr/local/bin/wasmtime
|
|
install-xtensa-toolchain:
|
|
parameters:
|
|
variant:
|
|
type: string
|
|
steps:
|
|
- run:
|
|
name: "Install Xtensa toolchain"
|
|
command: |
|
|
curl -L https://github.com/espressif/crosstool-NG/releases/download/esp-2020r2/xtensa-esp32-elf-gcc8_2_0-esp-2020r2-<<parameters.variant>>.tar.gz -o xtensa-esp32-elf-gcc8_2_0-esp-2020r2-<<parameters.variant>>.tar.gz
|
|
sudo tar -C /usr/local -xf xtensa-esp32-elf-gcc8_2_0-esp-2020r2-<<parameters.variant>>.tar.gz
|
|
sudo ln -s /usr/local/xtensa-esp32-elf/bin/xtensa-esp32-elf-ld /usr/local/bin/xtensa-esp32-elf-ld
|
|
rm xtensa-esp32-elf-gcc8_2_0-esp-2020r2-<<parameters.variant>>.tar.gz
|
|
llvm-source-linux:
|
|
steps:
|
|
- restore_cache:
|
|
keys:
|
|
- llvm-source-10-v1
|
|
- run:
|
|
name: "Fetch LLVM source"
|
|
command: make llvm-source
|
|
- save_cache:
|
|
key: llvm-source-10-v1
|
|
paths:
|
|
- llvm-project
|
|
build-wasi-libc:
|
|
steps:
|
|
- restore_cache:
|
|
keys:
|
|
- wasi-libc-sysroot-v3
|
|
- run:
|
|
name: "Build wasi-libc"
|
|
command: make wasi-libc
|
|
- save_cache:
|
|
key: wasi-libc-sysroot-v3
|
|
paths:
|
|
- lib/wasi-libc/sysroot
|
|
test-linux:
|
|
parameters:
|
|
llvm:
|
|
type: string
|
|
steps:
|
|
- checkout
|
|
- submodules
|
|
- apt-dependencies:
|
|
llvm: "<<parameters.llvm>>"
|
|
- install-node
|
|
- install-chrome
|
|
- install-wasmtime
|
|
- restore_cache:
|
|
keys:
|
|
- go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
|
|
- go-cache-v2-{{ checksum "go.mod" }}
|
|
- llvm-source-linux
|
|
- run: go install -tags=llvm<<parameters.llvm>> .
|
|
- restore_cache:
|
|
keys:
|
|
- wasi-libc-sysroot-systemclang-v2
|
|
- run: make wasi-libc
|
|
- save_cache:
|
|
key: wasi-libc-sysroot-systemclang-v2
|
|
paths:
|
|
- lib/wasi-libc/sysroot
|
|
- run: go test -v -tags=llvm<<parameters.llvm>> ./cgo ./compileopts ./interp ./transform .
|
|
- run: make gen-device -j4
|
|
- run: make smoketest XTENSA=0
|
|
- run: make tinygo-test
|
|
- run: make wasmtest
|
|
- save_cache:
|
|
key: go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
|
|
paths:
|
|
- ~/.cache/go-build
|
|
- /go/pkg/mod
|
|
- run: make fmt-check
|
|
assert-test-linux:
|
|
steps:
|
|
- checkout
|
|
- submodules
|
|
- run:
|
|
name: "Install apt dependencies"
|
|
command: |
|
|
sudo apt-get install \
|
|
gcc-arm-linux-gnueabihf \
|
|
libc6-dev-armel-cross \
|
|
gcc-aarch64-linux-gnu \
|
|
libc6-dev-arm64-cross \
|
|
qemu-system-arm \
|
|
qemu-user \
|
|
gcc-avr \
|
|
avr-libc
|
|
sudo apt-get install --no-install-recommends libc6-dev-i386 lib32gcc-6-dev
|
|
- install-node
|
|
- install-wasmtime
|
|
- install-xtensa-toolchain:
|
|
variant: "linux-amd64"
|
|
- restore_cache:
|
|
keys:
|
|
- go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
|
|
- go-cache-v2-{{ checksum "go.mod" }}
|
|
- llvm-source-linux
|
|
- restore_cache:
|
|
keys:
|
|
- llvm-build-10-linux-v1-assert
|
|
- run:
|
|
name: "Build LLVM"
|
|
command: |
|
|
if [ ! -f llvm-build/lib/liblldELF.a ]
|
|
then
|
|
# install dependencies
|
|
sudo apt-get install cmake clang ninja-build
|
|
# make build faster
|
|
export CC=clang
|
|
export CXX=clang++
|
|
# hack ninja to use less jobs
|
|
echo -e '#!/bin/sh\n/usr/bin/ninja -j3 "$@"' > /go/bin/ninja
|
|
chmod +x /go/bin/ninja
|
|
# build!
|
|
make ASSERT=1 llvm-build
|
|
fi
|
|
- save_cache:
|
|
key: llvm-build-10-linux-v1-assert
|
|
paths:
|
|
llvm-build
|
|
- run: make ASSERT=1
|
|
- build-wasi-libc
|
|
- run:
|
|
name: "Test TinyGo"
|
|
command: make ASSERT=1 test
|
|
- save_cache:
|
|
key: go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
|
|
paths:
|
|
- ~/.cache/go-build
|
|
- /go/pkg/mod
|
|
- run: make gen-device -j4
|
|
- run: make smoketest TINYGO=build/tinygo
|
|
build-linux:
|
|
steps:
|
|
- checkout
|
|
- submodules
|
|
- run:
|
|
name: "Install apt dependencies"
|
|
command: |
|
|
sudo apt-get install \
|
|
gcc-arm-linux-gnueabihf \
|
|
libc6-dev-armel-cross \
|
|
gcc-aarch64-linux-gnu \
|
|
libc6-dev-arm64-cross \
|
|
qemu-system-arm \
|
|
qemu-user \
|
|
gcc-avr \
|
|
avr-libc
|
|
sudo apt-get install --no-install-recommends libc6-dev-i386 lib32gcc-6-dev
|
|
- install-node
|
|
- install-wasmtime
|
|
- install-xtensa-toolchain:
|
|
variant: "linux-amd64"
|
|
- restore_cache:
|
|
keys:
|
|
- go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
|
|
- go-cache-v2-{{ checksum "go.mod" }}
|
|
- llvm-source-linux
|
|
- restore_cache:
|
|
keys:
|
|
- llvm-build-10-linux-v1
|
|
- run:
|
|
name: "Build LLVM"
|
|
command: |
|
|
if [ ! -f llvm-build/lib/liblldELF.a ]
|
|
then
|
|
# install dependencies
|
|
sudo apt-get install cmake clang ninja-build
|
|
# make build faster
|
|
export CC=clang
|
|
export CXX=clang++
|
|
# hack ninja to use less jobs
|
|
echo -e '#!/bin/sh\n/usr/bin/ninja -j3 "$@"' > /go/bin/ninja
|
|
chmod +x /go/bin/ninja
|
|
# build!
|
|
make llvm-build
|
|
fi
|
|
- save_cache:
|
|
key: llvm-build-10-linux-v1
|
|
paths:
|
|
llvm-build
|
|
- build-wasi-libc
|
|
- run:
|
|
name: "Test TinyGo"
|
|
command: make test
|
|
- run:
|
|
name: "Install fpm"
|
|
command: |
|
|
sudo apt-get install ruby ruby-dev
|
|
sudo gem install --no-document fpm
|
|
- run:
|
|
name: "Build TinyGo release"
|
|
command: |
|
|
make release deb -j3
|
|
cp -p build/release.tar.gz /tmp/tinygo.linux-amd64.tar.gz
|
|
cp -p build/release.deb /tmp/tinygo_amd64.deb
|
|
- store_artifacts:
|
|
path: /tmp/tinygo.linux-amd64.tar.gz
|
|
- store_artifacts:
|
|
path: /tmp/tinygo_amd64.deb
|
|
- save_cache:
|
|
key: go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
|
|
paths:
|
|
- ~/.cache/go-build
|
|
- /go/pkg/mod
|
|
- run:
|
|
name: "Extract release tarball"
|
|
command: |
|
|
mkdir -p ~/lib
|
|
tar -C ~/lib -xf /tmp/tinygo.linux-amd64.tar.gz
|
|
ln -s ~/lib/tinygo/bin/tinygo /go/bin/tinygo
|
|
tinygo version
|
|
- run: make smoketest
|
|
build-macos:
|
|
steps:
|
|
- checkout
|
|
- submodules
|
|
- run:
|
|
name: "Install dependencies"
|
|
command: |
|
|
curl https://dl.google.com/go/go1.14.darwin-amd64.tar.gz -o go1.14.darwin-amd64.tar.gz
|
|
sudo tar -C /usr/local -xzf go1.14.darwin-amd64.tar.gz
|
|
ln -s /usr/local/go/bin/go /usr/local/bin/go
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install qemu
|
|
- install-xtensa-toolchain:
|
|
variant: "macos"
|
|
- restore_cache:
|
|
keys:
|
|
- go-cache-macos-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
|
|
- go-cache-macos-v2-{{ checksum "go.mod" }}
|
|
- restore_cache:
|
|
keys:
|
|
- llvm-source-10-macos-v1
|
|
- run:
|
|
name: "Fetch LLVM source"
|
|
command: make llvm-source
|
|
- save_cache:
|
|
key: llvm-source-10-macos-v1
|
|
paths:
|
|
- llvm-project
|
|
- restore_cache:
|
|
keys:
|
|
- llvm-build-10-macos-v1
|
|
- run:
|
|
name: "Build LLVM"
|
|
command: |
|
|
if [ ! -f llvm-build/lib/liblldELF.a ]
|
|
then
|
|
# install dependencies
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake ninja
|
|
# build!
|
|
make llvm-build
|
|
fi
|
|
- save_cache:
|
|
key: llvm-build-10-macos-v1
|
|
paths:
|
|
llvm-build
|
|
- restore_cache:
|
|
keys:
|
|
- wasi-libc-sysroot-macos-v2
|
|
- run:
|
|
name: "Build wasi-libc"
|
|
command: make wasi-libc
|
|
- save_cache:
|
|
key: wasi-libc-sysroot-macos-v2
|
|
paths:
|
|
- lib/wasi-libc/sysroot
|
|
- run:
|
|
name: "Test TinyGo"
|
|
command: make test
|
|
- run:
|
|
name: "Build TinyGo release"
|
|
command: |
|
|
make release -j3
|
|
cp -p build/release.tar.gz /tmp/tinygo.darwin-amd64.tar.gz
|
|
- store_artifacts:
|
|
path: /tmp/tinygo.darwin-amd64.tar.gz
|
|
- run:
|
|
name: "Extract release tarball"
|
|
command: |
|
|
mkdir -p ~/lib
|
|
tar -C /usr/local/opt -xf /tmp/tinygo.darwin-amd64.tar.gz
|
|
ln -s /usr/local/opt/tinygo/bin/tinygo /usr/local/bin/tinygo
|
|
tinygo version
|
|
- run: make smoketest AVR=0
|
|
- save_cache:
|
|
key: go-cache-macos-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
|
|
paths:
|
|
- ~/.cache/go-build
|
|
- /go/pkg/mod
|
|
arch-release:
|
|
steps:
|
|
- run:
|
|
name: Install dependencies
|
|
command: pacman -Sy --noconfirm openssh git pacman-contrib binutils
|
|
- run:
|
|
name: Create TinyGo user
|
|
command: useradd -m tinygo
|
|
- run:
|
|
name: Start SSH Agent
|
|
user: tinygo
|
|
command: eval $(ssh-agent -s)
|
|
- run:
|
|
name: Add ARCH_RELEASE_SSH_PRIVATE_KEY identity
|
|
user: tinygo
|
|
command: echo "${ARCH_RELEASE_SSH_PRIVATE_KEY}" | tr -d '\r' | ssh-add -
|
|
- run:
|
|
name: Create SSH directory
|
|
user: tinygo
|
|
command: mkdir -p ~/.ssh && chmod 700 ~/.ssh
|
|
- run:
|
|
name: Add aur.archlinux.org to known hosts
|
|
user: tinygo
|
|
command: ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
|
|
- run:
|
|
name: Clone tinygo-bin repo
|
|
user: tinygo
|
|
command: git clone ssh://aur@aur.archlinux.org/tinygo-bin.git ~/tinygo-bin
|
|
- run:
|
|
name: Update package version
|
|
user: tinygo
|
|
command: sed -i -E "s/(pkgver=)(.*)$/\1${CIRCLE_TAG}/" ~/tinygo-bin/PKGBUILD
|
|
- run:
|
|
name: Update file checksums
|
|
user: tinygo
|
|
command: cd ~/tinygo-bin && updpkgsums
|
|
- run:
|
|
name: Update .SRCINFO
|
|
user: tinygo
|
|
command: cd ~/tinygo-bin && makepkg --printsrcinfo > .SRCINFO
|
|
# Commit the update
|
|
- run:
|
|
name: Set git commit config
|
|
user: tinygo
|
|
command: |
|
|
git config --global user.email "tinygo-bot@tinygo.org" &&
|
|
git config --global user.name "TinyGo Release Bot"
|
|
- run:
|
|
name: Commit and push changes
|
|
user: tinygo
|
|
command: |
|
|
cd ~/tinygo-bin &&
|
|
git commit -a -m "Update tinygo-bin to v${CIRCLE_TAG}" &&
|
|
git push origin master
|
|
|
|
jobs:
|
|
test-llvm9-go111:
|
|
docker:
|
|
- image: circleci/golang:1.11-buster
|
|
steps:
|
|
- test-linux:
|
|
llvm: "9"
|
|
test-llvm10-go112:
|
|
docker:
|
|
- image: circleci/golang:1.12-buster
|
|
steps:
|
|
- test-linux:
|
|
llvm: "10"
|
|
test-llvm10-go113:
|
|
docker:
|
|
- image: circleci/golang:1.13-buster
|
|
steps:
|
|
- test-linux:
|
|
llvm: "10"
|
|
test-llvm10-go114:
|
|
docker:
|
|
- image: circleci/golang:1.14-buster
|
|
steps:
|
|
- test-linux:
|
|
llvm: "10"
|
|
test-llvm11-go115:
|
|
docker:
|
|
- image: circleci/golang:1.15.2-buster
|
|
steps:
|
|
- test-linux:
|
|
llvm: "11"
|
|
assert-test-linux:
|
|
docker:
|
|
- image: circleci/golang:1.14-stretch
|
|
steps:
|
|
- assert-test-linux
|
|
build-linux:
|
|
docker:
|
|
- image: circleci/golang:1.14-stretch
|
|
steps:
|
|
- build-linux
|
|
build-macos:
|
|
macos:
|
|
xcode: "10.1.0"
|
|
steps:
|
|
- build-macos
|
|
arch-release:
|
|
docker:
|
|
- image: archlinux:latest
|
|
steps:
|
|
- arch-release
|
|
|
|
|
|
|
|
|
|
workflows:
|
|
test-all:
|
|
jobs:
|
|
- test-llvm9-go111
|
|
- test-llvm10-go112
|
|
- test-llvm10-go113
|
|
- test-llvm10-go114
|
|
- test-llvm11-go115
|
|
- build-linux
|
|
- build-macos
|
|
- assert-test-linux
|
|
release:
|
|
jobs:
|
|
- arch-release:
|
|
filters:
|
|
branches:
|
|
ignore: /.*/
|
|
tags:
|
|
# Runs on every semver release
|
|
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
|
|
|