Skip to content

Commit

Permalink
Fix action usage
Browse files Browse the repository at this point in the history
  • Loading branch information
druzsan committed Feb 8, 2024
1 parent a230300 commit 1d3c88b
Show file tree
Hide file tree
Showing 4 changed files with 226 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/ci-builtin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: '2.1. 🔍 CI (built-in matrix)'

on: push

jobs:
# Check code formatting
check-format:
name: '🔍 Check Formatting'
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.10', '3.12']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install -IU pip setuptools wheel
- run: pip install -IUr requirements.txt -r requirements-dev.txt
- run: black --check .
# Check code types
typecheck:
name: '🔍 Check Types'
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.10', '3.12']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install -IU pip setuptools wheel
- run: pip install -IUr requirements.txt -r requirements-dev.txt
- run: mypy main.py && mypy tests
# Lint code
lint:
name: '🔍 Lint'
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.10', '3.12']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install -IU pip setuptools wheel
- run: pip install -IUr requirements.txt -r requirements-dev.txt
- run: ruff check main.py tests
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: '2.2. 🔍 CI'

on: push

jobs:
# Setup matrix
setup-matrix:
name: '🧱 Build Matrix'
runs-on: ubuntu-latest
steps:
- id: setup-matrix
uses: druzsan/setup-matrix@feature/use-python-dockerfile
with:
matrix: |
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.8, 3.10, 3.12]
outputs:
matrix: ${{ steps.setup-matrix.outputs.matrix }}
# Check code formatting
check-format:
name: '🔍 Check Formatting'
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install -IU pip setuptools wheel
- run: pip install -IUr requirements.txt -r requirements-dev.txt
- run: black --check .
# Check code types
typecheck:
name: '🔍 Check Types'
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install -IU pip setuptools wheel
- run: pip install -IUr requirements.txt -r requirements-dev.txt
- run: mypy main.py && mypy tests
# Lint code
lint:
name: '🔍 Lint'
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install -IU pip setuptools wheel
- run: pip install -IUr requirements.txt -r requirements-dev.txt
- run: ruff check main.py tests
57 changes: 57 additions & 0 deletions .github/workflows/test-builtin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: '3.1. 🧪 Test (built-in matrix)'

on: push

jobs:
# Run unit-test on a dev branch
unit-test-dev:
name: '🧪 Unit-Test (dev)'
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
- run: python -m pip install -IU pip setuptools wheel
- run: pip install -IUr requirements.txt -r requirements-dev.txt
- run: python -m pytest
# Run unit-test on the main branch
unit-test-main:
name: '🧪 Unit-Test (main)'
if: github.ref == 'refs/heads/main'
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.8', '3.10', '3.12']
include:
- os: windows-latest
python-version: '3.8'
- os: macos-latest
python-version: '3.8'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install -IU pip setuptools wheel
- run: pip install -IUr requirements.txt -r requirements-dev.txt
- run: python -m pytest
# Run unit-test on a tag
unit-test-tag:
name: '🧪 Unit-Test (tag)'
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.10', '3.12']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install -IU pip setuptools wheel
- run: pip install -IUr requirements.txt -r requirements-dev.txt
- run: python -m pytest
56 changes: 56 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: '3.2. 🧪 Test'

on: push

jobs:
# Setup matrix
setup-matrix:
name: '🧱 Build Matrix'
runs-on: ubuntu-latest
steps:
# Setup matrix on a dev branch
- if: startsWith(github.ref, 'refs/tags/')
uses: druzsan/setup-matrix@feature/use-python-dockerfile
with:
matrix: |
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.8, 3.10, 3.12]
# Setup matrix on the main branch
- if: github.ref == 'refs/heads/main'
uses: druzsan/setup-matrix@feature/use-python-dockerfile
with:
matrix: |
os: [ubuntu-latest]
python-version: [3.8, 3.10, 3.12]
include:
- os: windows-latest
python-version: 3.8
- os: macos-latest
python-version: 3.8
# Setup matrix on a tag
- if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')
uses: druzsan/setup-matrix@feature/use-python-dockerfile
with:
matrix: |
os: [ubuntu-latest]
python-version: [3.8]
# MATRIX environment variable is set by the last executed action
- id: setup-matrix
run: echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
outputs:
matrix: ${{ steps.setup-matrix.outputs.matrix }}
# Run unit-test
unit-test:
name: '🧪 Unit-Test'
needs: setup-matrix
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install -IU pip setuptools wheel
- run: pip install -IUr requirements.txt -r requirements-dev.txt
- run: python -m pytest

0 comments on commit 1d3c88b

Please sign in to comment.