Bump black from 24.8.0 to 24.10.0 #583
Workflow file for this run
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: Test Build Merge Deploy | |
concurrency: | |
group: test-build-merge-deploy | |
cancel-in-progress: false | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
env: | |
DOCKER_IMAGE: ghcr.io/davidasnider/cava/primary | |
jobs: | |
pytest: | |
runs-on: ubuntu-latest | |
env: | |
CAVA_URL: http://localhost | |
CAVA_URI: null | |
CAVA_CAMERA: null | |
CAMERA_PASS: null | |
CAVA_USER: null | |
CAVA_PASSWORD: null | |
RABBITMQ_SERVICE_SERVICE_HOST: null | |
RABBITMQ_DEFAULT_USER: null | |
RABBITMQ_DEFAULT_PASS: null | |
TZ: null | |
indigo_api_key: null | |
INDIGO_URL: http://localhost | |
TOMORROW_IO_API_KEY: null | |
TOMORROW_IO_LATITUDE: 1.0 | |
TOMORROW_IO_LONGITUDE: 1.0 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Run pytest | |
run: poetry run pytest -s -v -m "not integration" | |
gitleaks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: "0" | |
# Gitleaks check for secrets | |
- name: Gitleaks | |
uses: zricethezav/gitleaks-action@v2.3.6 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-primary-container: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.1.1 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3.2.0 | |
- 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: Set version tags | |
id: build-prep | |
run: | | |
VERSION=noop | |
if [[ $GITHUB_REF == refs/pull/* ]]; then | |
VERSION=v1.0.${{ github.event.number }} | |
fi | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
echo "VERSION=${VERSION}" | |
echo "TAGS=${DOCKER_IMAGE}:${VERSION}" >> $GITHUB_ENV | |
echo "TAGS=${DOCKER_IMAGE}:${VERSION}" | |
echo "CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV | |
echo "CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" | |
- name: Build and push build-primary-container | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./src/cava/ | |
file: ./src/cava/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ env.TAGS }} | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: | |
- pytest | |
- gitleaks | |
- build-primary-container | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Setup Kustomize | |
uses: imranismail/setup-kustomize@v2 | |
- name: Set version tags | |
id: build-prep | |
run: | | |
VERSION=noop | |
if [[ $GITHUB_REF == refs/pull/* ]]; then | |
VERSION=v1.0.${{ github.event.number }} | |
fi | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
echo "VERSION=${VERSION}" | |
echo "TAGS=${DOCKER_IMAGE}:${VERSION}" >> $GITHUB_ENV | |
echo "TAGS=${DOCKER_IMAGE}:${VERSION}" | |
echo "CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV | |
echo "CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" | |
- name: Update kubernetes resources | |
run: | | |
# Do base image updates | |
cd k8s/bases | |
kustomize edit set image ${{ env.TAGS }} | |
cat kustomization.yaml | |
# Do dev image updates | |
cd ../dev | |
kustomize edit set image ${{ env.TAGS }} | |
cat kustomization.yaml | |
# Do prod image updates | |
cd ../prod | |
kustomize edit set image ${{ env.TAGS }} | |
cat kustomization.yaml | |
- name: Commit files | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
if [[ `git status --porcelain` ]]; then | |
git commit -am "Bump docker tag" | |
else | |
echo "No changes to commit" | |
fi | |
- name: Push changes | |
uses: ad-m/github-push-action@v0.8.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.event.pull_request.head.ref }} | |
pr-approve: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
needs: | |
- deploy | |
steps: | |
- uses: hmarr/auto-approve-action@v4.0.0 | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
label-pr: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
needs: | |
- pr-approve | |
steps: | |
- uses: christianvuerings/add-labels@v1.1 | |
with: | |
labels: | | |
automerge | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
automerge: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
contents: write | |
needs: | |
- label-pr | |
steps: | |
- name: automerge | |
uses: "pascalgn/automerge-action@v0.16.4" | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |