Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upload frozen requirements to release assets + add build / PyPI publish workflow #592

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
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
20 changes: 20 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: build

on:
release:
types:
- released
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
build:
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v1
with:
upload_to_pypi: ${{ (github.event_name == 'release') && (github.event.action == 'released') }}
secrets:
pypi_token: ${{ secrets.PYPI_TOKEN }}
45 changes: 29 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,53 @@
name: test

on: [pull_request]
on:
pull_request:
release:
types:
- created

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

test:

name: Python ${{ matrix.python-version }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 5
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11']
runs-on:
- ubuntu-latest
- macos-latest
python-version:
- '3.10'
- '3.11'
- '3.12'
fail-fast: false

runs-on: ${{ matrix.runs-on }}
name: Python ${{ matrix.python-version }} (${{ matrix.runs-on }})
steps:
- uses: actions/checkout@v4

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

- name: set useful environment variables
run: |
echo PYTHONVERSION=${{ matrix.python-version }} >> $GITHUB_ENV
echo EXOCTK_DATA=$RUNNER_WORKSPACE/exoctk/exoctk/data/ >> $GITHUB_ENV

- run: pip freeze

- run: pip install .
- run: pip freeze > requirements-py${{ matrix.python-version }}-${{ matrix.os }}.txt
- run: pip install .[test]

- run: pytest exoctk/tests/
- run: pytest exoctk/tests/ --cov ./ --cov-report term-missing --cov xml -n auto
- uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- uses: actions/upload-artifact@v3
with:
path: requirements-py${{ matrix.python-version }}-${{ matrix.os }}.txt
- if: (github.event_name == 'release' && github.event.action == 'published')
uses: svenstaro/upload-release-action@v2
with:
file: requirements-py${{ matrix.python-version }}-${{ matrix.os }}.txt
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -70,6 +70,7 @@ dynamic = ["version"]
test = [
"pytest",
"pytest-cov",
"pytest-xdist",
]
docs = [
"sphinx",
Loading