github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/.circleci/config.yml (about)

     1  version: 2.1
     2  
     3  commands:
     4    submodules:
     5      steps:
     6        - run:
     7            name: "Pull submodules"
     8            command: git submodule update --init
     9    llvm-source-linux:
    10      steps:
    11        - restore_cache:
    12            keys:
    13              - llvm-source-17-v1
    14        - run:
    15            name: "Fetch LLVM source"
    16            command: make llvm-source
    17        - save_cache:
    18            key: llvm-source-17-v1
    19            paths:
    20              - llvm-project/clang/lib/Headers
    21              - llvm-project/clang/include
    22              - llvm-project/compiler-rt
    23              - llvm-project/lld/include
    24              - llvm-project/llvm/include
    25    hack-ninja-jobs:
    26      steps:
    27        - run:
    28            name: "Hack Ninja to use less jobs"
    29            command: |
    30              echo -e '#!/bin/sh\n/usr/bin/ninja -j3 "$@"' > /go/bin/ninja
    31              chmod +x /go/bin/ninja
    32    build-binaryen-linux:
    33      steps:
    34        - restore_cache:
    35            keys:
    36              - binaryen-linux-v3
    37        - run:
    38            name: "Build Binaryen"
    39            command: |
    40              make binaryen
    41        - save_cache:
    42            key: binaryen-linux-v3
    43            paths:
    44              - build/wasm-opt
    45    test-linux:
    46      parameters:
    47        llvm:
    48          type: string
    49        fmt-check:
    50          type: boolean
    51          default: true
    52      steps:
    53        - checkout
    54        - submodules
    55        - run:
    56            name: "Install apt dependencies"
    57            command: |
    58              echo 'deb https://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-<<parameters.llvm>> main' > /etc/apt/sources.list.d/llvm.list
    59              wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
    60              apt-get update
    61              apt-get install --no-install-recommends -y \
    62                  llvm-<<parameters.llvm>>-dev \
    63                  clang-<<parameters.llvm>> \
    64                  libclang-<<parameters.llvm>>-dev \
    65                  lld-<<parameters.llvm>> \
    66                  cmake \
    67                  ninja-build
    68        - hack-ninja-jobs
    69        - build-binaryen-linux
    70        - restore_cache:
    71            keys:
    72              - go-cache-v4-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
    73              - go-cache-v4-{{ checksum "go.mod" }}
    74        - llvm-source-linux
    75        - run: go install -tags=llvm<<parameters.llvm>> .
    76        - restore_cache:
    77            keys:
    78              - wasi-libc-sysroot-systemclang-v7
    79        - run: make wasi-libc
    80        - save_cache:
    81            key: wasi-libc-sysroot-systemclang-v7
    82            paths:
    83              - lib/wasi-libc/sysroot
    84        - when:
    85            condition: <<parameters.fmt-check>>
    86            steps:
    87            - run:
    88                # Do this before gen-device so that it doesn't check the
    89                # formatting of generated files.
    90                name: Check Go code formatting
    91                command: make fmt-check
    92        - run: make gen-device -j4
    93        - run: make smoketest XTENSA=0
    94        - save_cache:
    95            key: go-cache-v4-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
    96            paths:
    97              - ~/.cache/go-build
    98              - /go/pkg/mod
    99  
   100  jobs:
   101    test-llvm15-go118:
   102      docker:
   103        - image: golang:1.18-bullseye
   104      steps:
   105        - test-linux:
   106            llvm: "15"
   107      resource_class: large
   108    test-llvm17-go122:
   109      docker:
   110        - image: golang:1.22-bullseye
   111      steps:
   112        - test-linux:
   113            llvm: "17"
   114      resource_class: large
   115  
   116  workflows:
   117    test-all:
   118      jobs:
   119        # This tests our lowest supported versions of Go and LLVM, to make sure at
   120        # least the smoke tests still pass.
   121        - test-llvm15-go118
   122        # This tests LLVM 17 support when linking against system libraries.
   123        - test-llvm17-go122