Skip to content

Update docker-image.yml #2

Update docker-image.yml

Update docker-image.yml #2

Workflow file for this run

name: docat ci
on: [push, pull_request]
jobs:
python-test:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: install dependencies
working-directory: docat
run: |
python -m pip install --upgrade pip
python -m pip install poetry==1.7.1
python -m poetry install
- name: run backend linter
working-directory: docat
run: |
python -m poetry run flake8 docat tests
- name: run backend static code analysis
working-directory: docat
run: |
python -m poetry run mypy .
- name: run backend tests
working-directory: docat
run: |
python -m poetry run pytest
javascript-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16'
- name: install JavaScript dependencies
working-directory: web
run: yarn install
- name: building frontend
working-directory: web
run: yarn build
- name: run linter against code
working-directory: web
run: yarn lint
- name: run test suite
working-directory: web
run: yarn test
container-image:
runs-on: ubuntu-latest
needs: [python-test, javascript-test]
strategy:
max-parallel: 2
matrix:
registry:
- name: ghcr.io
org: ${{ github.repository_owner }}
token: GITHUB_TOKEN
- name: docker.io
org: randombenj
token: DOCKERHUB
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build Image
run: |
docker build . --build-arg DOCAT_VERSION=$(git describe --tags --always) --tag ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat:${{ github.sha }}
docker tag ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat:${{ github.sha }} ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat:unstable
- name: tag latest and version on release
run: |
docker tag ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat:${{ github.sha }} ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat:$(git describe --tags)
docker tag ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat:${{ github.sha }} ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat:latest
if: startsWith(github.event.ref, 'refs/tags')
- name: Registry Login
uses: docker/login-action@v3
with:
registry: ${{ matrix.registry.name }}
username: ${{ matrix.registry.org }}
password: ${{ secrets[matrix.registry.token] }}
# Note(Fliiiix): Only login and push on main repo where the secrets are available
if: "!(github.event.pull_request.head.repo.fork || github.actor == 'dependabot[bot]')"
- name: Publish Image
run: |
docker push --all-tags ${{ matrix.registry.name }}/${{ matrix.registry.org }}/docat
if: "!(github.event.pull_request.head.repo.fork || github.actor == 'dependabot[bot]')"