diff --git a/.github/workflows/citation.yaml b/.github/workflows/citation.yaml new file mode 100644 index 0000000..3e68ee6 --- /dev/null +++ b/.github/workflows/citation.yaml @@ -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 "action@github.com" + 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 + ) diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml new file mode 100644 index 0000000..1b59ce9 --- /dev/null +++ b/.github/workflows/pypi.yaml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yaml similarity index 69% rename from .github/workflows/test.yml rename to .github/workflows/test.yaml index 155b965..50a0850 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yaml @@ -1,6 +1,7 @@ +--- name: Test -on: +on: # yamllint disable-line rule:truthy push: branches: [master] pull_request: @@ -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 diff --git a/.github/workflows/update_citation.yaml b/.github/workflows/update_citation.yaml deleted file mode 100644 index 8f3db68..0000000 --- a/.github/workflows/update_citation.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: Update CITATION.cff on Release - -on: - release: - types: [published] - workflow_dispatch: - -jobs: - update-citation: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - ref: refs/heads/master - - - name: Set up Python - uses: actions/setup-python@v3 - 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 changes - run: | - git config --local user.email "action@github.com" - 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) diff --git a/Makefile b/Makefile index 84ec796..0c191af 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.rst b/README.rst index 5a72718..a08015a 100644 --- a/README.rst +++ b/README.rst @@ -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