From 6c3eaee6977a1994842a60e60392159622721237 Mon Sep 17 00:00:00 2001 From: Dor Harpaz Date: Tue, 7 May 2024 16:51:36 +0300 Subject: [PATCH] attempt to get files_changed --- .github/workflows/Lint.yml | 2 +- .github/workflows/test-notebooks.yml | 38 +++++++++++++++++++++++----- pyproject.toml | 1 - 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/Lint.yml b/.github/workflows/Lint.yml index 4f576097..f9a48a7a 100644 --- a/.github/workflows/Lint.yml +++ b/.github/workflows/Lint.yml @@ -12,7 +12,7 @@ env: jobs: lint: runs-on: ubuntu-latest - timeout-minutes: 2 + timeout-minutes: 10 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/test-notebooks.yml b/.github/workflows/test-notebooks.yml index d3358cdf..d06988d2 100644 --- a/.github/workflows/test-notebooks.yml +++ b/.github/workflows/test-notebooks.yml @@ -1,16 +1,14 @@ name: "Test notebooks" -on: [push, workflow_dispatch] - -concurrency: - group: ${{ github.repository }}-${{ github.ref }}-${{ github.head_ref }} - cancel-in-progress: true +on: [pull_request, workflow_dispatch] jobs: tests: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 2 - name: Set up Python uses: actions/setup-python@v5 with: @@ -19,5 +17,33 @@ jobs: run: | python -m pip install -U -r requirements.txt python -m pip install -U pytest + + - name: Get changed files + id: changed-files + run: | + if ${{ github.event_name == 'pull_request' }}; then + echo "changed_files=$(git diff --name-only HEAD^ HEAD | xargs)" >> $GITHUB_OUTPUT + fi + - name: List changed files + run: | + for file in ${{ steps.changed-files.outputs.changed_files }}; do + echo "$file was changed" + done + + - name: Get changed files - all + id: changed-files-all + uses: tj-actions/changed-files@v44 + - name: Get changed files - ipynb + id: changed-files-ipynb + uses: tj-actions/changed-files@v44 + with: + files: | + **.ipynb + - name: 'Run tests' run: python -m pytest tests + env: + HAS_ANY_FILE_CHANGED: "${{ steps.changed-files-all.outputs.any_changed }}" + LIST_OF_FILE_CHANGED: "${{ steps.changed-files-all.outputs.all_changed_files }}" + HAS_ANY_IPYNB_CHANGED: "${{ steps.changed-files-ipynb.outputs.any_changed }}" + LIST_OF_IPYNB_CHANGED: "${{ steps.changed-files-ipynb.outputs.all_changed_files }}" diff --git a/pyproject.toml b/pyproject.toml index 7b6ed272..79833d2a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,5 @@ [tool.pytest.ini_options] python_files = "test_*.py" -timeout_method = "thread" [tool.isort] profile = "black"