76 lines
2.1 KiB
YAML
76 lines
2.1 KiB
YAML
name: CI Pipeline
|
|
run-name: ${{ gitea.actor }} is running the CI Pipeline
|
|
on:
|
|
release:
|
|
types: [published]
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v3
|
|
- name: Setup Environment
|
|
uses: https://github.com/actions/setup-python@v3
|
|
with:
|
|
python-verison: "3.12"
|
|
architecture: "x64"
|
|
- name: Install Packages
|
|
env:
|
|
PIP_INDEX_URL: http://192.168.1.2:5001/index/
|
|
PIP_TRUSTED_HOST: 192.168.1.2
|
|
run: |
|
|
pip install poetry
|
|
poetry install
|
|
- name: PEP8 Check
|
|
run: |
|
|
poetry run flake8 . --benchmark
|
|
- name: Type Check
|
|
run: |
|
|
poetry run mypy .
|
|
publish:
|
|
name: Build and Publish
|
|
runs-on: ubuntu-latest
|
|
needs: [test]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
-
|
|
dockerfile: ./Dockerfile.web_ui
|
|
image: ${{ vars.docker_repo_url }}/${{ gitea.repository }}/web_ui
|
|
-
|
|
dockerfile: ./Dockerfile.model
|
|
image: ${{ vars.docker_repo_url }}/${{ gitea.repository }}/model
|
|
steps:
|
|
-
|
|
name: Checkout Code
|
|
uses: actions/checkout@v3
|
|
-
|
|
name: Set Environment Variables
|
|
run: |
|
|
echo "sha_short=$(git rev-parse --short ${{ gitea.sha }} )" >> "$GITHUB_ENV"
|
|
-
|
|
name: Show Environment Variables
|
|
run: |
|
|
echo "DOCKER_REPO_URL: ${{ vars.docker_repo_url }}"
|
|
echo "REPOSITORY: ${{ gitea.repository }}"
|
|
echo "COMMIT_SHA: ${{ env.sha_short }}"
|
|
-
|
|
name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ matrix.image }}
|
|
-
|
|
name: Build and Push Image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
file: ${{ matrix.dockerfile }}
|
|
push: true
|
|
tags: |
|
|
${{ matrix.image }}:${{ env.sha_short }}
|
|
${{ matrix.image }}:latest
|
|
labels: ${{ steps.meta.outputs.labels }}
|