name: CI on: push: branches: [main] pull_request: branches: [main] permissions: read-all jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version: "1.26" - name: gofmt run: | unformatted=$(gofmt -l -d . 2>&1) || true if [ -n "$unformatted" ]; then echo "::error::File(s) not formatted with gofmt:" echo "$unformatted" exit 1 fi - name: go vet run: go vet ./... - name: go vet (tinygo tags) run: go vet -tags=tinygo ./... - name: go fix run: | diff=$(go fix -diff ./... 2>&1) || true if [ -n "$diff" ]; then echo "$diff" echo "::error::Files need go tool fix. Run: go tool fix ./..." exit 1 fi build: runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version: "1.26" - name: Build run: go build -v ./... test: needs: [build] runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version: "1.26" - name: Test run: | mkdir -p profiles go test -v -shuffle=on -count=1 \ -coverprofile=profiles/coverage.profile -covermode=atomic -coverpkg=./... \ -timeout=10m \ ./... - name: Upload coverage uses: codecov/codecov-action@3f20e214133d0983f9a10f3d63b0faf9241a3daa # v6.0.0 with: token: ${{ secrets.CODECOV_TOKEN }} files: profiles/coverage.profile slug: soypat/lneto - name: Upload profiles if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: test-profiles path: profiles/ retention-days: 14 race: needs: [build] runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version: "1.26" - name: Test (race + shuffle) run: go test -race -shuffle=on -count=1 -timeout=10m ./... benchmark: needs: [test] runs-on: ubuntu-latest permissions: contents: read steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version: "1.26" - name: Run benchmarks run: go test -bench=. -benchmem -count=5 -shuffle=on -run='^$' -timeout=15m ./... | tee bench-results.txt - name: Generate benchmark report run: | go run ./internal/benchci -current bench-results.txt -out bench-report.md cat bench-report.md >> "$GITHUB_STEP_SUMMARY" - name: Upload generated benchmark report if: github.event_name == 'pull_request' uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: bench-report path: bench-report.md retention-days: 30 - name: Upload raw benchmark results if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: bench-results path: bench-results.txt retention-days: 30