github: run LiT itests & unit tests as part of CI #3127
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- '*' | |
merge_group: | |
branches: | |
- 'main' | |
defaults: | |
run: | |
shell: bash | |
env: | |
# go needs absolute directories, using the $HOME variable doesn't work here. | |
GOPATH: /home/runner/work/go | |
GO_VERSION: '1.22.3' | |
jobs: | |
####################### | |
# sql model generation | |
####################### | |
sqlc-check: | |
name: Sqlc check | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: Setup go environment | |
uses: ./.github/actions/setup-go | |
- name: docker image cache | |
uses: jpribyl/[email protected] | |
continue-on-error: true | |
- name: Generate sql models | |
run: make sqlc-check | |
rpc-check: | |
name: RPC check | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: Setup go environment | |
uses: ./.github/actions/setup-go | |
- name: Generate RPC stubs and check REST annotations | |
run: make rpc-check | |
mod-check: | |
name: go mod check | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: Setup go environment | |
uses: ./.github/actions/setup-go | |
- name: Run go mod tidy | |
run: make mod-check | |
test-vector-check: | |
name: test vector check | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: Setup go environment | |
uses: ./.github/actions/setup-go | |
- name: Run test vector creation check | |
run: make test-vector-check | |
migration-check: | |
name: migration version check | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: Run migration check | |
run: make migration-check | |
######################## | |
# Compilation check. | |
######################## | |
compile-check: | |
name: Compilation check | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: Setup go environment | |
uses: ./.github/actions/setup-go | |
- name: compile code | |
run: go install -v ./... | |
- name: Compile docs examples | |
run: make build-docs-examples | |
######################## | |
# sample configuration check | |
######################## | |
sample-conf-check: | |
name: sample configuration check | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: setup go environment | |
uses: ./.github/actions/setup-go | |
- name: check default values in sample-tapd.conf file | |
run: make sample-conf-check | |
######################## | |
# Docker build check. | |
######################## | |
docker-build-check: | |
name: Docker build check | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build default image | |
uses: docker/build-push-action@v4 | |
with: | |
tags: 'default-taproot-assets' | |
- name: Build dev image | |
uses: docker/build-push-action@v4 | |
with: | |
file: dev.Dockerfile | |
tags: 'dev-taproot-assets' | |
######################## | |
# cross compilation | |
######################## | |
cross-compile: | |
name: cross compilation | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: setup go ${{ env.GO_VERSION }} | |
uses: ./.github/actions/setup-go | |
- name: build release for all architectures | |
run: make release | |
######################## | |
# Lint check. | |
######################## | |
lint-check: | |
name: Lint check | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup go environment | |
uses: ./.github/actions/setup-go | |
- name: run lint | |
run: make lint | |
######################## | |
# Format check. | |
######################## | |
format-check: | |
name: Format check | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: Setup go environment | |
uses: ./.github/actions/setup-go | |
- name: run format | |
run: make fmt | |
######################## | |
# 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: | |
- unit-race | |
- unit-cover | |
- unit dbbackend=postgres | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: Setup go environment | |
uses: ./.github/actions/setup-go | |
- name: run ${{ matrix.unit_type }} | |
run: make ${{ matrix.unit_type }} | |
- name: Send coverage | |
uses: shogo82148/actions-goveralls@v1 | |
if: matrix.unit_type == 'unit-cover' | |
with: | |
path-to-profile: coverage.txt | |
flag-name: 'unit' | |
parallel: true | |
######################## | |
# run integration tests | |
######################## | |
integration-test: | |
name: run itests | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: Setup go environment | |
uses: ./.github/actions/setup-go | |
- name: run itest | |
run: make itest | |
- name: Zip log files on failure | |
if: ${{ failure() }} | |
run: 7z a logs-itest.zip itest/**/*.log | |
- name: Upload log files on failure | |
uses: actions/upload-artifact@v3 | |
if: ${{ failure() }} | |
with: | |
name: logs-itest | |
path: logs-itest.zip | |
retention-days: 5 | |
######################## | |
# run integration tests with Postgres backend | |
######################## | |
integration-test-postgres: | |
name: run itests postgres | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: Setup go environment | |
uses: ./.github/actions/setup-go | |
- name: run itest | |
run: make itest dbbackend=postgres | |
- name: Zip log files on failure | |
if: ${{ failure() }} | |
run: 7z a logs-itest-postgres.zip itest/**/*.log | |
- name: Upload log files on failure | |
uses: actions/upload-artifact@v3 | |
if: ${{ failure() }} | |
with: | |
name: logs-itest-postgres | |
path: logs-itest-postgres.zip | |
retention-days: 5 | |
######################## | |
# Trigger LiTd integration tests | |
######################## | |
trigger-lit-ci: | |
name: trigger LiT itests | |
runs-on: ubuntu-latest | |
steps: | |
- name: git checkout | |
uses: actions/checkout@v3 | |
- name: Setup go environment | |
uses: ./.github/actions/setup-go | |
- name: Get current Tap commit hash and branch name | |
run: | | |
echo "TAP_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
echo "TAP_BRANCH=${GITHUB_REF_NAME}" >> $GITHUB_ENV | |
- name: Clone Lit repository | |
run: | | |
git clone https://github.com/lightninglabs/lightning-terminal.git | |
cd lightning-terminal | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
- name: Update go.mod to use the local Tap repository | |
run: | | |
cd lightning-terminal | |
go mod edit -replace=github.com/lightning-labs/taproot-assets=../ | |
go mod tidy | |
- name: Push changes to a temporary branch in Lit | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cd lightning-terminal | |
git checkout -b tap-${{ env.TAP_BRANCH }} | |
git commit -am "Update Tap dependency for branch ${{ env.TAP_BRANCH }}" | |
git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/lightninglabs/lightning-terminal.git | |
git push origin tap-${{ env.TAP_BRANCH }} | |
# git remote set-url origin [email protected]:lightninglabs/lightning-terminal.git | |
- name: Trigger Lit CI via GitHub API | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
curl -X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer $GITHUB_TOKEN" \ | |
https://api.github.com/repos/lightninglabs/lightning-terminal/actions/workflows/main.yml/dispatches \ | |
-d '{"ref":"tap-${{ env.TAP_BRANCH }}"}' | |
- name: Cleanup temporary branch in Lit | |
if: success() | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
curl -X DELETE \ | |
-H "Authorization: Bearer $GITHUB_TOKEN" \ | |
https://api.github.com/repos/lightninglabs/lightning-terminal/git/refs/heads/tap-${{ env.TAP_BRANCH }} | |
# Notify about the completion of all coverage collecting jobs. | |
finish: | |
if: ${{ always() }} | |
needs: [unit-test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: shogo82148/actions-goveralls@v1 | |
with: | |
parallel-finished: true |