Skip to content

Commit

Permalink
Add CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tothtamas28 committed May 10, 2024
1 parent c7a190b commit 1f54bac
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/actions/with-docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ARG K_VERSION
FROM runtimeverificationinc/kframework-k:ubuntu-jammy-${K_VERSION}

ARG PYTHON_VERSION=3.10

RUN apt-get -y update \
&& apt-get -y install \
graphviz \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
&& apt-get -y clean

ARG USER_ID=9876
ARG GROUP_ID=9876
RUN groupadd -g ${GROUP_ID} user \
&& useradd -m -u ${USER_ID} -s /bin/bash -g user user

USER user
WORKDIR /home/user

ENV PATH=/home/user/.local/bin:${PATH}
RUN curl -sSL https://install.python-poetry.org | python3 -
36 changes: 36 additions & 0 deletions .github/actions/with-docker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'With Docker'
description: 'Run a given stage with Docker Image'
inputs:
container-name:
description: 'Docker container name to use'
type: string
required: true
runs:
using: 'composite'
steps:
- name: 'Set up Docker'
shell: bash {0}
run: |
set -euxo pipefail
CONTAINER_NAME=${{ inputs.container-name }}
TAG=runtimeverificationinc/${CONTAINER_NAME}
K_VERSION=$(cat deps/k_release)
docker build . \
--file .github/actions/with-docker/Dockerfile \
--tag ${TAG} \
--build-arg K_VERSION=${K_VERSION}
docker run \
--name ${CONTAINER_NAME} \
--rm \
--interactive \
--tty \
--detach \
--user root \
--workdir /home/user \
${TAG}
docker cp . ${CONTAINER_NAME}:/home/user
docker exec ${CONTAINER_NAME} chown -R user:user /home/user
39 changes: 39 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,42 @@ jobs:
git add --update && git commit --message "Set Version: ${new_version}" || true
- name: 'Push updates'
run: git push origin HEAD:${GITHUB_HEAD_REF}

code-quality-checks:
needs: version-bump
name: 'Code Quality Checks'
runs-on: [self-hosted, linux, flyweight]
steps:
- name: 'Check out code'
uses: actions/checkout@v3
- name: 'Run code quality checks'
run: make check
- name: 'Run pyupgrade'
run: make pyupgrade
- name: 'Run unit tests'
run: make test-unit

integration-tests:
needs: code-quality-checks
name: 'Integration Tests'
runs-on: [self-hosted, linux, normal]
env:
CONTAINER: ksoroban-integration-${{ github.sha }}
steps:
- name: 'Check out code'
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 'Set up Docker'
uses: ./.github/actions/with-docker
with:
container-name: ${CONTAINER}
- name: 'Build ksoroban'
run: docker exec --user user ${CONTAINER} poetry install
- name: 'Build semantics'
run: docker exec --user user ${CONTAINER} make kdist-build
- name: 'Run integration tests'
run: docker exec --user user ${CONTAINER} make test-integration
- name: 'Tear down Docker'
if: always()
run: docker stop --time=0 ${CONTAINER}

0 comments on commit 1f54bac

Please sign in to comment.