Skip to content

Commit

Permalink
Fix/cicd publish (#22)
Browse files Browse the repository at this point in the history
* Fixing CI/CD publish issues

* Working on cicd
  • Loading branch information
djpugh authored Dec 27, 2023
1 parent b71fdbb commit ac46cc6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 18 deletions.
36 changes: 28 additions & 8 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,15 @@ jobs:
- shell: bash
run: |
pip install $(ls -t dist/*.whl | head -n1)
pip install -U pytest setuptools
- shell: bash
name: Install tomli
run: |
pip install tomli
- shell: python
name: Install test dependencies
run: |
import subprocess, tomli
subprocess.check_call(['pip', 'install']+tomli.load(open('./repo/pyproject.toml', 'rb'))['project']['optional-dependencies']['dev-test'])
- shell: bash
run: pytest ./repo/tests/unit
- shell: bash
Expand Down Expand Up @@ -425,7 +433,7 @@ jobs:
with:
name: build
path: dist
- name: Publish package distributions to TestPyPI
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1


Expand All @@ -450,14 +458,17 @@ jobs:
python-version: "3.12"
- name: Get Version
id: get_version
# Cut is not zero indexed
# > cut: fields are numbered from 1
# > Try 'cut --help' for more information.
run: |
tag_name=$(echo ${{github.ref}} | cut -d/ -f3)
tag_name=$(echo ${{github.ref}} | cut -d/ -f2)
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT
major=$(echo $tag_name | cut -d. -f0)
major=$(echo $tag_name | cut -d. -f1)
echo "major=$major" >> $GITHUB_OUTPUT
minor=$(echo $tag_name | cut -d. -f1)
minor=$(echo $tag_name | cut -d. -f2)
echo "minor=$minor" >> $GITHUB_OUTPUT
patch=$(echo $tag_name | cut -d. -f2)
patch=$(echo $tag_name | cut -d. -f3)
echo "patch=$patch" >> $GITHUB_OUTPUT
- name: Check Tag doesn't exist
id: check_tag
Expand All @@ -468,13 +479,22 @@ jobs:
else
echo "tag_exists=false" >> $GITHUB_OUTPUT
fi
- shell: bash
name: Install tomli
run: |
pip install tomli
- shell: python
name: Install test dependencies
run: |
import subprocess, tomli
subprocess.check_call(['pip', 'install']+tomli.load(open('pyproject.toml', 'rb'))['project']['optional-dependencies']['dev-docs'])
- name: Deploy
run: |
git config user.name github-actions
git config user.email [email protected]
mike set-default latest --config-file docs/mkdocs.yml
mike deploy -u "${{ steps.get_version.outputs.major }}.${{ steps.get_version.outputs.minor}}" latest --config-file docs/mkdocs.yml -p
mike set-default latest --config-file docs/mkdocs.yml
git checkout gh-pages
git pull origin
git tag docs-${{ steps.get_version.outputs.tag_name }}
git push origin
git push origin docs-${{ steps.get_version.outputs.tag_name }}
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,3 @@
``nskit`` is a python package that provides useful utilities and implementations for creating and managing a namespaced codebase for python and other programming languages.

Please see the documentation at https://djpugh.github.io/nskit for more information (the contribution guidelines can also be found at [docs/source/developing/index.md](docs/source/developing/index.md))



# ToDo:

- [ ] Add mkdocs templates
- [ ] make Jinja2 environment extensible.
6 changes: 3 additions & 3 deletions src/nskit/recipes/python/ingredients/noxfile.py.template
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def test(session):
else:
test_folder = ['tests']
session.install('.[dev,dev-test]')
args = []
for folder in test_folder:
args = []
args.append('-rs')
args.append(folder)
print(f'Test session: {folder}')
Expand All @@ -86,11 +86,11 @@ def test(session):
'--log-level=WARNING',
'--cov={{repo.py_name}}',
'--cov-report',
'xml:reports/coverage.xml',
f'xml:reports/coverage-{folder}.xml',
'--cov-report',
'html:reports/htmlcov',
'--junitxml',
f'reports/{env_name}-test.xml',
f'reports/{env_name}-test-{folder}.xml',
*args)


Expand Down

0 comments on commit ac46cc6

Please sign in to comment.