github.com/aykevl/tinygo@v0.5.0/.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    apt-dependencies:
    10      parameters:
    11        llvm:
    12          type: string
    13      steps:
    14        - run:
    15            name: "Install apt dependencies"
    16            command: |
    17              echo 'deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch<<parameters.llvm>> main' | sudo tee /etc/apt/sources.list.d/llvm.list
    18              wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
    19              sudo apt-get update
    20              sudo apt-get install \
    21                  python3 \
    22                  llvm<<parameters.llvm>>-dev \
    23                  clang<<parameters.llvm>> \
    24                  libclang<<parameters.llvm>>-dev \
    25                  lld<<parameters.llvm>> \
    26                  gcc-arm-linux-gnueabihf \
    27                  libc6-dev-armel-cross \
    28                  gcc-aarch64-linux-gnu \
    29                  libc6-dev-arm64-cross \
    30                  qemu-system-arm \
    31                  qemu-user \
    32                  gcc-avr \
    33                  avr-libc
    34    install-node:
    35      steps:
    36        - run:
    37            name: "Install node.js"
    38            command: |
    39              wget https://nodejs.org/dist/v10.15.1/node-v10.15.1-linux-x64.tar.xz
    40              sudo tar -C /usr/local -xf node-v10.15.1-linux-x64.tar.xz
    41              sudo ln -s /usr/local/node-v10.15.1-linux-x64/bin/node /usr/bin/node
    42              rm node-v10.15.1-linux-x64.tar.xz
    43    dep:
    44      steps:
    45        - run:
    46            name: "Install Go dependencies"
    47            command: |
    48              curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
    49              dep ensure --vendor-only
    50    smoketest:
    51      steps:
    52        - smoketest-no-avr
    53        - run: tinygo build -size short -o test.elf -target=arduino             examples/blinky1
    54        - run: tinygo build -size short -o test.elf -target=digispark           examples/blinky1
    55    smoketest-no-avr:
    56      steps:
    57        - run: tinygo build -size short -o test.elf -target=pca10040            examples/blinky1
    58        - run: tinygo build -size short -o test.elf -target=pca10040            examples/blinky2
    59        - run: tinygo build             -o blinky2                              examples/blinky2 # TODO: re-enable -size flag with MachO support
    60        - run: tinygo build -size short -o test.elf -target=pca10040            examples/test
    61        - run: tinygo build -size short -o test.elf -target=microbit            examples/echo
    62        - run: tinygo build -size short -o test.elf -target=nrf52840-mdk        examples/blinky1
    63        - run: tinygo build -size short -o test.elf -target=pca10031            examples/blinky1
    64        - run: tinygo build -size short -o test.elf -target=bluepill            examples/blinky1
    65        - run: tinygo build -size short -o test.elf -target=reelboard           examples/blinky1
    66        - run: tinygo build -size short -o test.elf -target=reelboard           examples/blinky2
    67        - run: tinygo build -size short -o test.elf -target=pca10056            examples/blinky1
    68        - run: tinygo build -size short -o test.elf -target=pca10056            examples/blinky2
    69        - run: tinygo build -size short -o test.elf -target=itsybitsy-m0        examples/blinky1
    70        - run: tinygo build -size short -o test.elf -target=circuitplay-express examples/blinky1
    71        - run: tinygo build -size short -o test.elf -target=stm32f4disco        examples/blinky1
    72        - run: tinygo build -size short -o test.elf -target=stm32f4disco        examples/blinky2
    73        - run: tinygo build             -o wasm.wasm -target=wasm               examples/wasm/export
    74        - run: tinygo build             -o wasm.wasm -target=wasm               examples/wasm/main
    75    test-linux:
    76      parameters:
    77        llvm:
    78          type: string
    79      steps:
    80        - checkout
    81        - submodules
    82        - apt-dependencies:
    83            llvm: <<parameters.llvm>>
    84        - install-node
    85        - restore_cache:
    86            keys:
    87              - go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
    88              - go-cache-{{ checksum "Gopkg.lock" }}
    89        - dep
    90        - run: go install .
    91        - run: go test -v
    92        - run: make gen-device -j4
    93        - smoketest
    94        - save_cache:
    95            key: go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
    96            paths:
    97              - ~/.cache/go-build
    98              - ~/.cache/tinygo
    99        - run: make fmt-check
   100    build-linux:
   101      steps:
   102        - checkout
   103        - submodules
   104        - run:
   105            name: "Install apt dependencies"
   106            command: |
   107              sudo apt-get install \
   108                  libtinfo-dev \
   109                  python3 \
   110                  gcc-arm-linux-gnueabihf \
   111                  binutils-arm-none-eabi \
   112                  libc6-dev-armel-cross \
   113                  gcc-aarch64-linux-gnu \
   114                  libc6-dev-arm64-cross \
   115                  qemu-system-arm \
   116                  qemu-user \
   117                  gcc-avr \
   118                  avr-libc
   119        - install-node
   120        - restore_cache:
   121            keys:
   122              - go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}
   123              - go-cache-{{ checksum "Gopkg.lock" }}
   124        - restore_cache:
   125            keys:
   126              - llvm-source-8-v2
   127        - run:
   128            name: "Fetch LLVM source"
   129            command: make llvm-source
   130        - save_cache:
   131            key: llvm-source-8-v2
   132            paths:
   133              - llvm
   134        - restore_cache:
   135            keys:
   136              - llvm-build-8-v2
   137        - run:
   138            name: "Build LLVM"
   139            command: |
   140              if [ ! -f llvm-build/lib/liblldELF.a ]
   141              then
   142                # install dependencies
   143                sudo apt-get install cmake clang ninja-build
   144                # make build faster
   145                export CC=clang
   146                export CXX=clang++
   147                # hack ninja to use less jobs
   148                echo -e '#!/bin/sh\n/usr/bin/ninja -j3 "$@"' > /go/bin/ninja
   149                chmod +x /go/bin/ninja
   150                # build!
   151                make llvm-build
   152              fi
   153        - save_cache:
   154            key: llvm-build-8-v2
   155            paths:
   156              llvm-build
   157        - run:
   158            name: "Create LLVM symlinks"
   159            command: |
   160              ln -s $PWD/llvm-build/bin/clang-8 /go/bin/clang-8
   161              ln -s $PWD/llvm-build/bin/ld.lld  /go/bin/ld.lld-8
   162              ln -s $PWD/llvm-build/bin/wasm-ld /go/bin/wasm-ld-8
   163        - dep
   164        - run:
   165            name: "Test TinyGo"
   166            command: make test
   167        - run:
   168            name: "Build TinyGo release"
   169            command: |
   170              make release -j3
   171              cp -p build/release.tar.gz /tmp/tinygo.linux-amd64.tar.gz
   172        - store_artifacts:
   173            path: /tmp/tinygo.linux-amd64.tar.gz
   174        - save_cache:
   175            key: go-cache-{{ checksum "Gopkg.lock" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
   176            paths:
   177              - ~/.cache/go-build
   178              - ~/.cache/tinygo
   179        - run:
   180            name: "Extract release tarball"
   181            command: |
   182              mkdir -p ~/lib
   183              tar -C ~/lib -xf /tmp/tinygo.linux-amd64.tar.gz
   184              ln -s ~/lib/tinygo/bin/tinygo /go/bin/tinygo
   185              tinygo version
   186        - smoketest
   187    build-macos:
   188      steps:
   189        - checkout
   190        - submodules
   191        - run:
   192            name: "Install dependencies"
   193            command: |
   194              HOMEBREW_NO_AUTO_UPDATE=1 brew install go dep qemu
   195        - restore_cache:
   196            keys:
   197              - llvm-source-8-macos-v2
   198        - run:
   199            name: "Fetch LLVM source"
   200            command: make llvm-source
   201        - save_cache:
   202            key: llvm-source-8-macos-v2
   203            paths:
   204              - llvm
   205        - restore_cache:
   206            keys:
   207              - llvm-build-8-macos-v2
   208        - run:
   209            name: "Build LLVM"
   210            command: |
   211              if [ ! -f llvm-build/lib/liblldELF.a ]
   212              then
   213                # install dependencies
   214                HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake ninja
   215                # build!
   216                make llvm-build
   217              fi
   218        - save_cache:
   219            key: llvm-build-8-macos-v2
   220            paths:
   221              llvm-build
   222        - run:
   223            name: "Create LLVM symlinks"
   224            command: |
   225              ln -s $PWD/llvm-build/bin/clang-8 /usr/local/bin/clang-8
   226        - run:
   227            name: "Install Go dependencies"
   228            command: dep ensure --vendor-only
   229        - run:
   230            name: "Test TinyGo"
   231            command: make test
   232        - run:
   233            name: "Build TinyGo release"
   234            command: |
   235              make release -j3
   236              cp -p build/release.tar.gz /tmp/tinygo.darwin-amd64.tar.gz
   237        - store_artifacts:
   238            path: /tmp/tinygo.darwin-amd64.tar.gz
   239        - run:
   240            name: "Extract release tarball"
   241            command: |
   242              mkdir -p ~/lib
   243              tar -C /usr/local/opt -xf /tmp/tinygo.darwin-amd64.tar.gz
   244              ln -s /usr/local/opt/tinygo/bin/tinygo /usr/local/bin/tinygo
   245              tinygo version
   246        - smoketest-no-avr
   247  
   248  
   249  jobs:
   250    test-llvm8-go111:
   251      docker:
   252        - image: circleci/golang:1.11
   253      working_directory: /go/src/github.com/tinygo-org/tinygo
   254      steps:
   255        - test-linux:
   256            llvm: "-8"
   257    test-llvm8-go112:
   258      docker:
   259        - image: circleci/golang:1.12
   260      working_directory: /go/src/github.com/tinygo-org/tinygo
   261      steps:
   262        - test-linux:
   263            llvm: "-8"
   264    build-linux:
   265      docker:
   266        - image: circleci/golang:1.12
   267      working_directory: /go/src/github.com/tinygo-org/tinygo
   268      steps:
   269        - build-linux
   270    build-macos:
   271      macos:
   272        xcode: "10.1.0"
   273      working_directory: ~/go/src/github.com/tinygo-org/tinygo
   274      steps:
   275        - build-macos
   276  
   277  
   278  
   279  
   280  workflows:
   281    test-all:
   282      jobs:
   283        - test-llvm8-go111
   284        - test-llvm8-go112
   285        - build-linux
   286        - build-macos