Skip to content

Commit 6208c3c

Browse files
committed
Make build of e2e and astarte parallel, then run e2e tests
Signed-off-by: Eddy Babetto <eddy.babetto@secomind.com>
1 parent d07b1b9 commit 6208c3c

File tree

3 files changed

+74
-28
lines changed

3 files changed

+74
-28
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Astarte build
2+
3+
on:
4+
workflow_call:
5+
6+
7+
env:
8+
elixir_version: "1.15"
9+
otp_version: "26.1"
10+
11+
jobs:
12+
astarte-build:
13+
name: Astarte build
14+
runs-on: ubuntu-22.04
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Setup Docker Buildx
18+
uses: docker/setup-buildx-action@v3
19+
- name: Build Astarte containers
20+
uses: docker/bake-action@v6
21+
with:
22+
files: docker-compose.yml
23+
set: |
24+
*.cache-from=type=gha
25+
*.cache-to=type=gha,mode=max
26+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Astarte end-to-end build
2+
3+
on:
4+
workflow_call:
5+
6+
7+
env:
8+
elixir_version: "1.15"
9+
otp_version: "26.1"
10+
11+
jobs:
12+
end-to-end-build:
13+
name: End-to-end build
14+
runs-on: ubuntu-22.04
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Cache Astarte E2E deps
18+
uses: actions/cache@v4
19+
with:
20+
path: tools/astarte_e2e/deps
21+
key: e2e-deps-${{ env.otp_version }}-${{ env.elixir_version }}-${{ hashFiles(format('{0}{1}{2}', github.workspace, '/tools/astarte_e2e', '/mix.lock')) }}
22+
- name: Cache Astarte E2E build
23+
uses: actions/cache@v4
24+
with:
25+
path: tools/astarte_e2e/_build
26+
key: e2e-build-${{ env.otp_version }}-${{ env.elixir_version }}
27+
- uses: erlef/setup-beam@v1.15
28+
with:
29+
otp-version: ${{ env.otp_version }}
30+
elixir-version: ${{ env.elixir_version }}
31+
- name: Build Astarte E2E
32+
working-directory: tools/astarte_e2e
33+
run: |
34+
mix deps.get
35+
mix compile --warnings-as-errors --force

.github/workflows/astarte-end-to-end-test-workflow.yaml

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,23 @@ env:
2626
otp_version: "26.1"
2727

2828
jobs:
29+
e2e-build:
30+
uses: ./.github/workflows/astarte-e2e-build-workflow.yaml
31+
astarte-build:
32+
uses: ./.github/workflows/astarte-build-workflow.yaml
33+
2934
end-to-end-test:
35+
needs: [e2e-build, astarte-build]
3036
name: End-to-end Test
3137
runs-on: ubuntu-22.04
3238
steps:
3339
- uses: actions/checkout@v2
3440
- name: Initialize docker compose files
3541
run: docker run -v $(pwd)/compose:/compose astarte/docker-compose-initializer
36-
- name: Setup Docker Buildx
37-
uses: docker/setup-buildx-action@v3
38-
- name: Build Astarte containers
39-
uses: docker/bake-action@v6
42+
- uses: erlef/setup-beam@v1.15
4043
with:
41-
files: docker-compose.yml
42-
set: |
43-
*.cache-from=type=gha
44-
*.cache-to=type=gha,mode=max
44+
otp-version: ${{ env.otp_version }}
45+
elixir-version: ${{ env.elixir_version }}
4546
- name: Start all Astarte services
4647
run: docker compose up -d
4748
- name: Wait for Astarte to come up
@@ -71,25 +72,7 @@ jobs:
7172
run: |
7273
JWT=$(./astartectl utils gen-jwt appengine channels pairing realm-management -k test_private.pem)
7374
echo "E2E_JWT=$JWT" >> $GITHUB_ENV
74-
- name: Cache Astarte E2E deps
75-
uses: actions/cache@v4
76-
with:
77-
path: tools/astarte_e2e/deps
78-
key: e2e-deps-${{ env.otp_version }}-${{ env.elixir_version }}-${{ hashFiles(format('{0}{1}{2}', github.workspace, '/tools/astarte_e2e', '/mix.lock')) }}
79-
- name: Cache Astarte E2E build
80-
uses: actions/cache@v4
81-
with:
82-
path: tools/astarte_e2e/_build
83-
key: e2e-build-${{ env.otp_version }}-${{ env.elixir_version }}
84-
- uses: erlef/setup-beam@v1.15
85-
with:
86-
otp-version: ${{ env.otp_version }}
87-
elixir-version: ${{ env.elixir_version }}
88-
- name: Build Astarte E2E
89-
working-directory: tools/astarte_e2e
90-
run: |
91-
mix deps.get
92-
mix compile --warnings-as-errors --force
75+
9376
- name: Run Astarte E2E
9477
working-directory: tools/astarte_e2e
9578
env:
@@ -101,7 +84,9 @@ jobs:
10184
E2E_CHECK_REPETITIONS: 5
10285
E2E_MAILER_TO_ADDRESS: mail@example.com
10386
E2E_MAIL_SUBJECT: "Subj: Astarte Notification"
104-
run: mix run --no-halt
87+
run: |
88+
mix deps.get
89+
mix run --no-halt
10590
- name: Check Docker
10691
if: ${{ failure() }}
10792
run: docker compose logs

0 commit comments

Comments
 (0)