Skip to content

fix: rewrite doctor chrome status switch #141

fix: rewrite doctor chrome status switch

fix: rewrite doctor chrome status switch #141

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-unit:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Verify dependencies
run: |
go mod verify
go mod tidy
git diff --exit-code go.mod go.sum
- name: Run unit tests with coverage
run: go test -race -coverprofile=coverage-unit.out -covermode=atomic ./...
- name: Upload unit coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage-unit.out
flags: unit
fail_ci_if_error: false
test-integration:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Cache Rod browser
uses: actions/cache@v4
with:
path: ~/.cache/rod
key: rod-${{ runner.os }}-${{ hashFiles('go.sum') }}-v2
restore-keys: |
rod-${{ runner.os }}-
- name: Run integration tests with coverage
run: |
echo "ROD_NO_SANDBOX=$ROD_NO_SANDBOX"
go test -race -tags=integration -coverprofile=coverage-integration.out -covermode=atomic ./...
env:
ROD_NO_SANDBOX: 1
- name: Upload integration coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage-integration.out
flags: integration
fail_ci_if_error: false
test-config-init-safety:
runs-on: ${{ matrix.os }}
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run config init safety tests
run: go test ./cmd/picoloom -run TestConfigInit_ -count=1
- name: Run config init integration tests
run: go test -tags=integration ./cmd/picoloom -run TestIntegration_ConfigInit -count=1
lint:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Check formatting
run: test -z "$(gofmt -l .)" || (gofmt -l . && exit 1)
- name: Run go vet
run: go vet ./...
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version-file: .golangci-lint-version
args: --config=.golangci.yml
security:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run gosec
run: go tool gosec ./...
examples:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Cache Rod browser
uses: actions/cache@v4
with:
path: ~/.cache/rod
key: rod-${{ runner.os }}-${{ hashFiles('go.sum') }}-v2
restore-keys: |
rod-${{ runner.os }}-
- name: Build picoloom
run: go build -o picoloom ./cmd/picoloom
- name: Generate example PDFs
run: |
./picoloom convert examples/simple-report.md -o /tmp/simple-test.pdf
./picoloom convert -c examples/full-featured.yaml examples/full-featured.md -o /tmp/full-test.pdf
env:
ROD_NO_SANDBOX: 1
- name: Verify PDFs generated
run: |
test -f /tmp/simple-test.pdf && echo "simple-test.pdf: OK"
test -f /tmp/full-test.pdf && echo "full-test.pdf: OK"
ls -la /tmp/*.pdf
build:
needs: [lint, security, test-unit, test-integration, test-config-init-safety, examples]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build
run: go build -v ./...