Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .github/workflows/black.yml

This file was deleted.

6 changes: 2 additions & 4 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ on:
- '!main' # ... that is not main

jobs:
isort:
uses: ./.github/workflows/isort.yml
black:
uses: ./.github/workflows/black.yml
ruff:
uses: ./.github/workflows/ruff.yml
build:
uses: ./.github/workflows/build.yml
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
pip install .[test]
- name: Run tests & coverage
run: |
coverage run -p -m unittest discover -v -s ./tests
pytest .
8 changes: 2 additions & 6 deletions .github/workflows/external_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ jobs:
run: |
echo "LOCAL_PR=${{ env.LOCAL_PR }}" >> $GITHUB_OUTPUT

isort:
ruff:
needs: variables
# if PR is external, trigger the tests on push or new PR
if: ${{ needs.variables.outputs.LOCAL_PR == 'false'}}
uses: ./.github/workflows/isort.yml
black:
needs: variables
if: ${{ needs.variables.outputs.LOCAL_PR == 'false' }}
uses: ./.github/workflows/black.yml
uses: ./.github/workflows/ruff.yml
build:
needs: variables
if: ${{ needs.variables.outputs.LOCAL_PR == 'false' }}
Expand Down
29 changes: 15 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Bump version, create release and deploy
name: Build, test, deploy

on:
push:
Expand All @@ -7,23 +7,21 @@ on:


jobs:
isort:
uses: ./.github/workflows/isort.yml
black:
uses: ./.github/workflows/black.yml
ruff:
uses: ./.github/workflows/ruff.yml
build:
uses: ./.github/workflows/build.yml

bump:
needs: [isort, black, build]
needs: [ruff, build]
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.semver.outputs.next }}
old_tag: ${{ steps.semver.outputs.current }}

steps:
- name: Create Github token
uses: actions/create-github-app-token@v1
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.CODEGEN_APP_ID }}
Expand All @@ -49,7 +47,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Create Github token
uses: actions/create-github-app-token@v1
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.CODEGEN_APP_ID }}
Expand Down Expand Up @@ -92,7 +90,7 @@ jobs:

steps:
- name: Create Github token
uses: actions/create-github-app-token@v1
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.CODEGEN_APP_ID }}
Expand Down Expand Up @@ -144,7 +142,7 @@ jobs:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Create Github token
uses: actions/create-github-app-token@v1
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.CODEGEN_APP_ID }}
Expand All @@ -165,11 +163,14 @@ jobs:
with:
python-version: 3.11

- name: Install dependencies and build dist
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Build
run: |
python -m pip install --upgrade pip
pip install build
python -m build
uv build

- name: Publish package distributions to Test.PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
6 changes: 3 additions & 3 deletions .github/workflows/isort.yml → .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Isort
name: Ruff

on: [workflow_call]

jobs:
isort:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: isort/isort-action@master
- uses: astral-sh/ruff-action@v3
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ default_install_hook_types:
- pre-commit
- commit-msg
repos:
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.1
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.11.5
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.3.0
hooks:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[![Build Status](https://github.com/drodarie/test_actions/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/drodarie/test_actions/actions/workflows/build.yml?query=branch%3Amain)
[![Ruff](https://github.com/drodarie/test_actions/actions/workflows/ruff.yml/badge.svg?branch=main)](https://github.com/drodarie/test_actions/actions/workflows/ruff.yml?query=branch%3Amain)

# test_actions
Test Github actions for python project
46 changes: 36 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "test-actions"
Expand All @@ -12,20 +12,46 @@ requires-python = ">=3.10"
version = "1.3.0"
dynamic = ["description"]
dependencies = [
"numpy (>=2.2.3,<3.0.0)",
"scipy (>=1.15.2,<2.0.0)",
"pynrrd (>=1.1.3,<2.0.0)",
"numpy>=2.2.4",
"pynrrd>=1.1.3",
"scipy>=1.15.2",
]

[project.optional-dependencies]
test = ["coverage (>=7.6.12,<8.0.0)"]
dev = ["black (>=25.1.0,<26.0.0)", "isort (>=6.0.0,<7.0.0)", "pre-commit (>=4.1.0,<5.0.0)", "bump-my-version (>=0.32.1,<0.33.0)"]
test = [
"pytest>=8.3.5",
"pytest-cov>=6.1.1",
"pytest-sugar>=1.0.0",
]
dev = [
"pre-commit>=4.2.0",
"ruff>=0.11.5",
]

[tool.black]
[tool.pytest.ini_options]
addopts = """
--cov
--cov-report html:'cover/html'
--cov-report xml:'cover/coverage.xml'
"""

[tool.ruff]
exclude = [".venv"]
line-length = 100
indent-width = 4

[tool.ruff.lint]
select = [ "E", "F", "UP", "B", "SIM", "I" ]
ignore = [ ]
fixable = [ "ALL" ]
unfixable = [ ]

[tool.isort]
profile = "black"
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-line-length = "dynamic"

[tool.bumpversion]
current_version = "1.3.0"
Expand Down
3 changes: 3 additions & 0 deletions test_actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@

import nrrd
import numpy as np

np.arange(0, 10, 0.1)
print(nrrd.__version__)