Skip to content

Commit

Permalink
Merge branch 'master' into mulWad-proofs
Browse files Browse the repository at this point in the history
  • Loading branch information
F-WRunTime authored Sep 29, 2023
2 parents a113156 + d49aba6 commit 2ff5a86
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 39 deletions.
33 changes: 33 additions & 0 deletions .github/actions/with-docker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'With Docker'
description: 'Run a given stage with Docker Image'
inputs:
container-version:
description: 'Docker Image Version'
required: true
container-name:
description: 'Docker Container Name'
required: true
runs:
using: 'composite'
steps:
- name: 'Set up Docker'
shell: bash {0}
run: |
set -euxo pipefail
CONTAINER_NAME=${{inputs.container-name}}
CONTAINER_VERSION=${{inputs.container-version}}
docker run \
--name ${CONTAINER_NAME} \
--rm \
--interactive \
--tty \
--detach \
--user root \
--workdir /home/user/workspace \
runtimeverificationinc/kontrol:ubuntu-jammy-${CONTAINER_VERSION}
# Copy the current Checkout direcotry into the container
docker cp . ${CONTAINER_NAME}:/home/user/workspace
docker exec ${CONTAINER_NAME} chown -R user:user /home/user
67 changes: 29 additions & 38 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: 'Update Version'
name: 'Test PR'
on:
pull_request:
branches:
Expand All @@ -11,52 +11,43 @@ concurrency:
cancel-in-progress: true

jobs:
set-image-version:
name: 'Set Image Version'
runs-on: [self-hosted, linux, flyweight]
outputs:
image-version: ${{ steps.image-version.outputs.kontrol_version }}
steps:
- name: 'Check out code'
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 'Set Image Version'
id: image-version
run: |
kontrol_version=$(cat deps/kontrol_release)
echo "kontrol_version=${kontrol_version}" >> $GITHUB_ENV
new-version-test:
name: 'Test Tool Update'
name: 'Test Proofs'
runs-on: [self-hosted, linux, normal]
needs: [set-image-version]
container:
image: runtimeverificationinc/kontrol:ubuntu-jammy-${{ needs.set-image-version.outputs.image-version }}
steps:
- name: 'Check out code'
uses: actions/checkout@v3
with:
token: ${{ secrets.JENKINS_GITHUB_PAT }}
fetch-depth: 0

- name: 'Configure GitHub user'
- name: 'Get Kontrol Version'
run: |
git config user.name devops
git config user.email [email protected]
set -euo pipefail
# Get the version of the tool from the Dockerfile
echo "kontrol-version=$(cat deps/kontrol_release)" >> $GITHUB_ENV
# Get Repository Base name
echo "repository_basename=$(basename ${{ github.repository }})" >> $GITHUB_ENV
- name: "Start Docker Container"
uses: ./.github/actions/with-docker
with:
container-name: '${{ env.repository_basename }}-ci'
container-version: '${{ env.kontrol-version }}'

- name: 'Test New Tool Versions'
run: |
set -euo pipefail
new-version=$(cat deps/kontrol_release)
kup install --version ${new-version}
# If all scripts in test.sh pass then the test is successful, else fail
# and print the name of the script that failed
for script in ./tests/*.sh; do
if ! bash "$script"; then
echo "Test failed: $script"
exit 1
else
echo "Test passed: $script"
fi
done
# Run the following in the running docker container
docker exec -u user ${{ env.repository_basename }}-ci bash -c '
set -euo pipefail
# If all scripts in test.sh pass then the test is successful, else fail
# and print the name of the script that failed
for script in ./test/*.sh; do
if ! bash "$script"; then
echo "Test failed: $script"
exit 1
else
echo "Test passed: $script"
fi
done
'
2 changes: 1 addition & 1 deletion deps/kontrol_release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.8
0.1.11

0 comments on commit 2ff5a86

Please sign in to comment.