Skip to content

Commit

Permalink
Merge branch 'main' into paddy/issue-358
Browse files Browse the repository at this point in the history
  • Loading branch information
paddyroddy committed Nov 5, 2024
2 parents 0df5a8c + 209eb24 commit f5ea6cd
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 68 deletions.
37 changes: 22 additions & 15 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,45 @@ on:
pull_request:
paths:
- glass/**
# ensure the draft PRs are tested when ready
types:
- opened
- ready_for_review
- reopened
- synchronize

concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

env:
# The "FORCE_COLOR" variable, when set to 1,
# tells Nox to colorize itself.
FORCE_COLOR: "1"
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
jobs:
test-examples:
name: Test examples
if: github.event.pull_request.draft == false
name: Test examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5

- name: Cache nox
uses: actions/cache@v4
with:
python-version: 3.x
key: test-${{ hashFiles('pyproject.toml') }}
path: .nox

- name: Set up Python
uses: actions/setup-python@v5
with:
cache-dependency-path: pyproject.toml
cache: pip
python-version: 3.x

- name: Install nox
run: pip install nox
run: python -m pip install nox

- name: Run examples
run: nox -s examples
env:
FORCE_COLOR: 1
10 changes: 6 additions & 4 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
---
name: PR Title Checker

on:
pull_request_target:
types:
- opened
- edited
- synchronize
- labeled
- opened
- synchronize
- unlabeled

jobs:
check-pr-title:
if: ${{ github.actor != 'pre-commit-ci[bot]' }}
if: github.actor != 'pre-commit-ci[bot]'
runs-on: ubuntu-latest
steps:
- uses: thehanimo/[email protected]
- name: Enfore PR title format
uses: thehanimo/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pass_on_octokit_error: false
23 changes: 13 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
workflow_dispatch:
inputs:
target:
description: Deployment target. Can be pypi or testpypi.
default: testpypi
description: Deployment target. Can be pypi or testpypi.
release:
types:
- published
Expand All @@ -15,46 +15,49 @@ jobs:
dist:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4

- name: Build SDist and wheel
run: pipx run build

- name: Check metadata
run: pipx run twine check dist/*

- uses: actions/upload-artifact@v4
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
path: dist/*

publish:
needs:
- dist
needs: dist
runs-on: ubuntu-latest
environment:
name: publish
url: https://pypi.org/p/glass
permissions:
id-token: write

steps:
- uses: actions/download-artifact@v4
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: artifact
path: dist

- name: List distributions to be deployed
run: ls -l dist/

- if:
- name: Publish to PyPI
if: >-
github.event.inputs.target == 'pypi' || (github.event_name ==
'release' && github.event.action == 'published')
uses: pypa/gh-action-pypi-publish@release/v1

- if: github.event.inputs.target == 'testpypi'
- name: Publish to TestPyPI
if: github.event.inputs.target == 'testpypi'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
85 changes: 58 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,21 @@ on:
branches:
- main
pull_request:
# ensure the draft PRs are tested when ready
types:
- opened
- ready_for_review
- reopened
- synchronize

concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

env:
# The "FORCE_COLOR" variable, when set to 1,
# tells Nox to colorize itself.
FORCE_COLOR: "1"
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
jobs:
tests:
name: Tests
if: github.event.pull_request.draft == false
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -37,24 +30,45 @@ jobs:
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5

- name: Cache nox
uses: actions/cache@v4
with:
key: test-${{ hashFiles('pyproject.toml') }}
path: .nox

- name: Set up Python
uses: actions/setup-python@v5
with:
cache-dependency-path: pyproject.toml
cache: pip
python-version: ${{ matrix.python-version }}

- name: Install nox and coverage.py
run: pip install coverage[toml] nox
run: python -m pip install coverage[toml] nox

- name: Install ubuntu dependencies for fitsio
run: |
run: |-
sudo apt-get update
sudo apt-get install libbz2-dev
sudo apt-get install -y libbz2-dev
- name: Run doctests
run: nox -s doctests-${{ matrix.python-version }} --verbose
env:
FORCE_COLOR: 1

- name: Run tests and generate coverage report
run: nox -s coverage-${{ matrix.python-version }} --verbose
env:
FORCE_COLOR: 1

- name: Coveralls requires XML report
run: coverage xml

- name: Run Coveralls in parallel
uses: coverallsapp/github-action@v2
with:
Expand All @@ -63,46 +77,63 @@ jobs:

aggregate-tests:
needs: tests
if: ${{ always() }}
if: always()
runs-on: ubuntu-latest
steps:
- name: Coveralls finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
carryforward: run-3.9,run-3.10,run-3.11,run-3.12
parallel-finished: true

build:
name: Build
if: github.event.pull_request.draft == false
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5

- name: Set up Python
uses: actions/setup-python@v5
with:
cache-dependency-path: pyproject.toml
cache: pip
python-version: 3.x

- name: Install nox
run: pip install nox
run: python -m pip install nox

- name: Build SDist and wheel
run: nox -s build --verbose
env:
FORCE_COLOR: 1

docs:
name: Docs
if: github.event.pull_request.draft == false
name: Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
cache-dependency-path: pyproject.toml
cache: pip
python-version: 3.x

- name: Install dependencies
run: |
run: |-
sudo apt-get update
sudo apt-get install pandoc
pip install nox
sudo apt-get install -y pandoc
python -m pip install nox
- name: Build docs
run: nox -s docs --verbose
env:
FORCE_COLOR: 1
12 changes: 0 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,23 +134,11 @@ src = [
]
lint.ignore = [
"COM812", # missing-trailing-comma (ruff-format recommended)
"COM819", # prohibited-trailing-comma (ruff-format recommended)
"D203", # one-blank-line-before-class
"D206", # indent-with-spaces (ruff-format recommended)
"D212", # blank-line-before-class
"D300", # triple-single-quotes (ruff-format recommended)
"E111", # indentation-with-invalid-multiple (ruff-format recommended)
"E114", # indentation-with-invalid-multiple-comment (ruff-format recommended)
"E117", # over-indented (ruff-format recommended)
"ISC001", # single-line-implicit-string-concatenation (ruff-format recommended)
"ISC002", # multi-line-implicit-string-concatenation (ruff-format recommended)
"NPY201", # TODO: numpy2-deprecation
"Q000", # bad-quotes-inline-string (ruff-format recommended)
"Q001", # bad-quotes-multiline-string (ruff-format recommended)
"Q002", # bad-quotes-docstring (ruff-format recommended)
"Q003", # avoidable-escaped-quote (ruff-format recommended)
"RUF003", # ambiguous-unicode-character-comment
"W191", # tab-indentation (ruff-format recommended)
]
lint.isort = {known-first-party = [
"glass",
Expand Down

0 comments on commit f5ea6cd

Please sign in to comment.