From 63d94cf6ba674decaf0d349224a1fcf5111d7638 Mon Sep 17 00:00:00 2001 From: Chukwuma Nwaugha Date: Sun, 3 Nov 2024 23:30:34 +0000 Subject: [PATCH] revise github actions workflow files --- .../workflows/{deploy.yml => deploy_app.yml} | 40 +++++-------------- .github/workflows/lint.yml | 30 ++++++++++++++ .github/workflows/ruff.yml | 23 ----------- 3 files changed, 39 insertions(+), 54 deletions(-) rename .github/workflows/{deploy.yml => deploy_app.yml} (81%) create mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/ruff.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy_app.yml similarity index 81% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy_app.yml index a99135b..0949db9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy_app.yml @@ -2,14 +2,14 @@ name: Deploy app to Google Cloudrun on: pull_request: paths: - - "src/**" - - ".github/workflows/deploy.yml" + - "src/app/**" + - ".github/workflows/deploy_app.yml" push: branches: - main paths: - - "src/**" - - ".github/workflows/deploy.yml" + - "src/app/**" + - ".github/workflows/deploy_app.yml" tags: - "release-*" @@ -42,34 +42,12 @@ jobs: echo "TAGGED=${{ startsWith(github.ref, 'refs/tags/api') }}" >> $GITHUB_OUTPUT echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - lint: - runs-on: ubuntu-latest - needs: prepare - timeout-minutes: 5 - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-python@v5 - with: - python-version: "3.12" - cache: "pip" # caching pip dependencies - check-latest: true - - - run: pip install --force-reinstall -r requirements.txt - if: ${{ steps.setup-python.outputs.cache-hit != 'true' }} - - - run: pip install -r requirements.txt - if: ${{ steps.setup-python.outputs.cache-hit == 'true' }} - - - uses: chartboost/ruff-action@v1 - deploy: runs-on: ubuntu-latest - needs: [prepare, lint] + needs: [prepare] timeout-minutes: 10 - permissions: - pull-requests: write + permissions: + pull-requests: write steps: - uses: actions/checkout@v4 with: @@ -91,7 +69,7 @@ jobs: uses: google-github-actions/deploy-cloudrun@v2 with: service: ${{ env.SERVICE }} - source: ./ + source: ./app tag: ${{ needs.prepare.outputs.VERSION }} no_traffic: true timeout: "5m" @@ -116,7 +94,7 @@ jobs: promote: runs-on: ubuntu-latest if: (needs.prepare.outputs.MAIN == 'true') - needs: [prepare, deploy, lint] + needs: [prepare, deploy] timeout-minutes: 3 steps: - uses: google-github-actions/auth@v2 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..33e0d48 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,30 @@ +name: Pylint + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + timeout-minutes: 5 + strategy: + matrix: + python-version: ["3.11", "3.12"] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" # caching pip dependencies + check-latest: true + + - run: pip install --force-reinstall -r requirements.txt + if: ${{ steps.setup-python.outputs.cache-hit != 'true' }} + + - run: pip install -r requirements.txt + if: ${{ steps.setup-python.outputs.cache-hit == 'true' }} + + - uses: chartboost/ruff-action@v1 + - run: ruff check ./ diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml deleted file mode 100644 index b7791ba..0000000 --- a/.github/workflows/ruff.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Pylint - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.11", "3.12"] - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install ruff - - name: Analysing the code with ruff - run: | - ruff check ./