Skip to content

Commit

Permalink
clean up github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
scottprahl committed Oct 7, 2023
1 parent 98db3f7 commit 2fa4485
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 46 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/citation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: Update CITATION.cff on Release

on: # yamllint disable-line rule:truthy
release:
types: [published]
workflow_dispatch:

jobs:
update-citation:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@master
with:
ref: refs/heads/master

- name: Set up Python
uses: actions/setup-python@master
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests PyYAML
- name: Update CITATION.cff
run: |
python .github/scripts/update_citation.py
- name: Commit and Push CITATION.cff Update
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git diff --exit-code || (
git add CITATION.cff &&
git commit -m "Update CITATION.cff with latest release date" &&
git push
)
36 changes: 36 additions & 0 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: pypi

on: # yamllint disable-line rule:truthy
release:
types: [published]
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest

environment:
name: pypi repository
url: https://pypi.org/p/pyspeckle

permissions:
id-token: write

steps:
- uses: actions/checkout@master

- uses: actions/setup-python@master
with:
python-version: 3.11

- name: Build
run: |
pip install setuptools wheel twine build
pip install -r requirements.txt
python -m build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
17 changes: 9 additions & 8 deletions .github/workflows/test.yml → .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Test

on:
on: # yamllint disable-line rule:truthy
push:
branches: [master]
pull_request:
Expand All @@ -15,19 +16,19 @@ jobs:
strategy:
matrix:
python-version: ["3.8", "3.11"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@master

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@master
with:
python-version: ${{ matrix.python-version }}

- name: Install package and dependencies
run: |
pip install -U pip setuptools wheel
pip install -r requirements.txt
pip install -e . # current package in editable mode
- name: Test with pytest
run: python -m pytest tests/test_basics.py
run: pytest tests/test_basics.py
36 changes: 0 additions & 36 deletions .github/workflows/update_citation.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ lintcheck:
-pylint pyspeckle/pyspeckle.py
-pylint pyspeckle/__init__.py

yamlcheck:
-yamllint .github/workflows/pypi.yaml
-yamllint .github/workflows/test.yaml
-yamllint .github/workflows/citation.yaml

doccheck:
-pydocstyle pyspeckle/pyspeckle.py
-pydocstyle pyspeckle/__init__.py
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ by Scott Prahl
:target: https://github.com/scottprahl/pyspeckle/blob/master/LICENSE.txt
:alt: License

.. image:: https://github.com/scottprahl/pyspeckle/actions/workflows/test.yml/badge.svg
:target: https://github.com/scottprahl/pyspeckle/actions/workflows/test.yml
.. image:: https://github.com/scottprahl/pyspeckle/actions/workflows/test.yaml/badge.svg
:target: https://github.com/scottprahl/pyspeckle/actions/workflows/test.yaml
:alt: Testing

.. image:: https://readthedocs.org/projects/pyspeckle2/badge?color=68CA66
Expand Down

0 comments on commit 2fa4485

Please sign in to comment.