Suppress TensorFlow info messages to debug level #655
Workflow file for this run
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: CI/CD | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
pull_request: | |
workflow_dispatch: | |
env: | |
PIPX_HOME: "/home/runner/.cache/pipx" | |
PIPX_BIN_DIR: "/home/runner/.local/bin" | |
POETRY_VERSION: "1.5.1" | |
jobs: | |
lint: | |
runs-on: ubuntu-22.04 | |
name: lint with isort, Black & flake8 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Prepare: restore caches, install Poetry, set up Python" | |
uses: ./.github/actions/prepare | |
with: | |
python-version: "3.10" | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- name: Install Python dev dependencies | |
run: | | |
poetry install --only dev | |
- name: Lint with isort | |
run: | | |
poetry run isort . --check-only --diff | |
- name: Lint with Black | |
run: | | |
poetry run black . --check --diff | |
- name: Lint with flake8 | |
run: | | |
poetry run flake8 | |
time-startup: | |
runs-on: ubuntu-22.04 | |
name: check CLI startup time | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Prepare: restore caches, install Poetry, set up Python" | |
id: prepare | |
uses: ./.github/actions/prepare | |
with: | |
python-version: "3.9" | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- name: Install Python dependencies | |
run: | | |
poetry install | |
- name: Check startup time | |
run: | | |
poetry run tests/time-startup.sh | |
test: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 15 | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10"] | |
name: test on Python ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install system packages | |
run: | | |
sudo apt-get install \ | |
libvoikko1 \ | |
voikko-fi | |
- name: "Prepare: restore caches, install Poetry, set up Python" | |
id: prepare | |
uses: ./.github/actions/prepare | |
with: | |
python-version: ${{ matrix.python-version }} | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- name: Install Python dependencies | |
run: | | |
# Selectively install the optional dependencies for some Python versions | |
# For Python 3.8: | |
if [[ ${{ matrix.python-version }} == '3.8' ]]; then | |
poetry install -E "nn omikuji yake voikko stwfsa"; | |
fi | |
# For Python 3.9: | |
if [[ ${{ matrix.python-version }} == '3.9' ]]; then | |
poetry install -E "fasttext spacy"; | |
# download the small English pretrained spaCy model needed by spacy analyzer | |
poetry run python -m spacy download en_core_web_sm --upgrade-strategy only-if-needed | |
fi | |
# For Python 3.10: | |
if [[ ${{ matrix.python-version }} == '3.10' ]]; then | |
poetry install -E "nn omikuji yake stwfsa"; | |
fi | |
poetry run python -m nltk.downloader punkt | |
- name: Test with pytest | |
run: | | |
poetry run pytest --cov=./ --cov-report xml | |
if [[ ${{ matrix.python-version }} == '3.9' ]]; then | |
poetry run pytest --cov=./ --cov-report xml --cov-append -m slow | |
fi | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 | |
- name: Save cache | |
if: steps.prepare.outputs.cache-matched-key != format('poetry-installation-and-cache-{0}-{1}-{2}', matrix.python-version, env.POETRY_VERSION, hashFiles('**/poetry.lock')) | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
~/.cache/pipx/venvs | |
~/.local/bin | |
~/.cache/pypoetry/ | |
# A new key is created to update the cache if some dependency has been updated | |
key: poetry-installation-and-cache-${{ matrix.python-version }}-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }} | |
test-docker-image: | |
name: "test Docker image" | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 15 | |
steps: | |
- name: "Build image for testing" | |
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 # v3.2.0 | |
with: | |
push: false | |
tags: test-image | |
- name: "Test with pytest" | |
run: | | |
docker run --rm --workdir /Annif test-image pytest -p no:cacheprovider | |
publish-docker-latest: | |
name: publish latest Docker image | |
needs: [lint, test, test-docker-image] | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 15 | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Login to Quay.io | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 | |
with: | |
registry: quay.io | |
username: ${{ secrets.YHTEENTOIMIVUUSPALVELUT_QUAY_IO_USERNAME }} | |
password: ${{ secrets.YHTEENTOIMIVUUSPALVELUT_QUAY_IO_PASSWORD }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@57396166ad8aefe6098280995947635806a0e6ea # v4.1.1 | |
with: | |
images: quay.io/natlibfi/annif | |
tags: | | |
latest | |
- name: Build and push to Quay.io | |
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 # v3.2.0 | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
publish-release: | |
name: publish release | |
needs: [lint, test, test-docker-image] | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Prepare: restore caches, install Poetry, set up Python" | |
uses: ./.github/actions/prepare | |
with: | |
python-version: '3.10' | |
poetry-version: ${{ env.POETRY_VERSION }} | |
- name: Build and publish distribution to PyPI | |
env: | |
POETRY_HTTP_BASIC_PYPI_USERNAME: __token__ | |
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
poetry publish --build | |
- name: Login to Quay.io | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 | |
with: | |
registry: quay.io | |
username: ${{ secrets.YHTEENTOIMIVUUSPALVELUT_QUAY_IO_USERNAME }} | |
password: ${{ secrets.YHTEENTOIMIVUUSPALVELUT_QUAY_IO_PASSWORD }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@57396166ad8aefe6098280995947635806a0e6ea # v4.1.1 | |
with: | |
images: quay.io/natlibfi/annif | |
tags: | | |
type=semver,pattern={{version}},suffix=-{{date 'YYYYMMDD'}} | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Build and push to Quay.io | |
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 # v3.2.0 | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |