Feat/separate tracking #193
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/CD Pipeline | |
on: | |
push: | |
branches: [ master ] | |
tags: [ 'v*' ] # Trigger deployment only for tags starting with v | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libsnappy-dev | |
pip install -r requirements-test.txt | |
- name: Set PYTHONPATH | |
run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)" >> $GITHUB_ENV | |
- name: Run tests | |
run: | | |
pytest --maxfail=0 --disable-warnings --tb=short | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: 'python' | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 | |
deploy: | |
needs: test # Ensure that tests are successful before deploying | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: matthewvanderson/clashkingtracking:latest |