lnd.xprv/.github/workflows/main.yml
Oliver Gugger 17b8b7ea0c
github+travis: split CI tasks between Travis and GitHub
To free up build in Travis, we decided to run the non-flaky parts of
the CI pipeline in GitHub Workflows/Actions only. The integration tests
on the other hand are removed from GitHub because individual actions
cannot be restarted there which caused us to restart the whole workflow
if one test was flaky.

This split should give us the best of both worlds: Fast run of small
checks, linting and unit tests with an easy overview of what failed in
the PR directly. And more free build slots on Travis to do more advanced
integration tests on other architectures and/or operating systems. And
the option to restart a single flaky integration test on Travis.
2020-07-23 15:06:05 +02:00

258 lines
7.9 KiB
YAML

name: CI
on:
push:
branches:
- "master"
pull_request:
branches:
- "*"
defaults:
run:
shell: bash
env:
# go needs absolute directories, using the $HOME variable doesn't work here.
GOCACHE: /home/runner/work/go/pkg/build
GOPATH: /home/runner/work/go
DOWNLOAD_CACHE: /home/runner/work/download_cache
BITCOIN_VERSION: 0.19.1
GO_VERSION: 1.14.4
jobs:
########################
# RPC compilation check
########################
rpc-check:
name: RPC compilation check
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v2
- name: go cache
uses: actions/cache@v1
with:
path: /home/runner/work/go
key: lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-
lnd-${{ runner.os }}-go-
- name: setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: '~${{ env.GO_VERSION }}'
- name: download cache
uses: actions/cache@v1
with:
path: /home/runner/work/download_cache
key: lnd-${{ runner.os }}-download-${{ hashFiles('**/install_travis_proto.sh') }}
restore-keys: |
lnd-${{ runner.os }}-download-${{ hashFiles('**/install_travis_proto.sh') }}
lnd-${{ runner.os }}-download-
- name: install protoc and protobuf libraries
run: ./scripts/install_travis_proto.sh
- name: run check
run: make rpc-check
########################
# compile unit tests
########################
unit-compile:
name: compile unit tests
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v2
- name: go cache
uses: actions/cache@v1
with:
path: /home/runner/work/go
key: lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-
lnd-${{ runner.os }}-go-
- name: setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: '~${{ env.GO_VERSION }}'
- name: compile
run: make unit pkg=... case=_NONE_
########################
# lint code
########################
lint:
name: lint code
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v2
- name: Fetch all history for linter
run: git fetch --prune --unshallow
- name: go cache
uses: actions/cache@v1
with:
path: /home/runner/work/go
key: lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-
lnd-${{ runner.os }}-go-
- name: setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: '~${{ env.GO_VERSION }}'
- name: lint
run: make lint
########################
# cross compilation
########################
cross-compile:
name: cross compilation
runs-on: ubuntu-latest
strategy:
matrix:
build_sys:
- windows-amd64
- freebsd-amd64
- solaris-amd64
steps:
- name: git checkout
uses: actions/checkout@v2
- name: go cache
uses: actions/cache@v1
with:
path: /home/runner/work/go
key: lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-
lnd-${{ runner.os }}-go-
- name: setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: '~${{ env.GO_VERSION }}'
- name: build release for architecture
run: make release sys=${{ matrix.build_sys }}
########################
# mobile compilation
########################
mobile-compile:
name: mobile compilation
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v2
- name: go cache
uses: actions/cache@v1
with:
path: /home/runner/work/go
key: lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-
lnd-${{ runner.os }}-go-
- name: setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: '~${{ env.GO_VERSION }}'
- name: download cache
uses: actions/cache@v1
with:
path: /home/runner/work/download_cache
key: lnd-${{ runner.os }}-download-${{ hashFiles('**/install_travis_proto.sh') }}
restore-keys: |
lnd-${{ runner.os }}-download-${{ hashFiles('**/install_travis_proto.sh') }}
lnd-${{ runner.os }}-download-
- name: install protoc and protobuf libraries
run: ./scripts/install_travis_proto.sh
- name: build mobile RPC bindings
run: make mobile-rpc
- name: build mobile specific code
run: go build --tags="mobile" ./mobile
########################
# run unit tests
########################
unit-test:
name: run unit tests
runs-on: ubuntu-latest
strategy:
# Allow other tests in the matrix to continue if one fails.
fail-fast: false
matrix:
unit_type:
- btcd unit-cover
- travis-race
steps:
- name: git checkout
uses: actions/checkout@v2
- name: go cache
uses: actions/cache@v1
with:
path: /home/runner/work/go
key: lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-
lnd-${{ runner.os }}-go-
- name: setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: '~${{ env.GO_VERSION }}'
- name: bitcoin cache
uses: actions/cache@v1
with:
path: /home/runner/bitcoin/bitcoin-${{ env.BITCOIN_VERSION }}/bin
key: lnd-${{ runner.os }}-bitcoin-${{ env.BITCOIN_VERSION }}
restore-keys: |
lnd-${{ runner.os }}-bitcoin-${{ env.BITCOIN_VERSION }}
- name: install bitcoind
run: ./scripts/install_bitcoind.sh
- name: run ${{ matrix.unit_type }}
run: make ${{ matrix.unit_type }}
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
if: matrix.unit_type == 'btcd unit-cover'
with:
path-to-profile: coverage.txt
parallel: true