Skip to content

Commit

Permalink
👷🏻 ci: update lint workflow to use environment variables for OS and P…
Browse files Browse the repository at this point in the history
…ython versions
  • Loading branch information
adriamontoto committed Nov 5, 2024
1 parent fcc99c7 commit 2561764
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 50 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,20 @@ permissions:
jobs:
smokeshow:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.13]

name: Smokeshow Pipeline
timeout-minutes: 5
steps:
- name: 🐍 Set up Python 3.13
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: 3.13
python-version: ${{ matrix.python-version }}

- name: 📦 Install dependencies
run: pip install smokeshow
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
name: Format Pipeline

permissions:
contents: write

on:
push:
branches:
- master
- develop
branches: [master]
pull_request:
types:
- opened
- synchronize
types: [opened, synchronize]

permissions:
contents: write

jobs:
format:
Expand Down
32 changes: 8 additions & 24 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,21 @@ name: Lint Pipeline

on:
push:
branches:
- master
- develop
branches: [master]
pull_request:
types:
- opened
- synchronize
types: [opened, synchronize]

jobs:
lint:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.11, 3.12, 3.13]
os: [ubuntu-latest]
python-version: [3.13]

name: Lint Pipeline - Python ${{ matrix.python-version }} on ${{ matrix.os }}
timeout-minutes: 15
timeout-minutes: 10
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@v4
Expand All @@ -37,8 +33,8 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements*') }}
restore-keys: ${{ runner.os }}-python-${{ matrix.python-version }}-
key: ${{ matrix.os }}-python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements*') }}
restore-keys: ${{ matrix.os }}-python-${{ matrix.python-version }}-

- name: 📦 Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
Expand All @@ -51,17 +47,5 @@ jobs:
uses: actions/upload-artifact@v4
if: always()
with:
name: type_coverage_report_${{ runner.os }}_${{ matrix.python-version }}
name: type_coverage_report_${{ matrix.os }}_${{ matrix.python-version }}
path: index.txt

# This job does nothing and is only used for the branch protection
check-all:
needs: [lint]
if: always()
runs-on: ubuntu-latest

steps:
- name: ✅ All lint tests passed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
12 changes: 9 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ on:

jobs:
publish:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.13]

environment:
name: pypi
url: https://pypi.org/p/criteria-pattern/
Expand All @@ -22,10 +28,10 @@ jobs:
with:
fetch-depth: 0 # Only last commit

- name: 🐍 Set up Python 3.13
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: 3.13
python-version: ${{ matrix.python-version }}

- name: 📦 Install dependencies
run: pip install build
Expand Down
23 changes: 12 additions & 11 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ name: Test Pipeline

on:
push:
branches:
- master
- develop
branches: [master]
pull_request:
types:
- opened
- synchronize
types: [opened, synchronize]
schedule:
- cron: '0 0 * * 1' # Every Monday at 00:00 UTC

Expand Down Expand Up @@ -66,26 +62,31 @@ jobs:
coverage-combine:
needs: [test]
if: always()
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.13]

steps:
- name: 📥 Checkout the repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Only last commit

- name: 🐍 Set up Python 3.13
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: 3.13
python-version: ${{ matrix.python-version }}

- id: cache
name: 📦 Create cache
uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-3.13-${{ hashFiles('pyproject.toml', 'requirements*') }}
restore-keys: ${{ runner.os }}-python-3.13-
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements*') }}
restore-keys: ${{ runner.os }}-python-${{ matrix.python-version }}-

- name: 📦 Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
Expand Down

0 comments on commit 2561764

Please sign in to comment.