diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0335c358b3..04cc4aafe8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,21 +6,40 @@ on: branches: [ master ] tags: - 'v*' - paths: - - '**' - - '!docs/**' - - '.github/**' pull_request: branches: [ master ] - paths: - - '**' - - '!docs/**' - - '.github/**' merge_group: jobs: + changed: + runs-on: ubuntu-22.04 + # Required permissions + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + docs: ${{ steps.filter.outputs.docs == 'true' || steps.filter.outputs.workflow == 'true' }} + code: ${{ steps.filter.outputs.code == 'true' || steps.filter.outputs.workflow == 'true' }} + steps: + - name: Check for file changes + uses: dorny/paths-filter@v2 + id: filter + with: + list-files: 'shell' + filters: | + docs: + - 'docs/**' + workflow: + - '.github/**' + code: + - 'photon-*/**' + build-client: name: "PhotonClient Build" + + needs: changed + if: ${{ needs.changed.outputs.code }} + defaults: run: working-directory: photon-client @@ -40,6 +59,11 @@ jobs: name: built-client path: photon-client/dist/ build-examples: + name: "Photonlib - Build Examples - ${{ matrix.os }}" + runs-on: ${{ matrix.os }} + + needs: changed + if: ${{ needs.changed.outputs.code }} strategy: fail-fast: false @@ -51,9 +75,6 @@ jobs: architecture: aarch64 - os: ubuntu-22.04 - name: "Photonlib - Build Examples - ${{ matrix.os }}" - runs-on: ${{ matrix.os }} - steps: - name: Checkout code uses: actions/checkout@v4 @@ -79,6 +100,10 @@ jobs: run: ./gradlew build build-gradle: name: "Gradle Build" + + needs: changed + if: ${{ needs.changed.outputs.code }} + runs-on: ubuntu-22.04 steps: # Checkout code. @@ -111,6 +136,10 @@ jobs: file: ./photon-core/build/reports/jacoco/test/jacocoTestReport.xml build-offline-docs: name: "Build Offline Docs" + + needs: changed + if: ${{ needs.changed.outputs.code }} + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -139,6 +168,10 @@ jobs: build-photonlib-vendorjson: name: "Build Vendor JSON" runs-on: ubuntu-22.04 + + needs: changed + if: ${{ needs.changed.outputs.code }} + steps: - uses: actions/checkout@v4 with: @@ -183,6 +216,10 @@ jobs: name: "Photonlib - Build Host - ${{ matrix.artifact-name }}" runs-on: ${{ matrix.os }} + + needs: changed + if: ${{ needs.changed.outputs.code }} + steps: - uses: actions/checkout@v4 with: @@ -226,6 +263,10 @@ jobs: runs-on: ubuntu-22.04 container: ${{ matrix.container }} name: "Photonlib - Build Docker - ${{ matrix.artifact-name }}" + + needs: changed + if: ${{ needs.changed.outputs.code }} + steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index 10af231467..90ca5ae146 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -6,16 +6,8 @@ on: branches: [ master ] tags: - 'v*' - paths: - - '**' - - '!docs/**' - - '.github/**' pull_request: branches: [ master ] - paths: - - '**' - - '!docs/**' - - '.github/**' merge_group: concurrency: diff --git a/.github/workflows/photonvision-docs.yml b/.github/workflows/photonvision-docs.yml index 9ef25f8b80..1463772d1e 100644 --- a/.github/workflows/photonvision-docs.yml +++ b/.github/workflows/photonvision-docs.yml @@ -3,23 +3,44 @@ name: PhotonVision Sphinx Documentation Checks on: push: branches: [ master ] - paths: - - 'docs/**' - - '.github/**' pull_request: branches: [ master ] - paths: - - 'docs/**' - - '.github/**' merge_group: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: + changed: + runs-on: ubuntu-22.04 + # Required permissions + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + docs: ${{ steps.filter.outputs.docs == 'true' || steps.filter.outputs.workflow == 'true' }} + code: ${{ steps.filter.outputs.code == 'true' || steps.filter.outputs.workflow == 'true' }} + steps: + - name: Check for file changes + uses: dorny/paths-filter@v2 + id: filter + with: + list-files: 'shell' + filters: | + docs: + - 'docs/**' + workflow: + - '.github/**' + code: + - 'photon-*/**' + + build: runs-on: ubuntu-22.04 + needs: changed + if: ${{ needs.changed.outputs.docs }} + steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index dd261cf70c..40b8fff091 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -8,22 +8,36 @@ on: branches: [ master ] tags: - 'v*' - paths: - - '**' - - '!docs/**' - - '.github/**' pull_request: branches: [ master ] - paths: - - '**' - - '!docs/**' - - '.github/**' merge_group: jobs: + changed: + runs-on: ubuntu-22.04 + # Required permissions + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + py: ${{ steps.filter.outputs.python == 'true' || steps.filter.outputs.workflow == 'true' }} + steps: + - name: Check for file changes + uses: dorny/paths-filter@v2 + id: filter + with: + list-files: 'shell' + filters: | + workflow: + - '.github/**' + python: + - 'photon-lib/py/**' buildAndDeploy: runs-on: ubuntu-22.04 + needs: changed + if: ${{ needs.changed.outputs.py }} + steps: - name: Checkout code uses: actions/checkout@v4 @@ -70,7 +84,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') uses: pypa/gh-action-pypi-publish@release/v1 with: - packages_dir: ./photon-lib/py/dist/ + packages-dir: ./photon-lib/py/dist/ permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing