ci: updated poetry step in release.yml #251
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
pull_request: | |
branches: | |
- master | |
- develop | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: huspacy | |
strategy: | |
matrix: | |
python-version: [ "3.7", "3.8", "3.9", "3.10" ] | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: Gr1N/setup-poetry@v8 | |
with: | |
poetry-version: 1.5.1 | |
- name: Install Python dependencies | |
run: poetry install --with dev | |
- uses: actions/cache@v2 | |
with: | |
path: huspacy/.venv | |
key: ${{ runner.os }}-py${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }} | |
- name: Test with pytest | |
run: | | |
poetry run pytest -m "not slow" | |
# - name: Setup flake8 annotations | |
# uses: rbialon/flake8-annotations@v1 | |
# | |
# - name: Lint with flake8 | |
# run: | | |
# poetry run flake8 huspacy ../scripts | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: Build package | |
env: | |
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} | |
run: | | |
echo "Running the pipeline on $BRANCH_NAME branch" | |
sed -i -E 's/name = \"huspacy\"/name = \"huspacy-nightly\"/' pyproject.toml | |
poetry version $(poetry version --short)-dev.$GITHUB_RUN_NUMBER | |
poetry version --short | |
poetry build -f wheel | |
- uses: actions/upload-artifact@v3 | |
if: matrix.python-version == '3.9' | |
with: | |
name: wheel-${{ matrix.python-version }} | |
path: huspacy/dist/*.whl | |
publish_package: | |
runs-on: ubuntu-latest | |
needs: build_and_test | |
defaults: | |
run: | |
working-directory: huspacy | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout | |
- uses: Gr1N/setup-poetry@v8 | |
with: | |
poetry-version: 1.5.1 | |
- uses: actions/cache@v2 | |
with: | |
path: huspacy/.venv | |
key: ${{ runner.os }}-py${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }} | |
- name: Install Python dependencies | |
run: poetry install --with dev | |
- name: Download all workflow run artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: wheel-3.9 | |
path: huspacy/dist | |
- name: Publish nightly package | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: poetry run twine upload --non-interactive dist/* |