Skip to content

Commit 1f3d23a

Browse files
committed
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 <gowtham.sureshkumar@arm.com>
1 parent 577ea32 commit 1f3d23a

File tree

5 files changed

+120
-0
lines changed

5 files changed

+120
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "Load docker image"
2+
description: "Load docker image"
3+
inputs:
4+
image-name:
5+
required: true
6+
description: "Docker image name"
7+
image-path:
8+
required: true
9+
description: "Path to save the docker image"
10+
11+
runs:
12+
using: "composite"
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Download artifact
16+
uses: actions/download-artifact@v3
17+
with:
18+
name: ${{ inputs.image-name }}
19+
path: ${{ inputs.image-path }}
20+
- name: Load image
21+
run: docker load --input ${{ inputs.image-path }}/${{ inputs.image-name }}.tar
22+
shell: bash

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Continuous Integration
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
inputs:
7+
trigger_docker:
8+
description: "'parsec-openssl-provider-test' if docker build should be triggered"
9+
required: false
10+
default: ""
11+
push:
12+
13+
env:
14+
TEST_DOCKER_IMAGE: ${{ github.event.inputs.trigger_docker || 'ghcr.io/parallaxsecond/parsec-openssl-provider-test' }}
15+
16+
jobs:
17+
build-and-export-test-docker:
18+
runs-on: ubuntu-latest
19+
# For running this job we need to manually trigger the CI and set the variable
20+
if: ${{ github.event.inputs.trigger_docker == 'parsec-openssl-provider-test' }}
21+
steps:
22+
- uses: actions/checkout@v3
23+
- name: Build the docker container
24+
run: pushd tests/docker_image && docker build -t parsec-openssl-provider-test -f parsec-openssl-provider-test.Dockerfile . && popd
25+
- name: Export the docker container
26+
run: docker save parsec-openssl-provider-test > /tmp/parsec-openssl-provider-test.tar
27+
- name: Upload artifact
28+
uses: actions/upload-artifact@v3
29+
with:
30+
name: parsec-openssl-provider-test
31+
path: /tmp/parsec-openssl-provider-test.tar
32+
33+
build-and-test:
34+
name: Build Parsec OpenSSL Provider and run tests
35+
runs-on: ubuntu-latest
36+
if: ${{ always() }}
37+
needs: [build-and-export-test-docker]
38+
steps:
39+
- uses: actions/checkout@v3
40+
- name: Load Docker
41+
uses: ./.github/actions/load_docker
42+
if: ${{ env.TEST_DOCKER_IMAGE == 'parsec-openssl-provider-test' }}
43+
with:
44+
image-name: "${{ env.TEST_DOCKER_IMAGE }}"
45+
image-path: "/tmp"
46+
- name: Run the container to execute the test script
47+
run:
48+
docker run -v $(pwd):/tmp/parsec-openssl-provider -w /tmp/parsec-openssl-provider -t ${{ env.TEST_DOCKER_IMAGE }} ./ci.sh

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/target
2+
Cargo.lock
3+
.vscode
4+
*/Cargo.lock
5+
*/target

ci.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2023 Contributors to the Parsec project.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
set -ex
7+
8+
# Build parsec provider shared library
9+
pushd parsec-openssl-provider-shared/ &&
10+
cargo build
11+
popd
12+
13+
# Try loading the build parsec provider
14+
openssl version
15+
openssl list -providers -provider-path ./target/debug/ -provider libparsec_openssl_provider_shared
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2023 Contributors to the Parsec project.
2+
# SPDX-License-Identifier: Apache-2.0
3+
FROM ubuntu:22.04
4+
5+
RUN apt-get update && apt-get -y upgrade
6+
RUN apt install -y autoconf-archive libcmocka0 libcmocka-dev procps
7+
RUN apt install -y iproute2 build-essential git pkg-config gcc libtool automake libssl-dev uthash-dev doxygen libjson-c-dev
8+
RUN apt install -y --fix-missing wget python3 cmake clang
9+
RUN apt install -y libini-config-dev libcurl4-openssl-dev curl libgcc1
10+
RUN apt install -y python3-distutils libclang-11-dev protobuf-compiler python3-pip
11+
RUN apt install -y libgcrypt20-dev uuid-dev
12+
RUN apt install -y libssl-dev git gcc openssl
13+
14+
# Setup git config
15+
RUN git config --global user.email "some@email.com"
16+
RUN git config --global user.name "Parsec Team"
17+
18+
WORKDIR /tmp
19+
20+
# Install Rust toolchain for all users
21+
# This way of installing allows all users to call the same binaries, but non-root
22+
# users cannot modify the toolchains or install new ones.
23+
# See: https://github.com/rust-lang/rustup/issues/1085
24+
ENV RUSTUP_HOME /opt/rust
25+
ENV CARGO_HOME /opt/rust
26+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path
27+
ENV PATH="/root/.cargo/bin:/opt/rust/bin:${PATH}"
28+
29+
# For running tests Parsec is configured with the socket in /tmp/
30+
ENV PARSEC_SERVICE_ENDPOINT="unix:/tmp/parsec.sock"

0 commit comments

Comments
 (0)