From 04cf47b32dc43e54634afca0ea5397b030667cae Mon Sep 17 00:00:00 2001 From: Luke R Date: Thu, 2 May 2024 13:06:33 -0700 Subject: [PATCH] Test the filters workflow --- .gitea/workflows/build-and-push.yaml | 33 ++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/.gitea/workflows/build-and-push.yaml b/.gitea/workflows/build-and-push.yaml index 748807df..daea1c4b 100755 --- a/.gitea/workflows/build-and-push.yaml +++ b/.gitea/workflows/build-and-push.yaml @@ -3,12 +3,27 @@ run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 on: [push] jobs: + changes: + runs-on: ubuntu-latest + outputs: + python_files: ${{ steps.filter.outputs.python_files }} + helm_files: ${{ steps.filter.outputs.helm }} + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + python_files: + - 'app/**' + helm: + - 'helm/**' Lint-Python: runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.python_files == 'true' }} steps: - - run: echo "This is run ${{ gitea.run_id }}" - # - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - # - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." - name: Check out repository code uses: actions/checkout@v4 - uses: dorny/paths-filter@v3 @@ -20,13 +35,15 @@ jobs: - name: install UV run: | pip install uv --quiet - if: steps.filter.outputs.workflows == 'true' + if: steps.filter.outputs.python_files == 'true' - name: install black and lint code run: | uv pip install black --system --quiet black app --check --fast - if: steps.filter.outputs.workflows == 'true' + if: steps.filter.outputs.python_files == 'true' Build-and-Push-Docker: + needs: changes + if: ${{ needs.changes.outputs.python_files == 'true' }} steps: - name: Login to Docker Hub if: github.event_name != 'pull_request' @@ -44,9 +61,3 @@ jobs: tags: | dragon-bot/dale-bot:latest dragon-bot/dale-bot:${{ gitea.run_id }} - # - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." - # - run: echo "🖥️ The workflow is now ready to test your code on the runner." - # - name: List files in the repository - # run: | - # ls ${{ gitea.workspace }} - # - run: echo "🍏 This job's status is ${{ job.status }}." \ No newline at end of file