-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test: Add basic ci script and test files
This patch only adds rudimentary files for the CI and test setup. A comprehensive PR with detailed setup will be added later. Signed-off-by: Gowtham Suresh Kumar <[email protected]>
- Loading branch information
1 parent
577ea32
commit 7923102
Showing
5 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: "Load docker image" | ||
description: "Load docker image" | ||
inputs: | ||
image-name: | ||
required: true | ||
description: "Docker image name" | ||
image-path: | ||
required: true | ||
description: "Path to save the docker image" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ inputs.image-name }} | ||
path: ${{ inputs.image-path }} | ||
- name: Load image | ||
run: docker load --input ${{ inputs.image-path }}/${{ inputs.image-name }}.tar | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
inputs: | ||
trigger_docker: | ||
description: "'parsec-openssl-provider-test' if docker build should be triggered" | ||
required: false | ||
default: "" | ||
push: | ||
|
||
env: | ||
TEST_DOCKER_IMAGE: ${{ github.event.inputs.trigger_docker || 'ghcr.io/parallaxsecond/parsec-openssl-provider-test' }} | ||
|
||
jobs: | ||
build-and-export-test-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-openssl-provider-test' }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build the docker container | ||
run: pushd tests/docker_image && docker build -t parsec-openssl-provider-test -f parsec-openssl-provider-test.Dockerfile . && popd | ||
- name: Export the docker container | ||
run: docker save parsec-openssl-provider-test > /tmp/parsec-openssl-provider-test.tar | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: parsec-openssl-provider-test | ||
path: /tmp/parsec-openssl-provider-test.tar | ||
|
||
build-and-test: | ||
name: Build Parsec OpenSSL Provider and run tests | ||
runs-on: ubuntu-latest | ||
if: ${{ always() }} | ||
needs: [build-and-export-test-docker] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Load Docker | ||
uses: ./.github/actions/load_docker | ||
if: ${{ env.TEST_DOCKER_IMAGE == 'parsec-openssl-provider-test' }} | ||
with: | ||
image-name: "${{ env.TEST_DOCKER_IMAGE }}" | ||
image-path: "/tmp" | ||
- name: Run the container to execute the test script | ||
run: | ||
docker run -v $(pwd):/tmp/parsec-openssl-provider -w /tmp/parsec-openssl-provider -t ${{ env.TEST_DOCKER_IMAGE }} ./ci.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/target | ||
Cargo.lock | ||
.vscode | ||
*/Cargo.lock | ||
*/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2023 Contributors to the Parsec project. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -ex | ||
|
||
# Build parsec provider shared library | ||
pushd parsec-openssl-provider-shared/ && | ||
cargo build | ||
|
||
# Try loading the build parsec provider | ||
openssl version | ||
openssl list -providers -provider-path ./target/debug/ -provider libparsec_openssl_provider_shared |
30 changes: 30 additions & 0 deletions
30
tests/docker_image/parsec-openssl-provider-test.Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright 2023 Contributors to the Parsec project. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
FROM ubuntu:22.04 | ||
|
||
RUN apt-get update && apt-get -y upgrade | ||
RUN apt install -y autoconf-archive libcmocka0 libcmocka-dev procps | ||
RUN apt install -y iproute2 build-essential git pkg-config gcc libtool automake libssl-dev uthash-dev doxygen libjson-c-dev | ||
RUN apt install -y --fix-missing wget python3 cmake clang | ||
RUN apt install -y libini-config-dev libcurl4-openssl-dev curl libgcc1 | ||
RUN apt install -y python3-distutils libclang-11-dev protobuf-compiler python3-pip | ||
RUN apt install -y libgcrypt20-dev uuid-dev | ||
RUN apt install -y libssl-dev git gcc openssl | ||
|
||
# Setup git config | ||
RUN git config --global user.email "[email protected]" | ||
RUN git config --global user.name "Parsec Team" | ||
|
||
WORKDIR /tmp | ||
|
||
# Install Rust toolchain for all users | ||
# This way of installing allows all users to call the same binaries, but non-root | ||
# users cannot modify the toolchains or install new ones. | ||
# See: https://github.com/rust-lang/rustup/issues/1085 | ||
ENV RUSTUP_HOME /opt/rust | ||
ENV CARGO_HOME /opt/rust | ||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path | ||
ENV PATH="/root/.cargo/bin:/opt/rust/bin:${PATH}" | ||
|
||
# For running tests Parsec is configured with the socket in /tmp/ | ||
ENV PARSEC_SERVICE_ENDPOINT="unix:/tmp/parsec.sock" |