Skip to content

Commit 5b4c40d

Browse files
committed
ci: split frontend CI
Splits frontend CI to have different jobs. Each job takes care of one aspect of the CI and if it fails it's clear what failed and other steps that might have failed to. Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
1 parent bceff82 commit 5b4c40d

11 files changed

Lines changed: 491 additions & 111 deletions
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#
2+
# This file is part of Edgehog.
3+
#
4+
# Copyright 2026 SECO Mind Srl
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# 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, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
20+
21+
name: frontend check types
22+
on:
23+
workflow_call:
24+
workflow_dispatch:
25+
permissions:
26+
contents: read
27+
defaults:
28+
run:
29+
shell: bash
30+
working-directory: frontend
31+
env:
32+
MIX_ENV: test
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
jobs:
35+
check-types:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v6
39+
with:
40+
show-progress: false
41+
- uses: actions/setup-node@v6
42+
with:
43+
node-version-file: .tool-versions
44+
cache: "npm"
45+
cache-dependency-path: frontend/package-lock.json
46+
- name: Check types
47+
working-directory: frontend
48+
run: npm run build

.github/workflows/frontend-ci.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#
2+
# This file is part of Edgehog.
3+
#
4+
# Copyright 2021 - 2025 SECO Mind Srl
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# 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, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
20+
21+
name: Build and Test Frontend
22+
23+
on:
24+
# Run when pushing to stable branches
25+
push:
26+
paths:
27+
- "frontend/**"
28+
- ".tool-versions"
29+
- ".github/workflows/frontend-ci.yaml"
30+
branches:
31+
- "main"
32+
- "release-*"
33+
# Run on pull requests matching apps
34+
pull_request:
35+
paths:
36+
- "frontend/**"
37+
- ".tool-versions"
38+
- ".github/workflows/frontend-ci.yaml"
39+
40+
jobs:
41+
warmup-cache:
42+
uses: ./.github/workflows/frontend-warmup-cache.yaml
43+
codeql:
44+
uses: ./.github/workflows/frontend-codeql-analysis.yaml
45+
docker-build:
46+
uses: ./.github/workflows/frontend-docker-build.yaml
47+
build:
48+
needs: [warmup-cache]
49+
uses: ./.github/workflows/frontend-build.yaml
50+
formatter:
51+
needs: [warmup-cache]
52+
uses: ./.github/workflows/frontend-format.yaml
53+
translations:
54+
needs: [warmup-cache]
55+
uses: ./.github/workflows/frontend-translations.yaml
56+
linting:
57+
needs: [warmup-cache]
58+
uses: ./.github/workflows/frontend-linting.yaml
59+
types:
60+
needs: [warmup-cache]
61+
uses: ./.github/workflows/frontend-types.yaml
62+
coverage:
63+
needs: [warmup-cache]
64+
uses: ./.github/workflows/frontend-coverage.yaml

.github/workflows/frontend-codeql-analysis.yaml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,19 @@
2121
name: "CodeQL"
2222

2323
on:
24-
push:
25-
paths:
26-
- "frontend/**"
27-
- ".github/workflows/frontend-codeql-analysis.yaml"
28-
pull_request:
29-
paths:
30-
- "frontend/**"
31-
- ".github/workflows/frontend-codeql-analysis.yaml"
24+
workflow_call:
25+
workflow_dispatch:
3226
schedule:
3327
- cron: "33 5 * * 6"
28+
permissions:
29+
contents: read
30+
defaults:
31+
run:
32+
shell: bash
33+
working-directory: frontend
34+
env:
35+
MIX_ENV: test
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3437

3538
jobs:
3639
analyze:
@@ -49,12 +52,7 @@ jobs:
4952
uses: actions/checkout@v6
5053
with:
5154
show-progress: false
52-
53-
# Initializes the CodeQL tools for scanning.
54-
- name: Initialize CodeQL
55-
uses: github/codeql-action/init@v4
55+
- uses: github/codeql-action/init@v4
5656
with:
5757
languages: ${{ matrix.language }}
58-
59-
- name: Perform CodeQL Analysis
60-
uses: github/codeql-action/analyze@v4
58+
- uses: github/codeql-action/analyze@v4
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#
2+
# This file is part of Edgehog.
3+
#
4+
# Copyright 2026 SECO Mind Srl
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# 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, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
20+
21+
name: frontend test and coverage
22+
on:
23+
workflow_call:
24+
workflow_dispatch:
25+
permissions:
26+
contents: read
27+
defaults:
28+
run:
29+
shell: bash
30+
working-directory: frontend
31+
env:
32+
MIX_ENV: test
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
jobs:
35+
coverage-test:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v6
39+
with:
40+
show-progress: false
41+
- uses: actions/setup-node@v6
42+
id: cache-npm
43+
with:
44+
node-version-file: .tool-versions
45+
cache: "npm"
46+
cache-dependency-path: frontend/package-lock.json
47+
path: frontend/build
48+
- name: npm install
49+
working-directory: frontend
50+
run: npm i
51+
- name: Run tests
52+
working-directory: frontend
53+
run: npm run coverage
54+
- name: Upload to Coveralls
55+
uses: coverallsapp/github-action@master
56+
with:
57+
github-token: ${{ secrets.GITHUB_TOKEN }}
58+
path-to-lcov: frontend/coverage/lcov.info
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# This file is part of Edgehog.
3+
#
4+
# Copyright 2026 SECO Mind Srl
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# 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, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
20+
21+
name: Build frontend docker images
22+
on:
23+
workflow_call:
24+
workflow_dispatch:
25+
permissions:
26+
contents: read
27+
defaults:
28+
run:
29+
shell: bash
30+
working-directory: frontend
31+
env:
32+
MIX_ENV: test
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
jobs:
35+
docker-build:
36+
name: Build Docker image
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v6
41+
with:
42+
show-progress: false
43+
- name: Build Docker image
44+
working-directory: frontend
45+
run: docker build .
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#
2+
# This file is part of Edgehog.
3+
#
4+
# Copyright 2026 SECO Mind Srl
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# 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, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
20+
21+
name: frontend check format
22+
on:
23+
workflow_call:
24+
workflow_dispatch:
25+
permissions:
26+
contents: read
27+
defaults:
28+
run:
29+
shell: bash
30+
working-directory: frontend
31+
env:
32+
MIX_ENV: test
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
jobs:
35+
check-format:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v6
39+
with:
40+
show-progress: false
41+
- uses: actions/setup-node@v6
42+
id: cache-npm
43+
with:
44+
node-version-file: .tool-versions
45+
cache: "npm"
46+
cache-dependency-path: frontend/package-lock.json
47+
- name: npm install
48+
working-directory: frontend
49+
run: npm i
50+
- name: Check formatting
51+
working-directory: frontend
52+
run: npm run check-format
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#
2+
# This file is part of Edgehog.
3+
#
4+
# Copyright 2026 SECO Mind Srl
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# 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, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
20+
21+
name: frontend check linting
22+
on:
23+
workflow_call:
24+
workflow_dispatch:
25+
permissions:
26+
contents: read
27+
defaults:
28+
run:
29+
shell: bash
30+
working-directory: frontend
31+
env:
32+
MIX_ENV: test
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
jobs:
35+
check-linting:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v6
39+
with:
40+
show-progress: false
41+
- uses: actions/setup-node@v6
42+
id: cache-npm
43+
with:
44+
node-version-file: .tool-versions
45+
cache: "npm"
46+
cache-dependency-path: frontend/package-lock.json
47+
- name: npm install
48+
working-directory: frontend
49+
run: npm i
50+
- name: Check linting
51+
working-directory: frontend
52+
run: npm run check-lint

0 commit comments

Comments
 (0)