From 53d732e4b83e7c722a54e44754897bfe5bbcc02a Mon Sep 17 00:00:00 2001 From: Peter Van Dyken Date: Wed, 13 Dec 2023 16:38:45 -0500 Subject: [PATCH] Testing push --- .github/workflows/nightly.yml | 106 ++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..7b68dd6d --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,106 @@ +name: Weekly testing, and recalibration of test timings + +on: + schedule: + - cron: "5 3 * * 2" + push: + branches: + - '*' + - '!push-action/*' + pull_request: + branches: + - '*' + - '!push-action/*' +jobs: + build-cache-env: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + steps: + - uses: khanlab/actions/.github/actions/action-setup_task-installPyProject@v0.3.3 + id: setup + with: + python-version: ${{ matrix.python-version }} + - name: setup docker + uses: ./.github/actions/build-test-container + with: + python-version: ${{ steps.setup.outputs.python-version }} + + calibrate-timings: + runs-on: ubuntu-latest + needs: ["build-cache-env"] + permissions: + pull-requests: write + + steps: + - name: install + uses: khanlab/actions/.github/actions/action-setup_task-installPyProject@v0.3.3 + id: setup + with: + python-version: "3.8" + install-library: true + - name: build docker test container + uses: ./.github/actions/build-test-container + with: + python-version: ${{ steps.setup.outputs.python-version }} + load: true + - name: Count current number of tests + id: count + run: | + echo "NUM=$(pytest --collect-only -q | head -n -2 | wc -l)" >> "$GITHUB_OUTPUT" + - name: Count number of timed tests + id: timed-count + run: | + echo "NUM=$(jq 'keys | length' .test_durations)" >> "$GITHUB_OUTPUT" + - name: Test with pytest + if: ${{ steps.count.outputs.NUM }} != ${{ steps.timed-count.outputs.NUM }} + env: + HYPOTHESIS_PROFILE: pr + run: >- + poetry run pytest -n auto --store-durations + --doctest-modules --ignore=docs + --ignore=snakebids/project_template --benchmark-disable + - name: Check if there are changes + id: changes + uses: UnicornGlobal/has-changes-action@v1.0.11 + # - name: Create PR + # if: steps.changes.outputs.changed == 1 + # uses: peter-evans/create-pull-request@v5 + # with: + # commit-message: Update test timings file + # branch: maint/update-test-timings + # title: Merge updated test timings + # labels: maintenance + # body-path: | + # The number of tests has changed since the last generated test-timings + # file. This PR contains an automatically regenerated file. + + # test: + # runs-on: ubuntu-latest + # needs: ["build-cache-env"] + # strategy: + # matrix: + # python-version: ["3.8", "3.9", "3.10", "3.11"] + # split: ["1", "2", "3", "4", "5"] + # fail-fast: false + # steps: + # - name: install + # uses: khanlab/actions/.github/actions/action-setup_task-installPyProject@v0.3.3 + # id: setup + # with: + # python-version: ${{ matrix.python-version }} + # install-library: true + # - name: build docker test container + # uses: ./.github/actions/build-test-container + # with: + # python-version: ${{ steps.setup.outputs.python-version }} + # load: true + + # - name: Test with pytest + # env: + # HYPOTHESIS_PROFILE: pr + # run: >- + # poetry run pytest -n auto --splits 5 --group ${{ matrix.split }} + # --doctest-modules --ignore=docs + # --ignore=snakebids/project_template --benchmark-disable