Skip to content

ci: Only run CI when necessary #168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,39 @@ name: Deploy Documentation

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
changed-files:
name: Changed Files
runs-on: ubuntu-latest
outputs:
docs-change: ${{ steps.changed-files.outputs.docs-change_any_modified == 'true' }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 50 # Assume PRs are less than 50 commits

- name: Find changed files
uses: tj-actions/changed-files@v44
id: changed-files
with:
files_yaml: |
docs-change:
- .github/workflows/deploy-docs.yml
- docs/**
- package.json
- package-lock.json

vercel:
runs-on: ubuntu-latest
needs: [changed-files]
if: ${{ needs.changed-files.outputs.docs-change == 'true' }}

steps:
- name: Checkout Code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/draft-release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ permissions:

jobs:
update_release_draft:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read

runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v6
Expand Down
56 changes: 55 additions & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,63 @@
name: Linting

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:

env:
PIP_DISABLE_PIP_VERSION_CHECK: 1

jobs:
changed-files:
name: Changed Files
runs-on: ubuntu-latest
outputs:
docs-change: ${{ steps.changed-files.outputs.docs-change_any_modified == 'true' }}
python-change: ${{ steps.changed-files.outputs.python-change_any_modified == 'true' }}
project-change: ${{ steps.changed-files.outputs.project-change_any_modified == 'true' }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 50 # Assume PRs are less than 50 commits

- name: Find changed files
uses: tj-actions/changed-files@v44
id: changed-files
with:
files_yaml: |
common: &common
- .github/workflows/linter.yml

docs-change:
- *common
- docs/**
- package.json
- package-lock.json

python-change:
- *common
- src/**
- tests/**
- ruff.toml
- poetry.lock
- pyproject.toml

project-change:
- *common
- package.json
- .prettierignore
- .github/ISSUE_TEMPLATE/**
- .github/*.md

lint-python:
name: Python
runs-on: ubuntu-latest
needs: [changed-files]
if: ${{ needs.changed-files.outputs.python-change == 'true' }}

steps:
- name: Checkout repository
Expand All @@ -33,6 +82,8 @@ jobs:
lint-docs:
name: Docs
runs-on: ubuntu-latest
needs: [changed-files]
if: ${{ needs.changed-files.outputs.docs-change == 'true' }}

steps:
- name: Checkout repository
Expand All @@ -56,6 +107,8 @@ jobs:
lint-project:
name: Project
runs-on: ubuntu-latest
needs: [changed-files]
if: ${{ needs.changed-files.outputs.project-change == 'true' }}

steps:
- name: Checkout repository
Expand Down Expand Up @@ -86,4 +139,5 @@ jobs:
- name: Whether the whole linting suite passed
uses: re-actors/[email protected]
with:
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}
40 changes: 40 additions & 0 deletions .github/workflows/test-worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Run Test Suite

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

Expand All @@ -21,9 +23,44 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
changed-files:
name: Changed Files
runs-on: ubuntu-latest
outputs:
docs-change: ${{ steps.changed-files.outputs.docs-change_any_modified == 'true' }}
python-change: ${{ steps.changed-files.outputs.python-change_any_modified == 'true' }}
project-change: ${{ steps.changed-files.outputs.project-change_any_modified == 'true' }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 50 # Assume PRs are less than 50 commits

- name: Find changed files
uses: tj-actions/changed-files@v44
id: changed-files
with:
files_yaml: |
common: &common
- .github/workflows/test-worker.yml

docs-change:
- *common
- docs/**
- package.json
- package-lock.json

python-change:
- *common
- src/**
- tests/**

test-python:
name: "${{ matrix.python-version }} on ${{ matrix.os }}"
runs-on: "${{ matrix.os }}-latest"
needs: [changed-files]
if: ${{ needs.changed-files.outputs.python-change == 'true' }}

continue-on-error: ${{ startsWith(matrix.python-version, '~') }} # Allows unstable Python versions to fail

Expand Down Expand Up @@ -59,6 +96,8 @@ jobs:
test-docs:
name: Docs
runs-on: ubuntu-latest
needs: [changed-files]
if: ${{ needs.changed-files.outputs.docs-change == 'true' }}

steps:
- name: Checkout repository
Expand Down Expand Up @@ -89,4 +128,5 @@ jobs:
- name: Whether the whole test suite passed
uses: re-actors/[email protected]
with:
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}