From f7e5d5e55c21de9a2f89180b343d08f8a27bae11 Mon Sep 17 00:00:00 2001 From: Mikail Bagishov Date: Mon, 3 May 2021 23:45:34 +0300 Subject: [PATCH] Add basic integration tests --- .github/workflows/ci.yaml | 38 ++++++++++++++++++++++++++++++++++++++ bors.toml | 2 +- ci/config.yaml | 2 -- ci/e2e-build.sh | 6 ++++++ ci/e2e-run.sh | 11 +++++++++++ 5 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 ci/e2e-build.sh create mode 100644 ci/e2e-run.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8d79803..4c7e78b 100755 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,6 +25,44 @@ jobs: run: scan-build -o analyzer-report make -C jtl/cmake-build -j4 - name: Check that report is empty run: '[ -z "$(ls -A analyzer-report)" ]' + e2e-build: + env: + DOCKER_BUILDKIT: "1" + runs-on: ubuntu-20.04 + timeout-minutes: 15 + steps: + - name: Fetch sources + uses: actions/checkout@v2 + - name: Setup cache + uses: Swatinem/rust-cache@v1 + - name: Build e2e artifacts + run: bash ci/e2e-build.sh + - name: Upload e2e artifacts + uses: actions/upload-artifact@v2 + with: + name: e2e-artifacts + path: e2e-artifacts + retention-days: "2" + e2e-run: + needs: e2e-build + runs-on: ubuntu-20.04 + timeout-minutes: 15 + steps: + - name: Fetch sources + uses: actions/checkout@v2 + - name: Download e2e artifacts + uses: actions/download-artifact@v2 + with: + name: e2e-artifacts + path: e2e-artifacts + - name: Execute tests + run: bash ci/e2e-run.sh + - name: Upload logs + uses: actions/upload-artifact@v2 + with: + name: e2e-logs + path: e2e-logs + retention-days: "2" misspell: runs-on: ubuntu-20.04 timeout-minutes: 2 diff --git a/bors.toml b/bors.toml index b709968..6322eaa 100755 --- a/bors.toml +++ b/bors.toml @@ -1,3 +1,3 @@ delete-merged-branches = true -status = ["check-ci-config", "rustfmt", "rust-unit-tests", "rust-unused-deps", "rust-cargo-deny", "rust-lint", "cpp-lint"] +status = ["check-ci-config", "e2e-build", "e2e-run", "rustfmt", "rust-unit-tests", "rust-unused-deps", "rust-cargo-deny", "rust-lint", "cpp-lint"] timeout-sec = 900 diff --git a/ci/config.yaml b/ci/config.yaml index 9a48be1..3962a95 100644 --- a/ci/config.yaml +++ b/ci/config.yaml @@ -1,5 +1,3 @@ -# TODO: integration tests -noE2e: true # TODO: add artifacts noPublish: true buildTimeoutMinutes: 15 diff --git a/ci/e2e-build.sh b/ci/e2e-build.sh new file mode 100644 index 0000000..b73ae7a --- /dev/null +++ b/ci/e2e-build.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euxo pipefail + +mkdir e2e-artifacts +cargo install --path cli +cp ~/.cargo/bin/pps-cli e2e-artifacts/pps-cli \ No newline at end of file diff --git a/ci/e2e-run.sh b/ci/e2e-run.sh new file mode 100644 index 0000000..27f49b9 --- /dev/null +++ b/ci/e2e-run.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -euxo pipefail + +sudo chmod +x ./e2e-artifacts/pps-cli + +python3 make-build-env.py --out $HOME/build-env +export JJS_PATH=$HOME/build-env +for i in a-plus-b array-sum sqrt; do + mkdir -p ./out/$i + ./e2e-artifacts/pps-cli compile --pkg example-problems/$i --out ./out/$i +done