Skip to content

Commit 6eee2d9

Browse files
authored
Set github CI workflow (#9)
1 parent c5d72c6 commit 6eee2d9

8 files changed

Lines changed: 88 additions & 312 deletions

File tree

.circleci/config.yml

Lines changed: 0 additions & 87 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 88 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,104 @@
1-
name: Build project
2-
on: [ push, pull_request ]
1+
name: CI
2+
on:
3+
push:
4+
branches: [main, master]
5+
pull_request:
6+
branches: [main, master]
7+
merge_group:
8+
types: [checks_requested]
9+
workflow_dispatch:
10+
inputs:
11+
run_integration:
12+
description: 'Run integration tests'
13+
type: boolean
14+
default: true
15+
spec:
16+
description: 'Specific spec to test (e.g., 3.0/misc/stripe.com.yml)'
17+
type: string
18+
required: false
19+
max_concurrency:
20+
description: 'Max concurrency for integration tests'
21+
type: number
22+
default: 50
23+
324
jobs:
4-
build:
5-
name: Build
25+
build-ci:
26+
name: Build CI
627
runs-on: ubuntu-latest
7-
strategy:
8-
fail-fast: false
9-
# perform matrix testing to give us an earlier insight into issues with different versions of supported major versions of Go
10-
matrix:
11-
version:
12-
- "1.21"
13-
- "1.22"
14-
- "1.23"
15-
- "1.24"
1628
steps:
1729
- name: Check out source code
1830
uses: actions/checkout@v4
1931

2032
- name: Set up Go
2133
uses: actions/setup-go@v5
2234
with:
23-
go-version: ${{ matrix.version }}
35+
go-version: "1.25.3"
36+
cache: true
37+
38+
- name: Install gosec
39+
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
2440

25-
- name: Test
26-
run: make test
27-
env:
28-
# A combination of our GitHub Actions setup, with the Go toolchain, leads to inconsistencies in calling `go env`, in particular with Go 1.21, where having (the default) `GOTOOLCHAIN=auto` results in build failures
29-
GOTOOLCHAIN: local
41+
- name: Download Go modules
42+
run: go mod download
3043

31-
- name: Build
32-
run: go build ./cmd/oapi-codegen
44+
- name: Run build-ci
45+
run: make build-ci
46+
timeout-minutes: 30
3347

34-
results:
35-
if: ${{ always() }}
48+
test-ci:
49+
name: Test CI
3650
runs-on: ubuntu-latest
37-
name: Check build results
38-
needs: [build]
3951
steps:
40-
- run: |
41-
result="${{ needs.build.result }}"
42-
if [[ $result == "success" || $result == "skipped" ]]; then
43-
exit 0
44-
else
52+
- name: Check out source code
53+
uses: actions/checkout@v4
54+
55+
- name: Set up Go
56+
uses: actions/setup-go@v5
57+
with:
58+
go-version: "1.25.3"
59+
cache: true
60+
61+
- name: Download Go modules
62+
run: go mod download
63+
64+
- name: Run generate and check for uncommitted changes
65+
run: |
66+
make generate
67+
if ! git diff --exit-code; then
68+
echo "ERROR: make generate produced uncommitted changes"
69+
echo "Please run 'make generate' locally and commit the changes"
4570
exit 1
4671
fi
72+
73+
- name: Run test-ci
74+
run: make test-ci
75+
76+
integration-tests:
77+
name: Integration Tests
78+
runs-on: ubuntu-latest
79+
# Run on: merge_group (merge queue), push to main, or manual trigger with run_integration=true
80+
if: github.event_name == 'merge_group' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.run_integration)
81+
steps:
82+
- name: Check out source code
83+
uses: actions/checkout@v4
84+
85+
- name: Set up Go
86+
uses: actions/setup-go@v5
87+
with:
88+
go-version: "1.25.3"
89+
cache: true
90+
91+
- name: Download Go modules
92+
run: go mod download
93+
94+
- name: Fetch specs
95+
run: make fetch-specs
96+
97+
- name: Run integration tests
98+
run: |
99+
if [ -n "${{ inputs.spec }}" ]; then
100+
make test-integration SPEC="${{ inputs.spec }}"
101+
else
102+
INTEGRATION_MAX_CONCURRENCY=${{ inputs.max_concurrency }} go test -v -tags=integration -count=1 -timeout=60m .
103+
fi
104+
timeout-minutes: 65

.github/workflows/generate.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/label-actions.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/labeler.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/release-drafter.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)