mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Avoid running CI steps when the files they check have not been changed. (#14745)
This commit is contained in:
parent
b225acf3e6
commit
525d9d6e11
96
.github/workflows/tests.yml
vendored
96
.github/workflows/tests.yml
vendored
@ -22,6 +22,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
rust: ${{ !startsWith(github.ref, 'refs/pull/') || steps.filter.outputs.rust }}
|
rust: ${{ !startsWith(github.ref, 'refs/pull/') || steps.filter.outputs.rust }}
|
||||||
|
trial: ${{ !startsWith(github.ref, 'refs/pull/') || steps.filter.outputs.trial }}
|
||||||
|
integration: ${{ !startsWith(github.ref, 'refs/pull/') || steps.filter.outputs.integration }}
|
||||||
|
linting: ${{ !startsWith(github.ref, 'refs/pull/') || steps.filter.outputs.linting }}
|
||||||
steps:
|
steps:
|
||||||
- uses: dorny/paths-filter@v2
|
- uses: dorny/paths-filter@v2
|
||||||
id: filter
|
id: filter
|
||||||
@ -33,9 +36,45 @@ jobs:
|
|||||||
- 'rust/**'
|
- 'rust/**'
|
||||||
- 'Cargo.toml'
|
- 'Cargo.toml'
|
||||||
- 'Cargo.lock'
|
- 'Cargo.lock'
|
||||||
|
- '.rustfmt.toml'
|
||||||
|
|
||||||
|
trial:
|
||||||
|
- 'synapse/**'
|
||||||
|
- 'tests/**'
|
||||||
|
- 'rust/**'
|
||||||
|
- 'Cargo.toml'
|
||||||
|
- 'Cargo.lock'
|
||||||
|
- 'pyproject.toml'
|
||||||
|
- 'poetry.lock'
|
||||||
|
|
||||||
|
integration:
|
||||||
|
- 'synapse/**'
|
||||||
|
- 'rust/**'
|
||||||
|
- 'docker/**'
|
||||||
|
- 'Cargo.toml'
|
||||||
|
- 'Cargo.lock'
|
||||||
|
- 'pyproject.toml'
|
||||||
|
- 'poetry.lock'
|
||||||
|
- 'docker/**'
|
||||||
|
|
||||||
|
linting:
|
||||||
|
- 'synapse/**'
|
||||||
|
- 'docker/**'
|
||||||
|
- 'tests/**'
|
||||||
|
- 'scripts-dev/**'
|
||||||
|
- 'contrib/**'
|
||||||
|
- 'synmark/**'
|
||||||
|
- 'stubs/**'
|
||||||
|
- '.ci/**'
|
||||||
|
- 'mypy.ini'
|
||||||
|
- 'pyproject.toml'
|
||||||
|
- 'poetry.lock'
|
||||||
|
|
||||||
check-sampleconfig:
|
check-sampleconfig:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: changes
|
||||||
|
if: ${{ needs.changes.outputs.linting == 'true' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
@ -51,6 +90,9 @@ jobs:
|
|||||||
|
|
||||||
check-schema-delta:
|
check-schema-delta:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: changes
|
||||||
|
if: ${{ needs.changes.outputs.linting == 'true' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
@ -70,6 +112,9 @@ jobs:
|
|||||||
|
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: changes
|
||||||
|
if: ${{ needs.changes.outputs.linting == 'true' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -92,6 +137,9 @@ jobs:
|
|||||||
lint-mypy:
|
lint-mypy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Typechecking
|
name: Typechecking
|
||||||
|
needs: changes
|
||||||
|
if: ${{ needs.changes.outputs.linting == 'true' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -149,6 +197,9 @@ jobs:
|
|||||||
|
|
||||||
lint-pydantic:
|
lint-pydantic:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: changes
|
||||||
|
if: ${{ needs.changes.outputs.linting == 'true' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@ -250,8 +301,10 @@ jobs:
|
|||||||
sytest_test_matrix: ${{ steps.get-matrix.outputs.sytest_test_matrix }}
|
sytest_test_matrix: ${{ steps.get-matrix.outputs.sytest_test_matrix }}
|
||||||
|
|
||||||
trial:
|
trial:
|
||||||
if: ${{ !cancelled() && !failure() }} # Allow previous steps to be skipped, but not fail
|
if: ${{ !cancelled() && !failure() && needs.changes.outputs.trial == 'true' }} # Allow previous steps to be skipped, but not fail
|
||||||
needs: calculate-test-jobs
|
needs:
|
||||||
|
- calculate-test-jobs
|
||||||
|
- changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@ -306,8 +359,10 @@ jobs:
|
|||||||
|
|
||||||
trial-olddeps:
|
trial-olddeps:
|
||||||
# Note: sqlite only; no postgres
|
# Note: sqlite only; no postgres
|
||||||
if: ${{ !cancelled() && !failure() }} # Allow previous steps to be skipped, but not fail
|
if: ${{ !cancelled() && !failure() && needs.changes.outputs.trial == 'true' }} # Allow previous steps to be skipped, but not fail
|
||||||
needs: linting-done
|
needs:
|
||||||
|
- linting-done
|
||||||
|
- changes
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@ -362,8 +417,10 @@ jobs:
|
|||||||
trial-pypy:
|
trial-pypy:
|
||||||
# Very slow; only run if the branch name includes 'pypy'
|
# Very slow; only run if the branch name includes 'pypy'
|
||||||
# Note: sqlite only; no postgres. Completely untested since poetry move.
|
# Note: sqlite only; no postgres. Completely untested since poetry move.
|
||||||
if: ${{ contains(github.ref, 'pypy') && !failure() && !cancelled() }}
|
if: ${{ contains(github.ref, 'pypy') && !failure() && !cancelled() && needs.changes.outputs.trial == 'true' }}
|
||||||
needs: linting-done
|
needs:
|
||||||
|
- linting-done
|
||||||
|
- changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@ -394,8 +451,10 @@ jobs:
|
|||||||
|| true
|
|| true
|
||||||
|
|
||||||
sytest:
|
sytest:
|
||||||
if: ${{ !failure() && !cancelled() }}
|
if: ${{ !failure() && !cancelled() && needs.changes.outputs.integration == 'true' }}
|
||||||
needs: calculate-test-jobs
|
needs:
|
||||||
|
- calculate-test-jobs
|
||||||
|
- changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: matrixdotorg/sytest-synapse:${{ matrix.job.sytest-tag }}
|
image: matrixdotorg/sytest-synapse:${{ matrix.job.sytest-tag }}
|
||||||
@ -476,8 +535,10 @@ jobs:
|
|||||||
|
|
||||||
|
|
||||||
portdb:
|
portdb:
|
||||||
if: ${{ !failure() && !cancelled() }} # Allow previous steps to be skipped, but not fail
|
if: ${{ !failure() && !cancelled() && needs.changes.outputs.linting == 'true' }} # Allow previous steps to be skipped, but not fail
|
||||||
needs: linting-done
|
needs:
|
||||||
|
- linting-done
|
||||||
|
- changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@ -537,8 +598,10 @@ jobs:
|
|||||||
schema_diff
|
schema_diff
|
||||||
|
|
||||||
complement:
|
complement:
|
||||||
if: "${{ !failure() && !cancelled() }}"
|
if: "${{ !failure() && !cancelled() && needs.changes.outputs.integration == 'true' }}"
|
||||||
needs: linting-done
|
needs:
|
||||||
|
- linting-done
|
||||||
|
- changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
@ -632,9 +695,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
needs: ${{ toJSON(needs) }}
|
needs: ${{ toJSON(needs) }}
|
||||||
|
|
||||||
# The newsfile and signoff lints may be skipped on non PR builds
|
# Various bits are skipped if there was no applicable changes.
|
||||||
# Cargo test is skipped if there is no changes on Rust code
|
# The newsfile and signoff lint may be skipped on non PR builds.
|
||||||
skippable: |
|
skippable: |
|
||||||
|
trial
|
||||||
|
trial-olddeps
|
||||||
|
sytest
|
||||||
|
portdb
|
||||||
|
complement
|
||||||
check-signoff
|
check-signoff
|
||||||
lint-newsfile
|
lint-newsfile
|
||||||
cargo-test
|
cargo-test
|
||||||
|
1
changelog.d/14745.misc
Normal file
1
changelog.d/14745.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Avoid running CI steps when the files they check have not been changed.
|
Loading…
Reference in New Issue
Block a user