Skip to content

Commit

Permalink
ci: edit publish workflow and fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
k4black committed Jun 25, 2023
1 parent cb4d0ad commit af11510
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,23 @@ jobs:
echo "VERSION"
echo "CHANGELOG"
external-build-workflow:
uses: ./.github/workflows/build.yml
with:
CIBW_SKIP: "pp* cp36-* cp37-*"
CIBW_BUILD: "cp*-macosx* cp*-manylinux*"
secrets: inherit

release-python-package:
needs: update-version-and-changelog
needs: [external-build-workflow, update-release-github, update-version-and-changelog]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
ref: ${{ github.ref_name }}
- name: Setup Python 3.11
uses: actions/setup-python@v4
name: artifact # if `name: artifact` is omitted, the action will create extra parent dir
path: dist
# TODO: Trusted publishing
- uses: pypa/gh-action-pypi-publish@release/v1
with:
python-version: 3.11
cache: 'pip' # caching pip dependencies
- name: Build python package
run: | # TODO: build so file?
python -m pip install wheel build twine
python -m pip wheel . --no-deps --wheel-dir dist
python -m twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} dist/*
password: ${{ secrets.PYPI_TOKEN }}
9 changes: 3 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,26 @@ jobs:
# run: python -m mypy codebleu

external-build-workflow:
name: Call wheel and sdist build workflow
uses: ./.github/workflows/build.yml
with:
CIBW_SKIP: "pp* cp36-* cp37-*"
CIBW_BUILD: "cp*-macosx* cp*-manylinux*"
secrets: inherit

test-python:
needs: [external-build-workflow]
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
os: [ubuntu-latest, macos-latest]
fail-fast: false
name: Test wheel on ${{ matrix.os }} and Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
needs: [external-build-workflow]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
name: artifact # if `name: artifact` is omitted, the action will create extra parent dir
path: dist
- name: Show dist files
run: ls -lah ./dist
Expand All @@ -67,7 +64,7 @@ jobs:
# force install package from local dist directory
# TODO: check the sdist package is not installed
rm -rf ./dist/*.tar.gz
pip install --update --no-deps --no-index --find-links=./dist codebleu
pip install --upgrade --no-deps --no-index --find-links=./dist codebleu
# install dependencies for the package and tests
pip install .[test]
- name: Test itself
Expand Down

0 comments on commit af11510

Please sign in to comment.