Skip to content

Commit f738298

Browse files
committed
test sequential workflows
Signed-off-by: Eddy Babetto <eddy.babetto@secomind.com>
1 parent 9a903ea commit f738298

File tree

1 file changed

+64
-52
lines changed

1 file changed

+64
-52
lines changed

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

Lines changed: 64 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Astarte end-to-end test
1+
name: Astarte end-to-end build
22

33
on:
44
# Run when pushing to stable branches
@@ -24,62 +24,74 @@ env:
2424
otp_version: "26.1"
2525

2626
jobs:
27-
end-to-end-test:
28-
name: End-to-end Test
27+
end-to-end-build:
28+
name: End-to-end build
2929
runs-on: ubuntu-22.04
3030
steps:
3131
- uses: actions/checkout@v2
32-
- name: Initialize docker compose files
33-
run: docker run -v $(pwd)/compose:/compose astarte/docker-compose-initializer
3432
- name: Build Astarte containers
3533
run: docker compose build --parallel
36-
- name: Start all Astarte services
37-
run: docker compose up -d
38-
- name: Wait for Astarte to come up
39-
run: |
40-
wget https://github.com/astarte-platform/wait-for-astarte-docker-compose/releases/download/v1.1.0/wait-for-astarte-docker-compose_1.1.0_linux_amd64.tar.gz
41-
tar xf wait-for-astarte-docker-compose_1.1.0_linux_amd64.tar.gz
42-
./wait-for-astarte-docker-compose
43-
- name: Install astartectl
44-
run: |
45-
wget https://github.com/astarte-platform/astartectl/releases/download/v22.11.02/astartectl_22.11.02_linux_x86_64.tar.gz
46-
tar xf astartectl_22.11.02_linux_x86_64.tar.gz
47-
chmod +x astartectl
48-
- name: Create realm
49-
run: |
50-
./astartectl utils gen-keypair test
51-
./astartectl housekeeping realms create test --astarte-url http://api.astarte.localhost --realm-public-key test_public.pem -k compose/astarte-keys/housekeeping_private.pem -y
52-
echo "E2E_REALM=test" >> $GITHUB_ENV
53-
sleep 5
54-
- name: Install e2e test interfaces
55-
run: |
56-
for i in $(ls tools/astarte_e2e/priv/interfaces/); do
57-
echo "Installing $i"
58-
./astartectl realm-management interfaces install tools/astarte_e2e/priv/interfaces/$i --astarte-url http://api.astarte.localhost -k test_private.pem -r $E2E_REALM
59-
sleep 2
60-
done
61-
- name: Register device
62-
run: |
63-
DEVICE_ID=$(./astartectl utils device-id generate-random)
64-
echo "E2E_DEVICE_ID=$DEVICE_ID" >> $GITHUB_ENV
65-
CREDENTIALS_SECRET=$(./astartectl pairing agent register $DEVICE_ID --astarte-url http://api.astarte.localhost -k test_private.pem -r $E2E_REALM | grep "Credentials Secret is" | cut -d '"' -f 2)
66-
echo "E2E_CREDENTIALS_SECRET=$CREDENTIALS_SECRET" >> $GITHUB_ENV
67-
- name: Generate AppEngine JWT
68-
run: |
69-
JWT=$(./astartectl utils gen-jwt appengine channels -k test_private.pem)
70-
echo "E2E_JWT=$JWT" >> $GITHUB_ENV
71-
- uses: actions/cache@v4
72-
with:
73-
path: tools/astarte_e2e/deps
74-
key: deps-${{ env.otp_version }}-${{ env.elixir_version }}-${{ hashFiles(format('{0}{1}{2}', github.workspace, '/tools/astarte_e2e', '/mix.lock')) }}
75-
- uses: actions/cache@v4
76-
with:
77-
path: tools/astarte_e2e/_build
78-
key: build-${{ env.otp_version }}-${{ env.elixir_version }}
79-
- uses: erlef/setup-beam@v1.15
80-
with:
81-
otp-version: ${{ env.otp_version }}
82-
elixir-version: ${{ env.elixir_version }}
34+
end-to-end-init:
35+
needs: end-to-end-build
36+
name: End-to-end init
37+
runs-on: ubuntu-22.04
38+
steps:
39+
- uses: actions/checkout@v2
40+
- name: Initialize docker compose files
41+
run: docker run -v $(pwd)/compose:/compose astarte/docker-compose-initializer
42+
- name: Start all Astarte services
43+
run: docker compose up -d
44+
- name: Wait for Astarte to come up
45+
run: |
46+
wget https://github.com/astarte-platform/wait-for-astarte-docker-compose/releases/download/v1.1.0/wait-for-astarte-docker-compose_1.1.0_linux_amd64.tar.gz
47+
tar xf wait-for-astarte-docker-compose_1.1.0_linux_amd64.tar.gz
48+
./wait-for-astarte-docker-compose
49+
- name: Install astartectl
50+
run: |
51+
wget https://github.com/astarte-platform/astartectl/releases/download/v22.11.02/astartectl_22.11.02_linux_x86_64.tar.gz
52+
tar xf astartectl_22.11.02_linux_x86_64.tar.gz
53+
chmod +x astartectl
54+
- name: Create realm
55+
run: |
56+
./astartectl utils gen-keypair test
57+
./astartectl housekeeping realms create test --astarte-url http://api.astarte.localhost --realm-public-key test_public.pem -k compose/astarte-keys/housekeeping_private.pem -y
58+
echo "E2E_REALM=test" >> $GITHUB_ENV
59+
sleep 5
60+
- name: Install e2e test interfaces
61+
run: |
62+
for i in $(ls tools/astarte_e2e/priv/interfaces/); do
63+
echo "Installing $i"
64+
./astartectl realm-management interfaces install tools/astarte_e2e/priv/interfaces/$i --astarte-url http://api.astarte.localhost -k test_private.pem -r $E2E_REALM
65+
sleep 2
66+
done
67+
- name: Register device
68+
run: |
69+
DEVICE_ID=$(./astartectl utils device-id generate-random)
70+
echo "E2E_DEVICE_ID=$DEVICE_ID" >> $GITHUB_ENV
71+
CREDENTIALS_SECRET=$(./astartectl pairing agent register $DEVICE_ID --astarte-url http://api.astarte.localhost -k test_private.pem -r $E2E_REALM | grep "Credentials Secret is" | cut -d '"' -f 2)
72+
echo "E2E_CREDENTIALS_SECRET=$CREDENTIALS_SECRET" >> $GITHUB_ENV
73+
- name: Generate AppEngine JWT
74+
run: |
75+
JWT=$(./astartectl utils gen-jwt appengine channels -k test_private.pem)
76+
echo "E2E_JWT=$JWT" >> $GITHUB_ENV
77+
- uses: actions/cache@v4
78+
with:
79+
path: tools/astarte_e2e/deps
80+
key: deps-${{ env.otp_version }}-${{ env.elixir_version }}-${{ hashFiles(format('{0}{1}{2}', github.workspace, '/tools/astarte_e2e', '/mix.lock')) }}
81+
- uses: actions/cache@v4
82+
with:
83+
path: tools/astarte_e2e/_build
84+
key: build-${{ env.otp_version }}-${{ env.elixir_version }}
85+
- uses: erlef/setup-beam@v1.15
86+
with:
87+
otp-version: ${{ env.otp_version }}
88+
elixir-version: ${{ env.elixir_version }}
89+
end-to-end-test:
90+
needs: end-to-end-init
91+
name: End-to-end Test
92+
runs-on: ubuntu-22.04
93+
steps:
94+
- uses: actions/checkout@v2
8395
- name: Build Astarte E2E
8496
working-directory: tools/astarte_e2e
8597
run: |

0 commit comments

Comments
 (0)