63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
name: CI Workflow
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '*'
|
|
|
|
jobs:
|
|
test:
|
|
ame: Testing the Block
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set Up Python Environment
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.10'
|
|
|
|
- name: Install Python Dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
|
|
- name: Execute Unit Tests
|
|
run: python -m unittest discover -s . -p 'test_*.py'
|
|
|
|
build_and_push:
|
|
name: Containerize the Block
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
steps:
|
|
- name: Extract Repository Name
|
|
id: extract_repo
|
|
run: echo "repo_name=${GITHUB_REPOSITORY##*/}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Checkout Codebase
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Configure Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
driver: docker
|
|
|
|
- name: Log In to Container Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: centurion-version-control.default.svc.cluster.local:3000
|
|
username: ${{ secrets.CI_USER }}
|
|
password: ${{ secrets.CI_USER_TOKEN }}
|
|
|
|
- name: Build and Push Docker Image to Registry
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
centurion-version-control.default.svc.cluster.local:3000/centurion/${{ steps.extract_repo.outputs.repo_name }}/${{ github.ref_name }}:${{ github.sha }}
|
|
centurion-version-control.default.svc.cluster.local:3000/centurion/${{ steps.extract_repo.outputs.repo_name }}/${{ github.ref_name }}:latest
|