Skip to content

Commit

Permalink
Re-organize tests on CI (#617)
Browse files Browse the repository at this point in the history
* Set Version: 0.1.37

* Update `z3` version

* Get `z3` from image layer

* Install `poetry` as non-root user

* Make dependencies less strict

* Move unit test step into `code-quality-checks`

* Merge jobs into `conformance-tests`

* Remove DockerHub login step

* Set Version: 0.1.38

---------

Co-authored-by: devops <[email protected]>
  • Loading branch information
tothtamas28 and devops authored Apr 23, 2024
1 parent 11b7b22 commit 92b3904
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 102 deletions.
101 changes: 13 additions & 88 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,104 +43,25 @@ jobs:
submodules: recursive
- name: 'Install Poetry'
uses: Gr1N/setup-poetry@v8
- name: 'Build and run code quality checks'
- name: 'Build pykwasm'
run: poetry -C pykwasm install
- name: 'Run code quality checks'
run: make -C pykwasm check
- name: 'Run pyupgrade'
run: make -C pykwasm pyupgrade

pykwasm-unit-tests:
needs: pykwasm-code-quality-checks
name: 'Unit Tests'
runs-on: ubuntu-latest
steps:
- name: 'Check out code'
uses: actions/checkout@v3
with:
submodules: recursive
- name: 'Install Poetry'
uses: Gr1N/setup-poetry@v8
- name: 'Build and run unit tests'
- name: 'Run unit tests'
run: make -C pykwasm cov-unit

pykwasm-integration-tests:
needs: pykwasm-code-quality-checks
name: 'Integration Tests'
runs-on: [self-hosted, linux, normal]
steps:
- name: 'Check out code'
uses: actions/checkout@v3
with:
submodules: recursive
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: rvdockerhub
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: 'Set up Docker'
uses: ./.github/actions/with-docker
with:
container-name: kwasm-ci-integration-${{ github.sha }}
- name: 'Build pykwasm'
run: docker exec -u user kwasm-ci-integration-${GITHUB_SHA} poetry -C pykwasm install
- name: 'Build LLVM definition'
run: docker exec -u user kwasm-ci-integration-${GITHUB_SHA} poetry -C pykwasm run kdist -v build wasm-semantics.llvm
- name: 'Build and run integration tests'
run: docker exec -u user kwasm-ci-integration-${GITHUB_SHA} make -C pykwasm cov-integration
- name: 'Tear down Docker'
if: always()
run: |
docker stop --time=0 kwasm-ci-integration-${GITHUB_SHA}
parse-tests:
needs: [pykwasm-unit-tests, pykwasm-integration-tests]
name: 'Parser Tests'
runs-on: [self-hosted, linux, normal]
timeout-minutes: 30
steps:
- name: 'Check out code'
uses: actions/checkout@v3
with:
submodules: recursive

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: rvdockerhub
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: 'Set up Docker'
uses: ./.github/actions/with-docker
with:
container-name: kwasm-ci-parse-${{ github.sha }}
- name: 'Build pykwasm'
run: docker exec -u user kwasm-ci-parse-${GITHUB_SHA} poetry -C pykwasm install
- name: 'Build LLVM definition'
run: docker exec -u user kwasm-ci-parse-${GITHUB_SHA} poetry -C pykwasm run kdist -v build wasm-semantics.llvm
- name: 'Conformance parse'
run: docker exec -u user kwasm-ci-parse-${GITHUB_SHA} make test-conformance-parse
- name: 'Tear down Docker'
if: always()
run: |
docker stop --time=0 kwasm-ci-parse-${GITHUB_SHA}
conformance-tests:
needs: [parse-tests]
name: 'Conformance Tests'
needs: pykwasm-code-quality-checks
runs-on: [self-hosted, linux, normal]
timeout-minutes: 30
steps:
- name: 'Check out code'
uses: actions/checkout@v3
with:
submodules: recursive

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: rvdockerhub
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: 'Set up Docker'
uses: ./.github/actions/with-docker
with:
Expand All @@ -149,18 +70,22 @@ jobs:
run: docker exec -u user kwasm-ci-conformance-${GITHUB_SHA} poetry -C pykwasm install
- name: 'Build LLVM definition'
run: docker exec -u user kwasm-ci-conformance-${GITHUB_SHA} poetry -C pykwasm run kdist -v build wasm-semantics.llvm
- name: 'Simple tests'
- name: 'Run integration tests'
run: docker exec -u user kwasm-ci-conformance-${GITHUB_SHA} make -C pykwasm cov-integration
- name: 'Run simple tests'
run: docker exec -u user kwasm-ci-conformance-${GITHUB_SHA} make -j2 test-simple
- name: 'Conformance run'
- name: 'Run conformance tests: run'
run: docker exec -u user kwasm-ci-conformance-${GITHUB_SHA} make -j2 test-conformance-supported
- name: 'Run conformance tests: parse'
run: docker exec -u user kwasm-ci-conformance-${GITHUB_SHA} make test-conformance-parse
- name: 'Tear down Docker'
if: always()
run: |
docker stop --time=0 kwasm-ci-conformance-${GITHUB_SHA}
prove-tests:
needs: [pykwasm-unit-tests, pykwasm-integration-tests]
name: 'Prover Tests'
needs: pykwasm-code-quality-checks
runs-on: [self-hosted, linux, normal]
timeout-minutes: 30
steps:
Expand All @@ -176,7 +101,7 @@ jobs:
run: docker exec -u user kwasm-ci-prove-${GITHUB_SHA} poetry -C pykwasm install
- name: 'Build Haskell definitions'
run: docker exec -u user kwasm-ci-prove-${GITHUB_SHA} poetry -C pykwasm run kdist -v build wasm-semantics.{kwasm-lemmas,wrc20} -j2
- name: 'Prove'
- name: 'Run prover tests'
run: docker exec -u user kwasm-ci-prove-${GITHUB_SHA} make -j6 test-prove
- name: 'Tear down Docker'
if: always()
Expand Down
23 changes: 11 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
ARG Z3_VERSION
ARG K_COMMIT

ARG Z3_VERSION=4.12.1
FROM runtimeverificationinc/z3:ubuntu-jammy-${Z3_VERSION} as Z3

ARG K_COMMIT
FROM runtimeverificationinc/kframework-k:ubuntu-jammy-${K_COMMIT}

COPY --from=Z3 /usr/bin/z3 /usr/bin/z3

RUN apt-get update \
&& apt-get upgrade --yes \
&& apt-get install --yes \
Expand All @@ -11,25 +19,16 @@ RUN apt-get update \
python3-pip \
wabt

RUN git clone 'https://github.com/z3prover/z3' --branch=z3-4.8.15 \
&& cd z3 \
&& python3 scripts/mk_make.py \
&& cd build \
&& make -j8 \
&& make install \
&& cd ../.. \
&& rm -rf z3

RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/usr python3 - \
&& poetry --version

ARG USER_ID=1000
ARG GROUP_ID=1000
RUN groupadd -g $GROUP_ID user && useradd -m -u $USER_ID -s /bin/sh -g user user

USER user:user
WORKDIR /home/user

RUN curl -sSL https://install.python-poetry.org | python3 - \
&& poetry --version

RUN pip3 install --user \
cytoolz \
numpy
Expand Down
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.37
0.1.38
2 changes: 1 addition & 1 deletion pykwasm/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "pykwasm"
version = "0.1.37"
version = "0.1.38"
description = ""
authors = [
"Runtime Verification, Inc. <[email protected]>",
Expand Down

0 comments on commit 92b3904

Please sign in to comment.