add Dockerfile and build in ci-pipeline #21
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 Pipeline | ||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
push: | ||
branches: [main] | ||
jobs: | ||
code-quality: | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
python-version: ["3.12"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: "pip" | ||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade pip pylint | ||
pip install .[dev] | ||
- name: check black formating | ||
run: | | ||
black --check --diff --config ./pyproject.toml . | ||
- name: lint changed and added files | ||
run: | | ||
pylint --rcfile=.pylintrc --fail-under 9 shiny_invoice/ | ||
build-container: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Log in to registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create Image & Version String | ||
run: | | ||
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/shiny_invoice | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | ||
[ "$VERSION" == "main" ] && VERSION=latest | ||
echo IMAGE_ID=$IMAGE_ID | ||
echo VERSION=$VERSION | ||
- name: Build images | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
Check failure on line 62 in .github/workflows/ci-pipeline.yml
|
||
${{ IMAGE_ID }}:${{ VERSION }} | ||
${{ IMAGE_ID }}:latest |