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 http://apt.llvm.org/stretch/ llvm-toolchain-stretch<> 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 \ python3 \ llvm<>-dev \ clang<> \ libclang<>-dev \ lld<> \ 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 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 dep: steps: - run: name: "Install Go dependencies" command: | curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh dep ensure --vendor-only smoketest: steps: - smoketest-no-avr - run: tinygo build -size short -o test.elf -target=arduino examples/blinky1 - run: tinygo build -size short -o test.elf -target=digispark examples/blinky1 smoketest-no-avr: steps: - run: tinygo build -size short -o test.elf -target=pca10040 examples/blinky1 - run: tinygo build -size short -o test.elf -target=pca10040 examples/blinky2 - run: tinygo build -o blinky2 examples/blinky2 # TODO: re-enable -size flag with MachO support - run: tinygo build -size short -o test.elf -target=pca10040 examples/test - run: tinygo build -size short -o test.elf -target=microbit examples/echo - run: tinygo build -size short -o test.elf -target=nrf52840-mdk examples/blinky1 - run: tinygo build -size short -o test.elf -target=pca10031 examples/blinky1 - run: tinygo build -size short -o test.elf -target=bluepill examples/blinky1 - run: tinygo build -size short -o test.elf -target=reelboard examples/blinky1 - run: tinygo build -size short -o test.elf -target=reelboard examples/blinky2 - run: tinygo build -size short -o test.elf -target=pca10056 examples/blinky1 - run: tinygo build -size short -o test.elf -target=pca10056 examples/blinky2 - run: tinygo build -size short -o test.elf -target=itsybitsy-m0 examples/blinky1 - run: tinygo build -size short -o test.elf -target=circuitplay-express examples/blinky1 - run: tinygo build -size short -o test.elf -target=stm32f4disco examples/blinky1 - run: tinygo build -size short -o test.elf -target=stm32f4disco examples/blinky2 - run: tinygo build -o wasm.wasm -target=wasm examples/wasm test-linux: parameters: llvm: type: string steps: - checkout - submodules - apt-dependencies: llvm: <> - install-node - restore_cache: keys: - go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }} - go-cache-{{ checksum "Gopkg.lock" }} - dep - run: go install . - run: go test -v - run: make gen-device -j4 - smoketest - save_cache: key: go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_BUILD_NUM }} paths: - ~/.cache/go-build - ~/.cache/tinygo - run: make fmt-check build-linux: steps: - checkout - submodules - run: name: "Install apt dependencies" command: | sudo apt-get install \ libtinfo-dev \ python3 \ gcc-arm-linux-gnueabihf \ binutils-arm-none-eabi \ libc6-dev-armel-cross \ gcc-aarch64-linux-gnu \ libc6-dev-arm64-cross \ qemu-system-arm \ qemu-user \ gcc-avr \ avr-libc - install-node - restore_cache: keys: - go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }} - go-cache-{{ checksum "Gopkg.lock" }} - restore_cache: keys: - llvm-source-8-v2 - run: name: "Fetch LLVM source" command: make llvm-source - save_cache: key: llvm-source-8-v2 paths: - llvm - restore_cache: keys: - llvm-build-8-v2 - 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-8-v2 paths: llvm-build - run: name: "Create LLVM symlinks" command: | ln -s $PWD/llvm-build/bin/clang-8 /go/bin/clang-8 ln -s $PWD/llvm-build/bin/ld.lld /go/bin/ld.lld-8 ln -s $PWD/llvm-build/bin/wasm-ld /go/bin/wasm-ld-8 - dep - run: name: "Test TinyGo" command: make test - run: name: "Build TinyGo release" command: | make release -j3 cp -p build/release.tar.gz /tmp/tinygo.linux-amd64.tar.gz - store_artifacts: path: /tmp/tinygo.linux-amd64.tar.gz - save_cache: key: go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_BUILD_NUM }} paths: - ~/.cache/go-build - ~/.cache/tinygo - 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 - smoketest build-macos: steps: - checkout - submodules - run: name: "Install dependencies" command: | HOMEBREW_NO_AUTO_UPDATE=1 brew install go dep qemu - restore_cache: keys: - llvm-source-8-macos-v2 - run: name: "Fetch LLVM source" command: make llvm-source - save_cache: key: llvm-source-8-macos-v2 paths: - llvm - restore_cache: keys: - llvm-build-8-macos-v2 - 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-8-macos-v2 paths: llvm-build - run: name: "Create LLVM symlinks" command: | ln -s $PWD/llvm-build/bin/clang-8 /usr/local/bin/clang-8 - run: name: "Install Go dependencies" command: dep ensure --vendor-only - 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 - smoketest-no-avr jobs: test-llvm8-go111: docker: - image: circleci/golang:1.11 working_directory: /go/src/github.com/tinygo-org/tinygo steps: - test-linux: llvm: "-8" test-llvm8-go112: docker: - image: circleci/golang:1.12 working_directory: /go/src/github.com/tinygo-org/tinygo steps: - test-linux: llvm: "-8" build-linux: docker: - image: circleci/golang:1.12 working_directory: /go/src/github.com/tinygo-org/tinygo steps: - build-linux build-macos: macos: xcode: "10.1.0" working_directory: ~/go/src/github.com/tinygo-org/tinygo steps: - build-macos workflows: test-all: jobs: - test-llvm8-go111 - test-llvm8-go112 - build-linux - build-macos