Skip to content

ci: enable workflow for lab08 branch #7

ci: enable workflow for lab08 branch

ci: enable workflow for lab08 branch #7

Workflow file for this run

name: Python CI (Lab03)

Check failure on line 1 in .github/workflows/python-ci.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/python-ci.yml

Invalid workflow file

(Line: 69, Col: 9): Unexpected symbol: 'github'. Located at position 386 within expression: github.event_name == 'push' && ( github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'lab3' || github.ref_name == 'lab03' || github.ref_name == 'lab4' || github.ref_name == 'lab04' || github.ref_name == 'lab5' || github.ref_name == 'lab05' || github.ref_name == 'lab6' || github.ref_name == 'lab06' || github.ref_name == 'lab7' || github.ref_name == 'lab07' github.ref_name == 'lab[...]
on:
push:
branches:
- main
- master
- lab3
- lab03
- lab4
- lab04
- lab5
- lab05
- lab6
- lab06
- lab7
- lab07
- lab8
- lab08
paths:
- "app_python/**"
- "monitoring/**"
- "ansible/**"
- "playbooks/**"
- ".github/workflows/python-ci.yml"
pull_request:
paths:
- "app_python/**"
- "monitoring/**"
- "ansible/**"
- "playbooks/**"
- ".github/workflows/python-ci.yml"
concurrency:
group: python-ci-${{ github.ref }}
cancel-in-progress: true
jobs:
test-lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: app_python
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: "app_python/requirements.txt"
- name: Install deps
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint (ruff)
run: ruff check .
- name: Tests
run: pytest -q
docker-build-push:
needs: test-lint
runs-on: ubuntu-latest
if: github.event_name == 'push' && (
github.ref_name == 'main' ||
github.ref_name == 'master' ||
github.ref_name == 'lab3' ||
github.ref_name == 'lab03' ||
github.ref_name == 'lab4' ||
github.ref_name == 'lab04' ||
github.ref_name == 'lab5' ||
github.ref_name == 'lab05' ||
github.ref_name == 'lab6' ||
github.ref_name == 'lab06' ||
github.ref_name == 'lab7' ||
github.ref_name == 'lab07'
github.ref_name == 'lab8' ||
github.ref_name == 'lab08'
)
steps:
- uses: actions/checkout@v4
- name: Set version (CalVer)
run: |
echo "CALVER=$(date +%Y.%m)" >> $GITHUB_ENV
echo "BUILD=${{ github.run_number }}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build & Push
uses: docker/build-push-action@v6
with:
context: ./app_python
file: ./app_python/Dockerfile
platforms: linux/amd64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/devops-lab02-python:${{ env.CALVER }}.${{ env.BUILD }}
${{ secrets.DOCKER_USERNAME }}/devops-lab02-python:latest