mirror of
https://github.com/luxfi/node.git
synced 2026-07-27 03:39:39 +00:00
194 lines
5.9 KiB
YAML
194 lines
5.9 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "*"
|
|
branches:
|
|
- main
|
|
- dev
|
|
pull_request:
|
|
merge_group:
|
|
types: [checks_requested]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
# Cancel ongoing workflow runs if a new one is started
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
Unit:
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
GOPRIVATE: github.com/luxfi/*
|
|
GONOSUMDB: github.com/luxfi/*
|
|
GOWORK: off
|
|
GOEXPERIMENT: runtimesecret
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-14, ubuntu-22.04, ubuntu-24.04, windows-2022]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-go-for-project
|
|
- name: Configure Git for private modules
|
|
shell: bash
|
|
run: git config --global url."https://${{ github.token }}@github.com/".insteadOf "https://github.com/"
|
|
- name: Set timeout on Windows
|
|
shell: bash
|
|
if: matrix.os == 'windows-2022'
|
|
run: echo "TIMEOUT=240s" >> "$GITHUB_ENV"
|
|
- name: build_test
|
|
shell: bash
|
|
run: ./scripts/build_test.sh
|
|
env:
|
|
TIMEOUT: ${{ env.TIMEOUT }}
|
|
CGO_ENABLED: '0'
|
|
Fuzz:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GOPRIVATE: github.com/luxfi/*
|
|
GONOSUMDB: github.com/luxfi/*
|
|
GOWORK: off
|
|
GOEXPERIMENT: runtimesecret
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-go-for-project
|
|
- name: Configure Git for private modules
|
|
shell: bash
|
|
run: git config --global url."https://${{ github.token }}@github.com/".insteadOf "https://github.com/"
|
|
- name: fuzz_test
|
|
shell: bash
|
|
run: ./scripts/build_fuzz.sh 20 # Run each fuzz test 20 seconds
|
|
env:
|
|
CGO_ENABLED: '0'
|
|
# NOTE: E2E tests disabled - require tmpnet infrastructure
|
|
# e2e_pre_etna, e2e_post_etna, e2e_existing_network, Upgrade
|
|
# These will be re-enabled once tmpnet is properly configured
|
|
Lint:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GOPRIVATE: github.com/luxfi/*
|
|
GONOSUMDB: github.com/luxfi/*
|
|
GOWORK: off
|
|
GOEXPERIMENT: runtimesecret
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-go-for-project
|
|
- name: Configure Git for private modules
|
|
shell: bash
|
|
run: git config --global url."https://${{ github.token }}@github.com/".insteadOf "https://github.com/"
|
|
- name: Run static analysis tests
|
|
shell: bash
|
|
run: scripts/lint.sh
|
|
env:
|
|
CGO_ENABLED: '0'
|
|
- name: Run shellcheck
|
|
shell: bash
|
|
run: scripts/shellcheck.sh
|
|
- name: Run actionlint
|
|
shell: bash
|
|
run: scripts/actionlint.sh
|
|
buf-lint:
|
|
name: Protobuf Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install buf
|
|
shell: bash
|
|
run: |
|
|
BUF_VERSION="1.47.2"
|
|
curl -sSL "https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-Linux-x86_64" -o /usr/local/bin/buf
|
|
chmod +x /usr/local/bin/buf
|
|
buf --version
|
|
- name: Lint protobuf
|
|
shell: bash
|
|
run: buf lint proto
|
|
check_generated_protobuf:
|
|
name: Up-to-date protobuf
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: true
|
|
env:
|
|
GOPRIVATE: github.com/luxfi/*
|
|
GONOSUMDB: github.com/luxfi/*
|
|
GOWORK: off
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-go-for-project
|
|
- name: Configure Git for private modules
|
|
shell: bash
|
|
run: git config --global url."https://${{ github.token }}@github.com/".insteadOf "https://github.com/"
|
|
- name: Install buf
|
|
shell: bash
|
|
run: |
|
|
BUF_VERSION="1.47.2"
|
|
curl -sSL "https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-Linux-x86_64" -o /usr/local/bin/buf
|
|
chmod +x /usr/local/bin/buf
|
|
- name: Install protoc-gen-go tools
|
|
shell: bash
|
|
run: |
|
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.35.1
|
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0
|
|
go install connectrpc.com/connect/cmd/protoc-gen-connect-go@latest
|
|
- shell: bash
|
|
run: scripts/protobuf_codegen.sh
|
|
env:
|
|
CGO_ENABLED: '0'
|
|
- shell: bash
|
|
run: .github/workflows/check-clean-branch.sh
|
|
check_mockgen:
|
|
name: Up-to-date mocks
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: true
|
|
env:
|
|
GOPRIVATE: github.com/luxfi/*
|
|
GONOSUMDB: github.com/luxfi/*
|
|
GOWORK: off
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-go-for-project
|
|
- name: Configure Git for private modules
|
|
shell: bash
|
|
run: git config --global url."https://${{ github.token }}@github.com/".insteadOf "https://github.com/"
|
|
- shell: bash
|
|
run: scripts/mock.gen.sh
|
|
env:
|
|
CGO_ENABLED: '0'
|
|
- shell: bash
|
|
run: .github/workflows/check-clean-branch.sh
|
|
go_mod_tidy:
|
|
name: Up-to-date go.mod and go.sum
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GOPRIVATE: github.com/luxfi/*
|
|
GONOSUMDB: github.com/luxfi/*
|
|
GOWORK: off
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/actions/setup-go-for-project
|
|
- name: Configure Git for private modules
|
|
shell: bash
|
|
run: git config --global url."https://${{ github.token }}@github.com/".insteadOf "https://github.com/"
|
|
- shell: bash
|
|
run: go mod tidy
|
|
- shell: bash
|
|
run: .github/workflows/check-clean-branch.sh
|
|
test_build_image:
|
|
name: Image build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Build Docker image (test only)
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: false
|
|
platforms: linux/amd64
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|