Adding challenge 5. #66
Workflow file for this run
This file contains hidden or 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: | |
push: | |
branches: ["**"] | |
pull_request: | |
branches: [main] | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
pip install black isort pylint pytest pytest-cov mypy | |
- name: Configure environment | |
run: | | |
export PYTHONPYCACHEPREFIX=$PWD/pycache | |
mkdir -p $PWD/pycache | |
export PYTEST_CACHE_DIR=$PWD/.pytest_cache | |
mkdir -p $PWD/.pytest_cache | |
- name: Run Pytest | |
run: | | |
source venv/bin/activate | |
python run_pytest.py | |
- name: Run Pylint | |
run: | | |
source venv/bin/activate | |
python run_pylint.py | |
push-docker: | |
needs: build-and-test | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: .devcontainer/Dockerfile | |
push: true | |
tags: ghcr.io/${{ github.repository }}:latest | |
platforms: linux/amd64 |