Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support to build and test the cross-compiler docker images. #762

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/actions/build_export_docker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Build and export docker image"
description: "Builds and exports the docker images required by Parsec CI"
inputs:
image-name:
required: true
description: "Docker image name"

runs:
using: "composite"
steps:
- name: Build the docker container
run: pushd e2e_tests/docker_image && docker build -t ${{ inputs.image-name }} -f ${{ inputs.image-name }}.Dockerfile . && popd
shell: bash
- name: Export the docker container
run: docker save ${{ inputs.image-name }} | gzip > /tmp/${{ inputs.image-name }}.tar
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.image-name }}
path: /tmp/${{ inputs.image-name }}.tar
54 changes: 37 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,41 @@ on:
pull_request:
workflow_dispatch:
inputs:
trigger_docker:
trigger_test_all_docker:
description: "'parsec-service-test-all' if docker build should be triggered"
required: false
default: ""
trigger_test_cross_docker:
description: "'parsec-service-test-cross-compile' if docker build should be triggered"
required: false
default: ""

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

jobs:
build-and-export-test-all-docker:
runs-on: ubuntu-latest
# For running this job we need to manually trigger the CI and set the variable
if: ${{ github.event.inputs.trigger_docker == 'parsec-service-test-all' }}
if: ${{ github.event.inputs.trigger_test_all_docker == 'parsec-service-test-all' }}
steps:
- uses: actions/checkout@v3
- name: Build the docker container
run: pushd e2e_tests/docker_image && docker build -t parsec-service-test-all -f parsec-service-test-all.Dockerfile . && popd
- name: Export the docker container
run: docker save parsec-service-test-all > /tmp/parsec-service-test-all.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
- name: Build and Export Docker Image
uses: ./.github/actions/build_export_docker
with:
name: parsec-service-test-all
path: /tmp/parsec-service-test-all.tar
image-name: "parsec-service-test-all"

build-and-export-cross-compile-docker:
runs-on: ubuntu-latest
# For running this job we need to manually trigger the CI and set the variable
if: ${{ github.event.inputs.trigger_test_cross_docker == 'parsec-service-test-cross-compile' }}
steps:
- uses: actions/checkout@v3
- name: Build and Export Docker Image
uses: ./.github/actions/build_export_docker
with:
image-name: "parsec-service-test-cross-compile"

all-providers:
name: Various tests targeting a Parsec image with all providers included
Expand Down Expand Up @@ -165,13 +176,22 @@ jobs:
# Currently only the Mbed Crypto, PKCS 11, and TPM providers are tested as the other ones need to cross-compile other libraries.
name: Cross-compile Parsec to various targets
runs-on: ubuntu-latest
if: ${{ always() }}
needs: [build-and-export-cross-compile-docker]
steps:
- uses: actions/checkout@v2
- name: Run the container to execute the test script
run:
docker run -v $(pwd):/tmp/parsec -w /tmp/parsec ghcr.io/parallaxsecond/parsec-service-test-cross-compile /tmp/parsec/test/cross-compile.sh
# When running the container built on the CI
# run: docker run -v $(pwd):/tmp/parsec -w /tmp/parsec -t parsec-service-test-cross-compile /tmp/parsec/test/cross-compile.sh
- uses: actions/checkout@v3
- name: Load Docker
uses: ./.github/actions/load_docker
if: ${{ env.TEST_CROSS_DOCKER_IMAGE == 'parsec-service-test-cross-compile' }}
with:
image-name: "${{ env.TEST_CROSS_DOCKER_IMAGE }}"
image-path: "/tmp"
- name: Run the cross compiler tests using pre-built docker image
if: ${{ env.TEST_CROSS_DOCKER_IMAGE != 'parsec-service-test-cross-compile' }}
run: docker run -v $(pwd):/tmp/parsec -w /tmp/parsec ghcr.io/parallaxsecond/parsec-service-test-cross-compile /tmp/parsec/test/cross-compile.sh
- name: Run the cross compiler tests using image built on the CI
if: ${{ env.TEST_CROSS_DOCKER_IMAGE == 'parsec-service-test-cross-compile' }}
run: docker run -v $(pwd):/tmp/parsec -w "${{ env.TEST_CROSS_DOCKER_IMAGE }}" /tmp/parsec/test/cross-compile.sh

links:
name: Check links
Expand Down
Loading