Browse Source

ci: move Linux release builds to GitHub Actions

pull/2295/head
Ayke van Laethem 3 years ago
committed by Ron Evans
parent
commit
18f4ffd656
  1. 133
      .circleci/config.yml
  2. 124
      .github/workflows/linux.yml

133
.circleci/config.yml

@ -6,13 +6,6 @@ commands:
- run: - run:
name: "Pull submodules" name: "Pull submodules"
command: git submodule update --init command: git submodule update --init
install-cmake:
steps:
- run:
name: "Install CMake"
command: |
wget https://github.com/Kitware/CMake/releases/download/v3.21.4/cmake-3.21.4-linux-x86_64.tar.gz
sudo tar --strip-components=1 -C /usr/local -xf cmake-3.21.4-linux-x86_64.tar.gz
install-xtensa-toolchain: install-xtensa-toolchain:
parameters: parameters:
variant: variant:
@ -60,31 +53,6 @@ commands:
key: binaryen-linux-v1 key: binaryen-linux-v1
paths: paths:
- build/wasm-opt - build/wasm-opt
build-binaryen-linux-stretch:
steps:
- restore_cache:
keys:
- binaryen-linux-stretch-v1
- run:
name: "Build Binaryen"
command: |
CC=$PWD/llvm-build/bin/clang make binaryen
- save_cache:
key: binaryen-linux-stretch-v1
paths:
- build/wasm-opt
build-wasi-libc:
steps:
- restore_cache:
keys:
- wasi-libc-sysroot-v4
- run:
name: "Build wasi-libc"
command: make wasi-libc
- save_cache:
key: wasi-libc-sysroot-v4
paths:
- lib/wasi-libc/sysroot
test-linux: test-linux:
parameters: parameters:
llvm: llvm:
@ -131,93 +99,6 @@ commands:
- ~/.cache/go-build - ~/.cache/go-build
- /go/pkg/mod - /go/pkg/mod
- run: make fmt-check - run: make fmt-check
build-linux:
steps:
- checkout
- submodules
- run:
name: "Install apt dependencies"
command: |
sudo apt-get update
sudo apt-get install --no-install-recommends \
libgnutls30 libssl1.0.2 \
ninja-build \
python3
- install-cmake
- hack-ninja-jobs
- 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-11-linux-v4-noassert
- run:
name: "Build LLVM"
command: |
if [ ! -f llvm-build/lib/liblldELF.a ]
then
# fetch LLVM source (may only have headers right now)
rm -rf llvm-project
make llvm-source
# build!
make llvm-build
find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
fi
- save_cache:
key: llvm-build-11-linux-v4-noassert
paths:
llvm-build
- build-binaryen-linux-stretch
- build-wasi-libc
- 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
- persist_to_workspace:
root: /tmp
paths:
- tinygo.linux-amd64.tar.gz
- 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
test-linux-build:
# Now run the smoke tests for the generated binary.
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- run:
name: "Install apt dependencies"
command: |
sudo apt-get update
sudo apt-get install --no-install-recommends \
gcc-avr \
avr-libc
- install-xtensa-toolchain:
variant: "linux-amd64"
- run:
name: "Extract release tarball"
command: |
mkdir -p ~/lib
tar -C ~/lib -xf /tmp/workspace/tinygo.linux-amd64.tar.gz
ln -s ~/lib/tinygo/bin/tinygo ~/go/bin/tinygo
tinygo version
- run: make smoketest
build-macos: build-macos:
steps: steps:
- checkout - checkout
@ -330,16 +211,6 @@ jobs:
steps: steps:
- test-linux: - test-linux:
llvm: "11" llvm: "11"
build-linux:
docker:
- image: circleci/golang:1.17-stretch
steps:
- build-linux
test-linux-build:
docker:
- image: cimg/go:1.17
steps:
- test-linux-build
build-macos: build-macos:
macos: macos:
xcode: "11.1.0" # macOS 10.14 xcode: "11.1.0" # macOS 10.14
@ -353,8 +224,4 @@ workflows:
jobs: jobs:
- test-llvm11-go115 - test-llvm11-go115
- test-llvm11-go116 - test-llvm11-go116
- build-linux
- test-linux-build:
requires:
- build-linux
- build-macos - build-macos

124
.github/workflows/linux.yml

@ -8,7 +8,130 @@ on:
- release - release
jobs: jobs:
build-linux:
# Build Linux binaries, ready for release.
# This intentionally uses an older Linux image, so that we compile against
# an older glibc version and therefore are compatible with a wide range of
# Linux distributions.
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Install apt dependencies
run: |
sudo apt-get install --no-install-recommends \
ninja-build
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: Cache Go
uses: actions/cache@v2
with:
key: go-cache-linux-v1-${{ hashFiles('go.mod') }}
path: |
~/.cache/go-build
~/go/pkg/mod
- name: Cache LLVM source
uses: actions/cache@v2
id: cache-llvm-source
with:
key: llvm-source-11-linux-v1
path: |
llvm-project/clang/lib/Headers
llvm-project/clang/include
llvm-project/lld/include
llvm-project/llvm/include
- name: Download LLVM source
if: steps.cache-llvm-source.outputs.cache-hit != 'true'
run: make llvm-source
- name: Cache LLVM build
uses: actions/cache@v2
id: cache-llvm-build
with:
key: llvm-build-11-linux-v1
path: llvm-build
- name: Build LLVM
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
run: |
# fetch LLVM source
rm -rf llvm-project
make llvm-source
# build!
make llvm-build
# Remove unnecessary object files (to reduce cache size).
find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
- name: Cache Binaryen
uses: actions/cache@v2
id: cache-binaryen
with:
key: binaryen-linux-v1
path: build/wasm-opt
- name: Build Binaryen
if: steps.cache-binaryen.outputs.cache-hit != 'true'
run: make binaryen
- name: Cache wasi-libc
uses: actions/cache@v2
id: cache-wasi-libc
with:
key: wasi-libc-sysroot-linux-asserts-v2
path: lib/wasi-libc/sysroot
- name: Build wasi-libc
if: steps.cache-wasi-libc.outputs.cache-hit != 'true'
run: make wasi-libc
- name: Install fpm
run: |
sudo apt-get install ruby ruby-dev
sudo gem install --no-document fpm
- name: Build TinyGo release
run: |
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
- name: Publish release artifact
uses: actions/upload-artifact@v2
with:
name: release-double-zipped
path: |
/tmp/tinygo.linux-amd64.tar.gz
/tmp/tinygo_amd64.deb
test-linux-build:
# Test the binaries built in the build-linux job by running the smoke tests.
runs-on: ubuntu-latest
needs: build-linux
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: Download release artifact
uses: actions/download-artifact@v2
with:
name: release-double-zipped
- name: Extract release tarball
run: |
mkdir -p ~/lib
tar -C ~/lib -xf tinygo.linux-amd64.tar.gz
ln -s ~/lib/tinygo/bin/tinygo ~/go/bin/tinygo
- name: Install apt dependencies
run: |
sudo apt-get install --no-install-recommends \
gcc-avr \
avr-libc
- name: "Install Xtensa toolchain"
run: |
curl -L https://github.com/espressif/crosstool-NG/releases/download/esp-2020r2/xtensa-esp32-elf-gcc8_2_0-esp-2020r2-linux-amd64.tar.gz -o xtensa-esp32-elf-gcc8_2_0-esp-2020r2-linux-amd64.tar.gz
sudo tar -C /usr/local -xf xtensa-esp32-elf-gcc8_2_0-esp-2020r2-linux-amd64.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-linux-amd64.tar.gz
- run: make smoketest
assert-test-linux: assert-test-linux:
# Run all tests that can run on Linux, with LLVM assertions enabled to catch
# potential bugs.
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@ -64,7 +187,6 @@ jobs:
path: llvm-build path: llvm-build
- name: Build LLVM - name: Build LLVM
if: steps.cache-llvm-build.outputs.cache-hit != 'true' if: steps.cache-llvm-build.outputs.cache-hit != 'true'
shell: bash
run: | run: |
# fetch LLVM source # fetch LLVM source
rm -rf llvm-project rm -rf llvm-project

Loading…
Cancel
Save