-
Notifications
You must be signed in to change notification settings - Fork 16
114 lines (109 loc) · 3.45 KB
/
ci.yaml
File metadata and controls
114 lines (109 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: CI
on:
push:
branches:
- main
- stage
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- '*.md'
- '*.sh'
- '.github/*.md'
- '.github/workflows/openapi_update.yaml'
- '.github/CODEOWNERS'
- 'templates/**'
- '.openapi-generator-ignore'
- 'openapi/**'
- 'docs/**'
- 'pkg/api/openapi/docs/**'
- 'pkg/api/openapi/.openapi-generator-ignore'
jobs:
# This runs all pre-commit hooks defined within .pre-commit-config.yaml.
pre-commit:
name: "Run pre-commit hooks"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- uses: actions/setup-go@v6
with:
go-version: "1.25"
- uses: pre-commit/action@v3.0.1
- uses: pre-commit/action@v3.0.1
name: Verify generated files are up-to-date
with:
extra_args: --hook-stage=manual --all-files
verify-test:
name: "Verify & Test"
runs-on: ubuntu-latest
env:
OCM_ENV: integration
# Dummy SSO variables
SSO_CLIENT_ID: ${{ secrets.SSO_CLIENT_ID }}
SSO_CLIENT_SECRET: ${{ secrets.SSO_CLIENT_SECRET }}
OSD_IDP_SSO_CLIENT_ID: ${{ secrets.OSD_IDP_SSO_CLIENT_ID }}
OSD_IDP_SSO_CLIENT_SECRET: ${{ secrets.OSD_IDP_SSO_CLIENT_SECRET }}
# Dummy AWS credentials
AWS_ACCOUNT_ID: aws_accountid
AWS_ACCESS_KEY: aws_accesskey
AWS_SECRET_ACCESS_KEY: aws_secretaccesskey # pragma: allowlist secret - dummy value
ROUTE53_ACCESS_KEY: aws_route53_access_key # pragma: allowlist secret - dummy value
ROUTE53_SECRET_ACCESS_KEY: aws_route53_secret_access_key # pragma: allowlist secret - dummy value
TEST_TIMEOUT: 30m
services:
postgres:
image: postgres:11
env:
POSTGRES_PASSWORD: foobar-bizz-buzz # pragma: allowlist secret - dummy value
POSTGRES_USER: fleet_manager
POSTGRES_DB: serviceapitests
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Cancel Previous Runs
uses: n1hility/cancel-previous-runs@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: "1.25"
- name: Check out code into the Go module directory
uses: actions/checkout@v6
- name: Cache go module
uses: actions/cache@v5
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Go mod tidy
run: |
go mod tidy
- name: Clean and generate files
run: |
make clean/go-generated && make generate
- name: Test that there were no changes
run: |
git diff --exit-code
- name: Setup tests secrets
run: |
make ocm/setup aws/setup redhatsso/setup secrets/touch
- name: Run Migration Script
run: make db/migrate
- name: Verify & Test
run: |
GOPATH=$(go env GOPATH)
export GOPATH
export PATH=${PATH}:$GOPATH/bin
make verify binary test test/integration
timeout-minutes: 14