Skip to content

Commit f29ae4c

Browse files
committed
Refactor CI using central flow
1 parent 6ad17af commit f29ae4c

21 files changed

+475
-354
lines changed
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
name: Bundler Container
22

33
on:
4-
push:
5-
pull_request:
4+
workflow_call:
65

76
jobs:
87
build_publish:
9-
# Deduplicate jobs from pull requests and branch pushes within the same repo.
10-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
118
runs-on: ubuntu-latest
129
permissions:
1310
contents: read
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Bundler Docs
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
services:
10+
ispyb:
11+
image: ghcr.io/diamondlightsource/ispyb-database:v3.0.0
12+
ports:
13+
- 3306:3306
14+
env:
15+
MARIADB_ROOT_PASSWORD: rootpassword
16+
options: >
17+
--health-cmd "/usr/local/bin/healthcheck.sh --defaults-file=/ispyb/.my.cnf --connect"
18+
env:
19+
DATABASE_URL: mysql://root:rootpassword@localhost/ispyb_build
20+
steps:
21+
- name: Checkout source
22+
uses: actions/[email protected]
23+
24+
- name: Install stable toolchain
25+
uses: actions-rs/[email protected]
26+
with:
27+
toolchain: stable
28+
default: true
29+
30+
- name: Cache Rust Build
31+
uses: Swatinem/[email protected]
32+
33+
- name: Build docs
34+
uses: actions-rs/[email protected]
35+
with:
36+
command: doc
37+
args: >
38+
--no-deps
39+
--all-features
40+
--document-private-items
41+
--manifest-path bundler/Cargo.toml
42+
43+
- name: Fix file permissions for pages
44+
run: chmod -R +rX bundler/target/doc
45+
46+
- name: Upload Bundler Docs Artifact
47+
uses: actions/[email protected]
48+
with:
49+
name: bundler-docs
50+
path: bundler/target/doc/bundler
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Bundler Lint
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
lint:
8+
runs-on: ubuntu-latest
9+
services:
10+
ispyb:
11+
image: ghcr.io/diamondlightsource/ispyb-database:v3.0.0
12+
ports:
13+
- 3306:3306
14+
env:
15+
MARIADB_ROOT_PASSWORD: rootpassword
16+
options: >
17+
--health-cmd "/usr/local/bin/healthcheck.sh --defaults-file=/ispyb/.my.cnf --connect"
18+
env:
19+
DATABASE_URL: mysql://root:rootpassword@localhost/ispyb_build
20+
steps:
21+
- name: Checkout source
22+
uses: actions/[email protected]
23+
24+
- name: Install stable toolchain
25+
uses: actions-rs/[email protected]
26+
with:
27+
toolchain: stable
28+
default: true
29+
30+
- name: Cache Rust Build
31+
uses: Swatinem/[email protected]
32+
33+
- name: Check Formatting
34+
uses: actions-rs/[email protected]
35+
with:
36+
command: fmt
37+
args: >
38+
--manifest-path bundler/Cargo.toml
39+
--all
40+
--check
41+
42+
- name: Lint with Clippy
43+
uses: actions-rs/[email protected]
44+
with:
45+
command: clippy
46+
args: >
47+
--manifest-path bundler/Cargo.toml
48+
--all-targets
49+
--all-features
50+
--no-deps
51+
--
52+
--deny warnings
53+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Bundler Test
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
services:
10+
ispyb:
11+
image: ghcr.io/diamondlightsource/ispyb-database:v3.0.0
12+
ports:
13+
- 3306:3306
14+
env:
15+
MARIADB_ROOT_PASSWORD: rootpassword
16+
options: >
17+
--health-cmd "/usr/local/bin/healthcheck.sh --defaults-file=/ispyb/.my.cnf --connect"
18+
env:
19+
DATABASE_URL: mysql://root:rootpassword@localhost/ispyb_build
20+
steps:
21+
- name: Checkout source
22+
uses: actions/[email protected]
23+
24+
- name: Install stable toolchain
25+
uses: actions-rs/[email protected]
26+
with:
27+
toolchain: stable
28+
default: true
29+
30+
- name: Cache Rust Build
31+
uses: Swatinem/[email protected]
32+
33+
- name: Test
34+
uses: actions-rs/[email protected]
35+
with:
36+
command: test
37+
args: >
38+
--manifest-path bundler/Cargo.toml
39+
--all-targets
40+
--all-features
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
name: Dev Container CI
22

33
on:
4-
push:
5-
pull_request:
4+
workflow_call:
65

76
jobs:
87
build:
9-
# pull requests are a duplicate of a branch push if within the same repo.
10-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
118
runs-on: ubuntu-latest
129
steps:
1310
- name: Checkout

.github/workflows/_docs_build.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Docs Build
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout source
11+
uses: actions/[email protected]
12+
13+
- name: Setup Python
14+
uses: actions/[email protected]
15+
with:
16+
python-version: 3.12
17+
18+
- name: Install Python Dependencies
19+
run: pip install -r docs/requirements.txt
20+
21+
- name: Build User Docs
22+
run: mkdocs build
23+
24+
- name: Fix file permissions for pages
25+
run: chmod -R +rX site
26+
27+
- name: Upload User Docs Artifact
28+
uses: actions/[email protected]
29+
with:
30+
name: user-docs
31+
path: site

.github/workflows/_docs_lint.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Docs Lint
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
lint:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout source
11+
uses: actions/[email protected]
12+
13+
- name: Setup Node
14+
uses: actions/[email protected]
15+
with:
16+
node-version: 18
17+
18+
- name: Install Yarn dependencies
19+
uses: borales/[email protected]
20+
with:
21+
cmd: global add markdownlint-cli2 markdown-it-admon
22+
23+
- name: Lint with markdownlint-cli2
24+
run: >
25+
markdownlint-cli2
26+
**/*.{md,markdown}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Helm Charts Lint
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
lint:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout source
11+
uses: actions/[email protected]
12+
with:
13+
fetch-depth: 0
14+
15+
- name: Setup Helm
16+
uses: azure/setup-helm@v4
17+
18+
- name: Setup chart-testing
19+
uses: helm/[email protected]
20+
21+
- name: Lint
22+
run: >
23+
ct
24+
lint
25+
--target-branch=${{ github.event.repository.default_branch }}
26+
--validate-maintainers=false
27+

.github/workflows/helm-charts.yml renamed to .github/workflows/_helm_chart_publish.yaml

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,10 @@
1-
name: Helm Charts
1+
name: Helm Charts Publish
22

33
on:
4-
push:
5-
pull_request:
4+
workflow_call:
65

76
jobs:
8-
test:
9-
# Deduplicate jobs from pull requests and branch pushes within the same repo.
10-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: Checkout source
14-
uses: actions/[email protected]
15-
with:
16-
fetch-depth: 0
17-
18-
- name: Setup Helm
19-
uses: azure/setup-helm@v4
20-
21-
- name: Setup chart-testing
22-
uses: helm/[email protected]
23-
24-
- name: Lint
25-
run: >
26-
ct
27-
lint
28-
--target-branch=${{ github.event.repository.default_branch }}
29-
--validate-maintainers=false
30-
31-
build_publish:
32-
# Deduplicate jobs from pull requests and branch pushes within the same repo.
33-
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
7+
publish:
348
runs-on: ubuntu-latest
359
permissions:
3610
contents: read
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Pages Build
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
combine:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Download User Docs Artifact
11+
uses: actions/[email protected]
12+
with:
13+
name: user-docs
14+
path: docs
15+
16+
- name: Download User Docs Artifact
17+
uses: actions/[email protected]
18+
with:
19+
name: bundler-docs
20+
path: docs/bundler
21+
22+
- name: Upload Pages Artifact
23+
uses: actions/[email protected]
24+
with:
25+
path: docs
26+

0 commit comments

Comments
 (0)