Skip to content

Commit 8cfdf73

Browse files
authored
Merge pull request #7 from MoseleyBioinformaticsLab/merge_enhancement
New Workflows
2 parents c424a93 + 61d2540 commit 8cfdf73

23 files changed

+356
-264
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/codecov.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
name: Build Documentation
1+
name: Publish Documentation
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
8-
branches:
9-
- main
4+
workflow_call:
105

116
jobs:
12-
build:
13-
7+
publish-documentation:
148
runs-on: ubuntu-latest
15-
169
steps:
17-
- uses: actions/checkout@v2
18-
# Standard drop-in approach that should work for most people.
19-
- uses: ammaraskar/sphinx-action@master
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-python@v5
2012
with:
21-
docs-folder: "docs/"
13+
python-version: '3.x'
14+
- name: Upgrade pip, install package, install requirements, build docs
15+
run: |
16+
pip install --upgrade pip
17+
pip install .
18+
if [ -f ./docs/requirements.txt ]; then pip install -r ./docs/requirements.txt; fi
19+
pip install sphinx
20+
sphinx-build docs ./docs/_build/html/
2221
# Create an artifact of the html output.
2322
- uses: actions/upload-artifact@v1
2423
with:
@@ -33,11 +32,9 @@ jobs:
3332
git config --global user.name "${GITHUB_ACTOR}"
3433
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
3534
git clone "https://token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" --branch gh-pages --single-branch gh-pages
36-
3735
cp -r docs/_build/html/* gh-pages/
3836
cd gh-pages
3937
touch .nojekyll
40-
4138
git add .
4239
git commit -m "Update documentation." -a || true
4340
# The above command will fail if no changes were present, so we ignore
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Package and Documentation Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
release-version:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- id: parse-version
12+
name: Parse release version
13+
run: |
14+
echo "version=${RELEASE_VERSION/v/}" >> "$GITHUB_OUTPUT"
15+
env:
16+
RELEASE_VERSION: ${{ github.event.release.tag_name }}
17+
outputs:
18+
version: ${{ steps.parse-version.outputs.version }}
19+
publish-test-pypi:
20+
uses: ./.github/workflows/pypi.yml
21+
with:
22+
repository_url: https://test.pypi.org/legacy/
23+
secrets:
24+
API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}
25+
test-test-pypi:
26+
needs: [release-version, publish-test-pypi]
27+
uses: ./.github/workflows/tests.yml
28+
with:
29+
install_command: "python3 -m pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple academic_tracker==${{ needs.release-version.outputs.version }}"
30+
# publish-pypi:
31+
# needs: test-test-pypi
32+
# uses: ./.github/workflows/pypi.yml
33+
# with:
34+
# repository_url: https://upload.pypi.org/legacy/
35+
# secrets:
36+
# API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
37+
# test-pypi:
38+
# needs: [release-version, publish-pypi]
39+
# uses: ./.github/workflows/tests.yml
40+
# with:
41+
# install_command: "python3 -m pip install academic_tracker==${{ needs.release-version.outputs.version }}"
42+
# publish-documentation:
43+
# needs: test-pypi
44+
# uses: ./.github/workflows/documentation.yml

.github/workflows/pull_request.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Pull request
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
pull-request:
14+
uses: ./.github/workflows/tests.yml
15+
with:
16+
install_command: "python3 -m pip install -e ."

.github/workflows/pypi.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish package
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
repository_url:
7+
description: The URL of the PyPi distribution
8+
required: true
9+
type: string
10+
secrets:
11+
API_TOKEN:
12+
required: true
13+
14+
jobs:
15+
publish-package:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.x'
22+
- name: Install dependencies
23+
run: |
24+
python3 -m pip install --upgrade pip
25+
python3 -m pip install build
26+
- name: Build package
27+
run: python3 -m build
28+
- name: Publish package to a PyPi distribution
29+
uses: pypa/gh-action-pypi-publish@release/v1
30+
with:
31+
password: ${{ secrets.API_TOKEN }}
32+
repository-url: ${{ inputs.repository_url }}

.github/workflows/tests.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Run Tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
install_command:
7+
description: The command for installing the package to test.
8+
required: true
9+
type: string
10+
11+
jobs:
12+
run-tests:
13+
strategy:
14+
matrix:
15+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
16+
os: [ ubuntu-latest, windows-latest, macOS-latest ]
17+
runs-on: ${{matrix.os}}
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install testing environment
25+
run: |
26+
python3 -m pip install --upgrade pip
27+
python3 -m pip install pytest pytest-mock pytest-cov
28+
- name: Install package
29+
uses: Wandalen/wretry.action@master
30+
with:
31+
command: ${{ inputs.install_command }}
32+
attempt_limit: 10
33+
attempt_delay: 10000
34+
- name: Run tests on package
35+
run: pytest --cov-branch --cov-report=term-missing --cov=academic_tracker tests/
36+
# - name: Debug with tmate on failure
37+
# if: ${{ failure() }}
38+
# uses: mxschmitt/action-tmate@v3
39+
# with:
40+
# limit-access-to-actor: true

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ coverage.xml
1414
htmlcov/
1515
README_old.rst
1616
testing_scratch/
17-
tests/testing_files/new_intermediate_results/
17+
tests/testing_files/new_intermediate_results/
18+
src/academic_tracker/_version.py

CITATION.cff

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ preferred-citation:
2020
- family-names: "Thompson"
2121
given-names: "Travis"
2222
orcid: "https://orcid.org/0000-0002-8198-1327"
23+
- family-names: "Powell"
24+
given-names: "Christian"
25+
orcid: "https://orcid.org/0000-0002-4242-080X"
2326
- family-names: "Moseley"
2427
given-names: "Hunter"
2528
orcid: "https://orcid.org/0000-0003-3995-5368"

README.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ Academic Tracker
99
:target: https://pypi.org/project/academic_tracker
1010
:alt: Supported Python versions
1111

12-
.. image:: https://github.com/MoseleyBioinformaticsLab/academic_tracker/actions/workflows/build.yml/badge.svg
13-
:target: https://github.com/MoseleyBioinformaticsLab/academic_tracker/actions/workflows/build.yml
14-
:alt: Build status
12+
..
13+
.. image:: https://github.com/MoseleyBioinformaticsLab/academic_tracker/actions/workflows/build.yml/badge.svg
14+
:target: https://github.com/MoseleyBioinformaticsLab/academic_tracker/actions/workflows/build.yml
15+
:alt: Build status
1516
1617
.. image:: https://codecov.io/gh/MoseleyBioinformaticsLab/academic_tracker/branch/main/graphs/badge.svg?branch=main
1718
:target: https://codecov.io/gh/MoseleyBioinformaticsLab/academic_tracker

0 commit comments

Comments
 (0)