mirror of
https://github.com/luxfi/geth.git
synced 2026-07-27 01:59:25 +00:00
164 lines
3.7 KiB
YAML
164 lines
3.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop ]
|
|
pull_request:
|
|
branches: [ main, develop ]
|
|
|
|
env:
|
|
GO_VERSION: '1.26.4'
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
runs-on: lux-build-amd64
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
submodules: false
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Cache Go modules
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: ~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-ci-lint-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-ci-lint-
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Install golangci-lint v2
|
|
run: |
|
|
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6
|
|
|
|
- name: Run golangci-lint
|
|
continue-on-error: true
|
|
run: golangci-lint run --timeout=10m
|
|
|
|
- name: Run go fmt check
|
|
run: |
|
|
if [ -n "$(gofmt -l .)" ]; then
|
|
echo "Please run 'go fmt ./...' to format your code"
|
|
gofmt -l .
|
|
exit 1
|
|
fi
|
|
|
|
- name: Run go vet
|
|
continue-on-error: true
|
|
run: go vet ./...
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest]
|
|
go: ['1.26.4']
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- name: Cache Go modules
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: ~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-test-${{ matrix.os }}-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-test-${{ matrix.os }}-
|
|
${{ runner.os }}-go-test-
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Install dependencies
|
|
run: go mod download
|
|
|
|
- name: Run short tests
|
|
continue-on-error: true
|
|
env:
|
|
CGO_ENABLED: '0'
|
|
run: |
|
|
go test -v -short -coverprofile=coverage.out -covermode=atomic ./...
|
|
timeout-minutes: 10
|
|
|
|
- name: Upload coverage
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
file: ./coverage.out
|
|
flags: unittests
|
|
name: codecov-umbrella
|
|
|
|
build:
|
|
name: Build
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Cache Go modules
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: ~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-build-${{ matrix.os }}-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-build-${{ matrix.os }}-
|
|
${{ runner.os }}-go-build-
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Build geth
|
|
env:
|
|
CGO_ENABLED: '0'
|
|
run: |
|
|
go build -v -o build/bin/geth ./cmd/geth
|
|
|
|
- name: Build other tools
|
|
env:
|
|
CGO_ENABLED: '0'
|
|
run: |
|
|
go build -v ./cmd/...
|
|
|
|
- name: Upload binary
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: geth-${{ matrix.os }}
|
|
path: build/bin/geth
|
|
|
|
security:
|
|
name: Security Scan
|
|
runs-on: lux-build-amd64
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Run gosec
|
|
uses: securego/gosec@master
|
|
continue-on-error: true
|
|
with:
|
|
args: -fmt json -out gosec-report.json -severity medium ./...
|
|
|
|
- name: Upload security report
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: security-report
|
|
path: gosec-report.json |