diff --git a/.circleci/config.yml b/.circleci/config.yml index fa7187cc..1e328c09 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,29 +6,6 @@ commands: - run: name: "Pull submodules" command: git submodule update --init - 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-cmake: steps: - run: @@ -154,78 +131,6 @@ commands: - ~/.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 update - sudo apt-get install --no-install-recommends \ - qemu-system-arm \ - qemu-system-riscv32 \ - qemu-user \ - gcc-avr \ - avr-libc \ - ninja-build \ - python3 - - install-node - - install-wasmtime - - 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-assert - - 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 ASSERT=1 llvm-build - find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \; - fi - - save_cache: - key: llvm-build-11-linux-v4-assert - paths: - llvm-build - - build-binaryen-linux - - build-wasi-libc - - run: - name: "Test TinyGo" - command: make ASSERT=1 test - no_output_timeout: 20m - environment: - # Note: -p=2 limits parallelism to two jobs at a time, which is - # necessary to keep memory consumption down and avoid OOM (for a - # 2CPU/4GB executor). - GOFLAGS: -p=2 - - run: - name: "Build TinyGo" - command: | - make ASSERT=1 - echo 'export PATH=$(pwd)/build:$PATH' >> $BASH_ENV - - run: make tinygo-test - - save_cache: - key: go-cache-v2-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_BUILD_NUM }} - paths: - - ~/.cache/go-build - - /go/pkg/mod - - install-xtensa-toolchain: - variant: "linux-amd64" - - run: make gen-device -j4 - - run: make smoketest - - install-chrome - - run: make wasmtest build-linux: steps: - checkout @@ -425,11 +330,6 @@ jobs: steps: - test-linux: llvm: "11" - assert-test-linux: - docker: - - image: circleci/golang:1.17-buster - steps: - - assert-test-linux build-linux: docker: - image: circleci/golang:1.17-stretch @@ -458,4 +358,3 @@ workflows: requires: - build-linux - build-macos - - assert-test-linux diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 00000000..270cd0ee --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,110 @@ +name: Linux + +on: + pull_request: + push: + branches: + - dev + - release + +jobs: + assert-test-linux: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true + - name: Install apt dependencies + run: | + sudo apt-get install --no-install-recommends \ + qemu-system-arm \ + qemu-system-riscv32 \ + qemu-user \ + gcc-avr \ + avr-libc \ + ninja-build + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: '1.17' + - name: Install Node.js + uses: actions/setup-node@v2 + with: + node-version: '12' + - name: Install wasmtime + run: | + curl https://wasmtime.dev/install.sh -sSf | bash + echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH + - name: Cache Go + uses: actions/cache@v2 + with: + key: go-cache-linux-asserts-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-asserts-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-asserts-v2 + path: llvm-build + - name: Build LLVM + if: steps.cache-llvm-build.outputs.cache-hit != 'true' + shell: bash + run: | + # fetch LLVM source + rm -rf llvm-project + make llvm-source + # build! + make llvm-build ASSERT=1 + # 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-asserts-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: Test TinyGo + run: make ASSERT=1 test + - name: Build TinyGo + run: | + make ASSERT=1 + echo "$(pwd)/build" >> $GITHUB_PATH + - name: Test stdlib packages + run: make tinygo-test + - 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 gen-device -j4 + - run: make smoketest + - run: make wasmtest