-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from druzsan/feature/use-python-dockerfile
Feature/use python dockerfile
- Loading branch information
Showing
19 changed files
with
958 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* | ||
|
||
!Dockerfile | ||
!requirements.txt | ||
!main.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: '🔍 CI (built-in matrix)' | ||
|
||
on: push | ||
|
||
# This workflow serves for multiple purposes: | ||
# - Action code check | ||
# - Action integration test | ||
# - Advanced usage example (reusable matrix) | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: '🔍 CI' | ||
|
||
on: push | ||
|
||
# This workflow serves for multiple purposes: | ||
# - Action code check | ||
# - Action integration test | ||
# - Advanced usage example (reusable matrix) | ||
|
||
jobs: | ||
# Setup matrix | ||
setup-matrix: | ||
name: '🧱 Build Matrix' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.setup-matrix.outputs.matrix }} | ||
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] | ||
# Check code formatting | ||
check-format: | ||
name: '🔍 Check Formatting' | ||
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: black --check . | ||
# Check code types | ||
typecheck: | ||
name: '🔍 Check Types' | ||
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: mypy main.py && mypy tests | ||
# Lint code | ||
lint: | ||
name: '🔍 Lint' | ||
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: ruff check main.py tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: '🧪 Integration Test' | ||
|
||
on: | ||
push: | ||
schedule: | ||
- cron: '0 6 * * *' | ||
workflow_dispatch: | ||
|
||
# This workflow serves for multiple purposes: | ||
# - Action integration test | ||
# - Usage example | ||
|
||
jobs: | ||
# Valid jobs | ||
setup-matrix-multi-line: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.setup-matrix.outputs.matrix }} | ||
steps: | ||
- uses: druzsan/setup-matrix@feature/use-python-dockerfile | ||
with: | ||
matrix: | # Setup matrix with OS and Python version | ||
os: [ubuntu-latest, windows-latest] | ||
python-version: [3.8, 3.10, 3.12] | ||
include: | ||
- os: windows-latest | ||
python-version: 3.8 # Only use Python 3.8 for MacOS | ||
exclude: | ||
- os: windows-latest | ||
python-version: 3.12 # Do not use Python 3.12 for Windows | ||
setup-matrix-flow-syntax: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.setup-matrix.outputs.matrix }} | ||
steps: | ||
- uses: druzsan/setup-matrix@feature/use-python-dockerfile | ||
with: | ||
matrix: '{ os: [ubuntu-latest, windows-latest], python-version: [3.8, 3.10, 3.12] }' | ||
# Jobs expected to fail | ||
setup-matrix-empty: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.setup-matrix.outputs.matrix }} | ||
steps: | ||
- id: expected-to-fail | ||
uses: druzsan/setup-matrix@feature/use-python-dockerfile | ||
continue-on-error: true | ||
- if: steps.expected-to-fail.outcome != 'failure' | ||
run: echo "Step expected to fail didn't fail" && exit 1 | ||
setup-matrix-windows: | ||
runs-on: windows-latest | ||
steps: | ||
- id: expected-to-fail | ||
uses: druzsan/setup-matrix@feature/use-python-dockerfile | ||
with: | ||
matrix: '{ os: [ubuntu-latest, windows-latest], python-version: [3.8, 3.10, 3.12] }' | ||
continue-on-error: true | ||
- if: steps.expected-to-fail.outcome != 'failure' | ||
run: echo "Step expected to fail didn't fail" && exit 1 | ||
setup-matrix-macos: | ||
runs-on: macos-latest | ||
steps: | ||
- id: expected-to-fail | ||
uses: druzsan/setup-matrix@feature/use-python-dockerfile | ||
with: | ||
matrix: '{ os: [ubuntu-latest, windows-latest], python-version: [3.8, 3.10, 3.12] }' | ||
continue-on-error: true | ||
- if: steps.expected-to-fail.outcome != 'failure' | ||
run: echo "Step expected to fail didn't fail" && exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: '⏱️ Quickstart' | ||
|
||
on: | ||
push: | ||
schedule: | ||
- cron: '0 6 * * *' | ||
workflow_dispatch: | ||
|
||
# This workflow serves for multiple purposes: | ||
# - Action integration test | ||
# - Quickstart example | ||
|
||
jobs: | ||
# Setup matrix | ||
setup-matrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.setup-matrix.outputs.matrix }} | ||
steps: | ||
- id: setup-matrix | ||
uses: druzsan/setup-matrix@feature/use-python-dockerfile | ||
with: | ||
# Use | to preserve valid YAML syntax | ||
matrix: | | ||
fruit: [apple, pear] | ||
animal: [quick red fox, lazy dog] | ||
include: | ||
- color: green | ||
- color: pink | ||
animal: quick red fox | ||
- color: brown | ||
animal: cat | ||
exclude: | ||
- fruit: apple | ||
animal: lazy dog | ||
# Setup python and print version | ||
echo: | ||
needs: setup-matrix | ||
strategy: | ||
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | | ||
echo "fruit: ${{ matrix.fruit }}, animal: ${{ matrix.fruit }}, color: ${{ matrix.color }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: '🧪 Unit Test (built-in matrix)' | ||
|
||
on: push | ||
|
||
# This workflow serves for multiple purposes: | ||
# - Action code test | ||
# - Action integration test | ||
# - Advanced usage example (dynamic matrix) | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: '🧪 Unit Test' | ||
|
||
on: | ||
push: | ||
schedule: | ||
- cron: '0 6 * * *' | ||
workflow_dispatch: | ||
|
||
# This workflow serves for multiple purposes: | ||
# - Action code test | ||
# - Action integration test | ||
# - Advanced usage example (dynamic matrix) | ||
|
||
jobs: | ||
# Setup matrix | ||
setup-matrix: | ||
name: '🧱 Build Matrix' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.setup-matrix.outputs.matrix }} | ||
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 | ||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
dev/ | ||
|
||
.vscode/ | ||
.idea/ | ||
.direnv/ | ||
.dev/ | ||
.venv/ | ||
|
||
__pycache__/ | ||
.mypy_cache/ | ||
.pytest_cache/ | ||
.ruff_cache/ | ||
node_modules/ |
Oops, something went wrong.