From e4c702e0aaec24b31da3b6d593014c1086cc31ee Mon Sep 17 00:00:00 2001 From: Noah <33094578+coolreader18@users.noreply.github.com> Date: Sat, 14 Mar 2020 23:40:41 -0500 Subject: [PATCH] Add a cron job to GH Actions CI --- .github/workflows/cron-ci.yaml | 58 ++++++++++++++++++++++++++++++++++ tests/test_snippets.py | 8 +++-- 2 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/cron-ci.yaml diff --git a/.github/workflows/cron-ci.yaml b/.github/workflows/cron-ci.yaml new file mode 100644 index 000000000..492051de8 --- /dev/null +++ b/.github/workflows/cron-ci.yaml @@ -0,0 +1,58 @@ +on: + schedule: + - cron: '0 0 * * 6' + +jobs: + redox: + name: Check compilation on Redox + runs-on: ubuntu-latest + container: + image: redoxos/redoxer:latest + steps: + - uses: actions/checkout@master + - name: prepare repository for redoxer compilation + run: bash scripts/redox/uncomment-cargo.sh + - name: compile for redox + run: redoxer build --verbose + + codecov: + name: Collect code coverage data + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + - uses: actions-rs/cargo@v1 + with: + command: build + args: --verbose + env: + CARGO_INCREMENTAL: '0' + RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads' + - uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install pipenv + run: | + python -V + python -m pip install --upgrade pip + python -m pip install pipenv + - run: pipenv install + working-directory: ./tests + - name: run snippets + run: pipenv run pytest -v + working-directory: ./tests + env: + RUSTPYTHON_DEBUG: 'true' + - name: run cpython tests + run: cargo run -- -m test -v + env: + RUSTPYTHONPATH: ${{ github.workspace }}/Lib + - uses: actions-rs/grcov@v0.1 + id: coverage + - name: upload to Codecov + uses: codecov/codecov-action@v1 + with: + file: ${{ steps.coverage.outputs.report }} diff --git a/tests/test_snippets.py b/tests/test_snippets.py index 8cc6f49c6..9c2bb8f4e 100644 --- a/tests/test_snippets.py +++ b/tests/test_snippets.py @@ -49,7 +49,8 @@ def run_via_cpython(filename): env = os.environ.copy() subprocess.check_call([sys.executable, filename], env=env) -RUST_TARGET = "debug" if os.environ.get("CODE_COVERAGE", "false") == "true" else "release" +RUST_DEBUG = os.environ.get("RUSTPYTHON_DEBUG") == "true" +RUST_PROFILE = "debug" if RUST_DEBUG else "release" def run_via_rustpython(filename, test_type): env = os.environ.copy() @@ -57,7 +58,7 @@ def run_via_rustpython(filename, test_type): env['RUST_BACKTRACE'] = '1' env['PYTHONPATH'] = RUSTPYTHON_LIB_DIR - binary = os.path.abspath(os.path.join(ROOT_DIR, "target", RUST_TARGET, "rustpython")) + binary = os.path.abspath(os.path.join(ROOT_DIR, "target", RUST_PROFILE, "rustpython")) subprocess.check_call([binary, filename], env=env) @@ -134,7 +135,8 @@ class SampleTestCase(unittest.TestCase): generate_slices(cls.slices_resource_path) # cargo stuff - subprocess.check_call(["cargo", "build", "--{}".format(RUST_TARGET)]) + profile_args = [] if RUST_DEBUG else ["--release"] + subprocess.check_call(["cargo", "build", *profile_args]) @classmethod def tearDownClass(cls):