Skip to content

Commit 0dbe687

Browse files
Add core and web verify workflows and bind compose services to loopback and parameterize credentials (#525)
* Add core and web verify workflows * Point to the packeges.json and updated the node version to 22 * Bind compose services to loopback and parameterize credentials
1 parent fc3cae7 commit 0dbe687

5 files changed

Lines changed: 223 additions & 12 deletions

File tree

.github/workflows/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
20+
# Workflows
21+
22+
Files are named `<area>-<purpose>.yml`, where the area matches the part of
23+
the repo the workflow validates:
24+
25+
| Area prefix | Covers |
26+
|---|---|
27+
| `core-` | Go backend: `cmd/`, `internal/`, `pkg/`, and unit tests repo-wide |
28+
| `web-` | the portal under `web/` |
29+
| `amie-` | the AMIE connector and its integration stack |
30+
31+
Current workflows:
32+
33+
- `core-verify.yml` — formatting, build, vet, unit tests for all Go packages,
34+
and the `./internal/...` integration suite against a MariaDB service
35+
container. Runs on Go changes.
36+
- `web-verify.yml` — frozen-lockfile install, typecheck, lint, unit tests,
37+
and a production build. Runs on `web/` changes.
38+
- `amie-integration-tests.yml` — the AMIE integration suite with its own
39+
compose stack (mock AMIE server + MariaDB). Runs on connector changes.
40+
Not duplicated by `core-verify.yml`.
41+
42+
When adding a workflow, keep the area prefix, add path filters so unrelated
43+
PRs skip it, and list it here.

.github/workflows/core-verify.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Core Verify
19+
20+
on:
21+
pull_request:
22+
paths:
23+
- '**.go'
24+
- 'go.mod'
25+
- 'go.sum'
26+
- 'internal/db/migrations/**'
27+
- '.github/workflows/core-verify.yml'
28+
push:
29+
branches: [master]
30+
paths:
31+
- '**.go'
32+
- 'go.mod'
33+
- 'go.sum'
34+
- 'internal/db/migrations/**'
35+
- '.github/workflows/core-verify.yml'
36+
workflow_dispatch:
37+
38+
jobs:
39+
verify:
40+
name: Format, build, vet, test
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 20
43+
services:
44+
mariadb:
45+
image: mariadb:11.2
46+
env:
47+
MARIADB_ROOT_PASSWORD: root
48+
MARIADB_DATABASE: custos
49+
MARIADB_USER: admin
50+
MARIADB_PASSWORD: admin
51+
ports:
52+
- 3306:3306
53+
options: >-
54+
--health-cmd="healthcheck.sh --connect --innodb_initialized"
55+
--health-interval=10s
56+
--health-timeout=5s
57+
--health-retries=10
58+
steps:
59+
- name: Checkout
60+
uses: actions/checkout@v4
61+
62+
- name: Set up Go
63+
uses: actions/setup-go@v5
64+
with:
65+
go-version: '1.24'
66+
cache: true
67+
68+
- name: Check formatting
69+
run: |
70+
files=$(gofmt -l .)
71+
if [ -n "$files" ]; then
72+
echo "gofmt required on:"
73+
echo "$files"
74+
exit 1
75+
fi
76+
77+
- name: Build
78+
run: go build ./...
79+
80+
- name: Vet
81+
run: go vet ./...
82+
83+
- name: Unit tests
84+
run: go test ./...
85+
86+
# The AMIE integration suite has its own workflow and compose stack;
87+
# this covers the core suite only.
88+
- name: Core integration tests
89+
env:
90+
CORE_TEST_DATABASE_DSN: "admin:admin@tcp(127.0.0.1:3306)/custos?parseTime=true&charset=utf8mb4&multiStatements=true"
91+
run: go test -tags integration ./internal/...

.github/workflows/web-verify.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Web Verify
19+
20+
on:
21+
pull_request:
22+
paths:
23+
- 'web/**'
24+
- '.github/workflows/web-verify.yml'
25+
push:
26+
branches: [master]
27+
paths:
28+
- 'web/**'
29+
- '.github/workflows/web-verify.yml'
30+
workflow_dispatch:
31+
32+
jobs:
33+
verify:
34+
name: Typecheck, lint, test, build
35+
runs-on: ubuntu-latest
36+
timeout-minutes: 15
37+
defaults:
38+
run:
39+
working-directory: web
40+
# Dummy values that satisfy the env schema; nothing here talks to a
41+
# real identity provider or backend.
42+
env:
43+
NEXTAUTH_SECRET: ci-only-dummy-secret
44+
OIDC_ISSUER_URL: https://idp.invalid
45+
OIDC_CLIENT_ID: ci
46+
OIDC_CLIENT_SECRET: ci
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v4
50+
51+
- name: Set up pnpm
52+
uses: pnpm/action-setup@v4
53+
with:
54+
# packageManager lives in web/package.json, not the repo root.
55+
package_json_file: web/package.json
56+
57+
- name: Set up Node
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: 22
61+
cache: pnpm
62+
cache-dependency-path: web/pnpm-lock.yaml
63+
64+
- name: Install
65+
run: pnpm install --frozen-lockfile
66+
67+
- name: Typecheck
68+
run: pnpm typecheck
69+
70+
- name: Lint
71+
run: pnpm lint
72+
73+
- name: Unit tests
74+
run: pnpm test
75+
76+
- name: Production build
77+
run: pnpm build

INSTALL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ conventions and contribution workflow, see [CONTRIBUTING.md](CONTRIBUTING.md).
2525
## Prerequisites
2626

2727
- Go **1.24+**
28-
- Node **20+** and **pnpm** (for the portal)
28+
- Node **22+** and **pnpm** (for the portal)
2929
- Docker and Docker Compose
3030
- `git`
3131

dev-ops/compose/docker-compose.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ services:
2424
restart: always
2525
command: --character-set-server=utf8 --collation-server=utf8_general_ci
2626
ports:
27-
- "3306:3306"
27+
- "127.0.0.1:3306:3306"
2828
environment:
29-
MARIADB_ROOT_PASSWORD: root
29+
MARIADB_ROOT_PASSWORD: ${CUSTOS_DB_ROOT_PASSWORD:-root}
3030
MARIADB_USER: admin
31-
MARIADB_PASSWORD: admin
31+
MARIADB_PASSWORD: ${CUSTOS_DB_PASSWORD:-admin}
3232
MAX_ALLOWED_PACKET: 1073741824
3333
volumes:
3434
- ./dbinit:/docker-entrypoint-initdb.d
@@ -50,14 +50,14 @@ services:
5050
KC_DB: mariadb
5151
KC_DB_URL: jdbc:mariadb://db:3306/keycloak
5252
KC_DB_USERNAME: admin
53-
KC_DB_PASSWORD: admin
53+
KC_DB_PASSWORD: ${CUSTOS_DB_PASSWORD:-admin}
5454
KC_HOSTNAME_URL: http://localhost:8081
5555
KC_HOSTNAME_STRICT: "false"
5656
KC_HTTP_ENABLED: "true"
5757
KC_HEALTH_ENABLED: "true"
5858
ports:
59-
- "8081:8080"
60-
- "9001:9000"
59+
- "127.0.0.1:8081:8080"
60+
- "127.0.0.1:9001:9000"
6161
volumes:
6262
- ./keycloak/import:/opt/keycloak/data/import:ro
6363
depends_on:
@@ -74,14 +74,14 @@ services:
7474
image: adminer
7575
restart: always
7676
ports:
77-
- 18080:8080
77+
- "127.0.0.1:18080:8080"
7878

7979
prometheus:
8080
image: prom/prometheus:latest
8181
container_name: prometheus
8282
restart: unless-stopped
8383
ports:
84-
- "19090:9090"
84+
- "127.0.0.1:19090:9090"
8585
volumes:
8686
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
8787
extra_hosts:
@@ -92,7 +92,7 @@ services:
9292
container_name: grafana
9393
restart: unless-stopped
9494
ports:
95-
- "13000:3000"
95+
- "127.0.0.1:13000:3000"
9696
environment:
9797
GF_SECURITY_ADMIN_USER: admin
9898
GF_SECURITY_ADMIN_PASSWORD: admin
@@ -106,8 +106,8 @@ services:
106106
container_name: vault
107107
restart: unless-stopped
108108
ports:
109-
- "8201:8201"
110-
- "8200:8200"
109+
- "127.0.0.1:8201:8201"
110+
- "127.0.0.1:8200:8200"
111111
environment:
112112
VAULT_ADDR: http://0.0.0.0:8201
113113
VAULT_API_ADDR: http://127.0.0.1:8200

0 commit comments

Comments
 (0)