-
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.
Related: #1 * Add smoke tests * Add test workflow
- Loading branch information
1 parent
2fc986d
commit dae8048
Showing
6 changed files
with
150 additions
and
7 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,20 @@ | ||
ARG K_VERSION | ||
FROM runtimeverificationinc/kframework-k:ubuntu-jammy-${K_VERSION} | ||
|
||
RUN apt-get update \ | ||
&& apt-get upgrade --yes \ | ||
&& apt-get install --yes \ | ||
curl \ | ||
&& apt-get clean | ||
|
||
ARG USER=user | ||
ARG GROUP=$USER | ||
ARG USER_ID=1000 | ||
ARG GROUP_ID=$USER_ID | ||
|
||
RUN groupadd -g $GROUP_ID $GROUP && useradd -m -u $USER_ID -s /bin/sh -g $GROUP $USER | ||
|
||
USER $USER:$GROUP | ||
|
||
ENV PATH=/home/$USER/.local/bin:$PATH | ||
RUN curl -sSL https://install.python-poetry.org | python3 - |
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,46 @@ | ||
name: 'With Docker' | ||
description: 'Start a Docker container with the K development environment set up' | ||
inputs: | ||
container-name: | ||
description: 'Docker container name to use' | ||
required: true | ||
type: string | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: 'Set up Docker' | ||
shell: bash {0} | ||
run: | | ||
set -euxo pipefail | ||
CONTAINER_NAME=${{ inputs.container-name }} | ||
TAG=runtimeverificationinc/${CONTAINER_NAME} | ||
DOCKERFILE=${{ github.action_path }}/Dockerfile | ||
K_VERSION=$(cat deps/k_release) | ||
docker build . \ | ||
--file ${DOCKERFILE} \ | ||
--build-arg K_VERSION=${K_VERSION} \ | ||
--tag ${TAG} | ||
- name: 'Run Docker container' | ||
shell: bash {0} | ||
run: | | ||
set -euxo pipefail | ||
CONTAINER_NAME=${{ inputs.container-name }} | ||
TAG=runtimeverificationinc/${CONTAINER_NAME} | ||
WORKDIR=/home/user | ||
docker run \ | ||
--name ${CONTAINER_NAME} \ | ||
--rm \ | ||
--interactive \ | ||
--tty \ | ||
--detach \ | ||
--user root \ | ||
--workdir ${WORKDIR} \ | ||
${TAG} | ||
docker cp . ${CONTAINER_NAME}:${WORKDIR} | ||
docker exec ${CONTAINER_NAME} chown -R user:user ${WORKDIR} |
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,65 @@ | ||
name: 'Test PR' | ||
on: | ||
pull_request: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
code-quality-checks: | ||
name: 'Code Quality Checks & Unit Tests' | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
defaults: | ||
run: | ||
working-directory: kimp | ||
steps: | ||
- name: 'Check out code' | ||
uses: actions/checkout@v4 | ||
- name: 'Install Python' | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- name: 'Install Poetry' | ||
uses: Gr1N/setup-poetry@v9 | ||
- name: 'Run code quality checks' | ||
run: make check | ||
- name: 'Run pyupgrade' | ||
run: make pyupgrade | ||
- name: 'Run unit tests' | ||
run: make cov-unit | ||
|
||
integration-tests: | ||
name: 'Integration Tests' | ||
runs-on: [self-hosted, linux, normal] | ||
timeout-minutes: 5 | ||
env: | ||
CONTAINER: imp-integration-${{ github.sha }} | ||
steps: | ||
- name: 'Check out code' | ||
uses: actions/checkout@v4 | ||
- name: 'Set up Docker' | ||
uses: ./.github/actions/with-docker | ||
with: | ||
container-name: ${CONTAINER} | ||
- name: 'Build and run integration tests' | ||
run: docker exec -u user ${CONTAINER} make -C kimp cov-integration | ||
- name: 'Tear down Docker container' | ||
if: always() | ||
run: | | ||
docker stop --time=0 ${CONTAINER} | ||
docker-tests: | ||
name: 'Docker Tests' | ||
runs-on: [self-hosted, linux, normal] | ||
timeout-minutes: 5 | ||
env: | ||
TAG: ${{ github.sha }} | ||
CONTAINER: imp-docker-${{ github.sha }} | ||
steps: | ||
- name: 'Check out code' | ||
uses: actions/checkout@v4 | ||
- name: 'Build Docker image' | ||
run: make docker TAG=${TAG} | ||
- name: 'Run smoke tests' | ||
run: docker run --rm --name ${CONTAINER} ${TAG} ./smoke-test.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
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
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,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
kimp --help | ||
|
||
kimp run --verbose --input-file examples/sumto10.imp | ||
|
||
kimp prove --verbose examples/specs/imp-sum-spec.k IMP-SUM-SPEC sum-spec | ||
|
||
kimp show --verbose IMP-SUM-SPEC sum-spec |