Skip to content

Commit 8dc9be3

Browse files
committed
ci: Update pipeline to use new cross compiler docker image
Signed-off-by: Gowtham Suresh Kumar <[email protected]>
1 parent 14f5bb7 commit 8dc9be3

File tree

2 files changed

+58
-17
lines changed

2 files changed

+58
-17
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: "Build and export docker image"
2+
description: "Builds and exports the docker images required by Parsec CI"
3+
inputs:
4+
image-name:
5+
required: true
6+
description: "Docker image name"
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Build the docker container
12+
run: pushd e2e_tests/docker_image && docker build -t ${{ inputs.image-name }} -f ${{ inputs.image-name }}.Dockerfile . && popd
13+
shell: bash
14+
- name: Export the docker container
15+
run: docker save ${{ inputs.image-name }} | gzip > /tmp/${{ inputs.image-name }}.tar
16+
shell: bash
17+
- name: Upload artifact
18+
uses: actions/upload-artifact@v3
19+
with:
20+
name: ${{ inputs.image-name }}
21+
path: /tmp/${{ inputs.image-name }}.tar

.github/workflows/ci.yml

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,41 @@ on:
55
pull_request:
66
workflow_dispatch:
77
inputs:
8-
trigger_docker:
8+
trigger_test_all_docker:
99
description: "'parsec-service-test-all' if docker build should be triggered"
1010
required: false
1111
default: ""
12+
trigger_test_cross_docker:
13+
description: "'parsec-service-test-cross-compile' if docker build should be triggered"
14+
required: false
15+
default: ""
1216

1317
env:
14-
TEST_ALL_DOCKER_IMAGE: ${{ github.event.inputs.trigger_docker || 'ghcr.io/parallaxsecond/parsec-service-test-all' }}
18+
TEST_ALL_DOCKER_IMAGE: ${{ github.event.inputs.trigger_test_all_docker || 'ghcr.io/parallaxsecond/parsec-service-test-all' }}
19+
TEST_CROSS_DOCKER_IMAGE: ${{ github.event.inputs.trigger_test_cross_docker || 'ghcr.io/parallaxsecond/parsec-service-test-cross-compile' }}
1520

1621
jobs:
1722
build-and-export-test-all-docker:
1823
runs-on: ubuntu-latest
1924
# For running this job we need to manually trigger the CI and set the variable
20-
if: ${{ github.event.inputs.trigger_docker == 'parsec-service-test-all' }}
25+
if: ${{ github.event.inputs.trigger_test_all_docker == 'parsec-service-test-all' }}
2126
steps:
2227
- uses: actions/checkout@v3
23-
- name: Build the docker container
24-
run: pushd e2e_tests/docker_image && docker build -t parsec-service-test-all -f parsec-service-test-all.Dockerfile . && popd
25-
- name: Export the docker container
26-
run: docker save parsec-service-test-all > /tmp/parsec-service-test-all.tar
27-
- name: Upload artifact
28-
uses: actions/upload-artifact@v3
28+
- name: Build and Export Docker Image
29+
uses: ./.github/actions/build_export_docker
2930
with:
30-
name: parsec-service-test-all
31-
path: /tmp/parsec-service-test-all.tar
31+
image-name: "parsec-service-test-all"
32+
33+
build-and-export-cross-compile-docker:
34+
runs-on: ubuntu-latest
35+
# For running this job we need to manually trigger the CI and set the variable
36+
if: ${{ github.event.inputs.trigger_test_cross_docker == 'parsec-service-test-cross-compile' }}
37+
steps:
38+
- uses: actions/checkout@v3
39+
- name: Build and Export Docker Image
40+
uses: ./.github/actions/build_export_docker
41+
with:
42+
image-name: "parsec-service-test-cross-compile"
3243

3344
all-providers:
3445
name: Various tests targeting a Parsec image with all providers included
@@ -165,13 +176,22 @@ jobs:
165176
# Currently only the Mbed Crypto, PKCS 11, and TPM providers are tested as the other ones need to cross-compile other libraries.
166177
name: Cross-compile Parsec to various targets
167178
runs-on: ubuntu-latest
179+
if: ${{ always() }}
180+
needs: [build-and-export-cross-compile-docker]
168181
steps:
169-
- uses: actions/checkout@v2
170-
- name: Run the container to execute the test script
171-
run:
172-
docker run -v $(pwd):/tmp/parsec -w /tmp/parsec ghcr.io/parallaxsecond/parsec-service-test-cross-compile /tmp/parsec/test/cross-compile.sh
173-
# When running the container built on the CI
174-
# run: docker run -v $(pwd):/tmp/parsec -w /tmp/parsec -t parsec-service-test-cross-compile /tmp/parsec/test/cross-compile.sh
182+
- uses: actions/checkout@v3
183+
- name: Load Docker
184+
uses: ./.github/actions/load_docker
185+
if: ${{ env.TEST_CROSS_DOCKER_IMAGE == 'parsec-service-test-cross-compile' }}
186+
with:
187+
image-name: "${{ env.TEST_CROSS_DOCKER_IMAGE }}"
188+
image-path: "/tmp"
189+
- name: Run the cross compiler tests using pre-built docker image
190+
if: ${{ env.TEST_CROSS_DOCKER_IMAGE != 'parsec-service-test-cross-compile' }}
191+
run: docker run -v $(pwd):/tmp/parsec -w /tmp/parsec ghcr.io/parallaxsecond/parsec-service-test-cross-compile /tmp/parsec/test/cross-compile.sh
192+
- name: Run the cross compiler tests using image built on the CI
193+
if: ${{ env.TEST_CROSS_DOCKER_IMAGE == 'parsec-service-test-cross-compile' }}
194+
run: docker run -v $(pwd):/tmp/parsec -w "${{ env.TEST_CROSS_DOCKER_IMAGE }}" /tmp/parsec/test/cross-compile.sh
175195

176196
links:
177197
name: Check links

0 commit comments

Comments
 (0)