Skip to content

Merge pull request #11 from helpmefindaname/fix_output_vocab_size #76

Merge pull request #11 from helpmefindaname/fix_output_vocab_size

Merge pull request #11 from helpmefindaname/fix_output_vocab_size #76

Workflow file for this run

name: 'Run tests for ci cd'
on:
push:
branches: [ main ]
tags:
- "*"
pull_request:
branches: [ main ]
env:
is_package: true # set this to true if you use this template for a package that you want to publish
POETRY_VERSION: 1.5.1
jobs:
prep-vars:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-vars.outputs.matrix }}
publish_docker: ${{ steps.set-vars.outputs.publish_docker }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- id: set-vars
run: |
echo "matrix={\"python-version\":${{ env.is_package && '[ \"3.8\", \"3.9\", \"3.10\"]' || '[ \"3.10\" ]' }} }" >> $GITHUB_OUTPUT
echo "publish_docker=${{env.publish_docker}}" >> $GITHUB_OUTPUT
test:
runs-on: ubuntu-latest
needs: prep-vars
strategy:
matrix: ${{fromJson(needs.prep-vars.outputs.matrix)}}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- name: setup python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install Dependencies
run: poetry install
- name: Run tests
run: poetry run pytest -vv
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
needs: [test]
if: github.ref_type == 'tag'
env:
python-version: "3.10"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- name: setup python ${{ env.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.python-version }}
cache: 'poetry'
- name: Install Dependencies
run: poetry install
- name: Set the right version
run: poetry version ${{ github.ref_name }}
- name: Build a binary wheel and a source tarball
run: poetry build
- name: Publish
if: ${{env.is_package}}
run: |
poetry build -vv
poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }} -vv