Skip to content

Merge pull request #9 from phoughton/snyk-fix-888e542f15d5260a4dc1bd0… #124

Merge pull request #9 from phoughton/snyk-fix-888e542f15d5260a4dc1bd0…

Merge pull request #9 from phoughton/snyk-fix-888e542f15d5260a4dc1bd0… #124

Workflow file for this run

name: CI
on: push
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.10", "3.11"]
os: [ubuntu-latest]
steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v2
# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade -r requirements.txt
# Run our unit tests
- name: Run unit tests
run: |
python -m pytest
deploy-to-container-registries:
# Only run this job if "build" has ended successfully
environment: cribbage_container_registries
needs:
- build-and-test
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: "3.10"
- uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}
# Azure CLI
- name: Get Azure CLI
run: |
python -m pip install --upgrade pip
pip install azure-cli --upgrade
az --version
# Log in to ACR & deploy
- name: Log in to ACR & deploy
uses: azure/docker-login@v1
with:
login-server: investigatingsoftware.azurecr.io
username: ${{ secrets.AZCR_USERNAME }}
password: ${{ secrets.AZCR_PASSWORD }}
- run: |
docker build . -t investigatingsoftware.azurecr.io/investigatingsoftware/python-cribbage:latest
docker push investigatingsoftware.azurecr.io/investigatingsoftware/python-cribbage:latest
# Deploy to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/python-cribbage:latest