fix: look for 'e'/'p' to choose electronic standard number (TT-944) (… #10
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 pipeline | |
on: [push] | |
jobs: | |
lint-and-test: | |
name: Run linting, typecheck, and tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -r test/requirements.txt | |
- name: Linting | |
run: | | |
flake8 -v | |
pylint metadata_extract src diff test *.py | |
- name: Type-check | |
run: mypy metadata_extract src diff main.py | |
- name: Running tests | |
run: python -m pytest --cov=metadata_extract | |
build: | |
name: Create Docker image | |
needs: lint-and-test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: nationallibraryofnorway/meteor | |
tags: | | |
type=semver,pattern={{version}} | |
type=ref,event=branch | |
type=ref,event=pr | |
- name: Build image | |
uses: docker/build-push-action@v4 | |
with: | |
push: false | |
context: . | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
file: Dockerfile | |
build-args: | | |
USE_GIELLA=true | |
publish: | |
name: Create and push Docker image | |
needs: lint-and-test | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: nationallibraryofnorway/meteor | |
tags: | | |
type=semver,pattern={{version}} | |
type=ref,event=branch | |
type=ref,event=pr | |
- name: Build image | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
context: . | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
file: Dockerfile | |
build-args: | | |
USE_GIELLA=true | |
- name: Docker Hub Description | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: nationallibraryofnorway/meteor | |
short-description: ${{ github.event.repository.description }} | |
readme-filepath: ./README.md |