aboutsummaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-08-16 17:59:01 +0100
committerGravatar Chris Lovering <[email protected]>2024-08-16 17:59:25 +0100
commit4b5f2e23cad94517bc45447fe98556d186f95103 (patch)
tree87ab179943019b7473af9a081b6e543773df4537 /.github
parentMove to fastapi & mono repo layout (diff)
Update CI to support mono repo
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/build-deploy.yaml (renamed from .github/workflows/build.yaml)23
-rw-r--r--.github/workflows/lint.yaml4
-rw-r--r--.github/workflows/main.yaml36
3 files changed, 37 insertions, 26 deletions
diff --git a/.github/workflows/build.yaml b/.github/workflows/build-deploy.yaml
index 23db7e0..fc03821 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build-deploy.yaml
@@ -5,10 +5,10 @@ on:
description: "A short-form SHA tag for the commit that triggered this flow"
required: true
type: string
- lower-repo:
- description: "The repository name in lowercase"
- required: true
- type: string
+ project:
+ description: "The project to build and push"
+ required: true
+ type: string
jobs:
build:
@@ -16,7 +16,6 @@ jobs:
runs-on: ubuntu-latest
steps:
-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@@ -31,12 +30,14 @@ jobs:
# Repository. The container will be tagged as "latest"
# and with the short SHA of the commit.
- name: Build and push
- uses: docker/build-push-action@v5
+ uses: docker/build-push-action@v6
with:
- push: ${{ github.ref == github.event.repository.default_branch }}
- cache-from: type=registry,ref=ghcr.io/${{ inputs.lower-repo }}:latest
+ context: thallium-${{ inputs.project }}
+ push: ${{ github.ref == 'refs/heads/main' }}
+ cache-from: type=registry,ref=ghcr.io/owl-corp/thallium-${{ inputs.project }}:latest
cache-to: type=inline
tags: |
- ghcr.io/${{ inputs.lower-repo }}:latest
- ghcr.io/${{ inputs.lower-repo }}:${{ inputs.sha-tag }}
- build-args: git_sha=${{ github.sha }}
+ ghcr.io/owl-corp/thallium-${{ inputs.project }}:latest
+ ghcr.io/owl-corp/thallium-${{ inputs.project }}:${{ inputs.sha-tag }}
+ build-args: |
+ git_sha=${{ github.sha }}
diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml
index 2a4ea23..c6a2ff5 100644
--- a/.github/workflows/lint.yaml
+++ b/.github/workflows/lint.yaml
@@ -19,8 +19,8 @@ jobs:
run: |
poetry export --output temp-requirements.txt -vvv
- if ! cmp -s "requirements.txt" "temp-requirements.txt"; then
- echo "::error file=requirements.txt,title=Requirements out of date!::Run 'poetry export --output requirements.txt'"
+ if ! cmp -s "thallium-backend/requirements.txt" "temp-requirements.txt"; then
+ echo "::error file=requirements.txt,title=Requirements out of date!::Run 'make lock'"
exit 1
fi
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index c109acd..6360033 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -11,36 +11,46 @@ concurrency:
cancel-in-progress: true
jobs:
+ changes:
+ runs-on: ubuntu-latest
+ outputs:
+ backend: ${{ steps.changes.outputs.backend }}
+ steps:
+ - uses: actions/checkout@v4
+ - uses: dorny/paths-filter@v3
+ id: changes
+ with:
+ filters: |
+ automation: &automation
+ - '.github/workflows/**'
+ - 'deployments/**'
+ backend:
+ - *automation
+ - 'thallium-backend/**'
+
generate-inputs:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
-
outputs:
sha-tag: ${{ steps.sha-tag.outputs.sha-tag }}
lower-repo: ${{ steps.lower-repo.outputs.lower-repo }}
-
steps:
- name: Create SHA Container Tag
id: sha-tag
run: |
tag=$(cut -c 1-7 <<< $GITHUB_SHA)
echo "sha-tag=$tag" >> $GITHUB_OUTPUT
- # docker/build-push-action doesn't allow capital letters in the URL
- - name: Get repo in lowercase
- id: lower-repo
- run: |
- echo "lower-repo=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
lint:
uses: ./.github/workflows/lint.yaml
- build:
- uses: ./.github/workflows/build.yaml
- needs:
- - lint
- - generate-inputs
+ build-backend:
+ if: ${{ needs.changes.outputs.backend == 'true' }}
+ needs: [changes, generate-inputs, lint]
+ uses: ./.github/workflows/build-deploy.yaml
with:
sha-tag: ${{ needs.generate-inputs.outputs.sha-tag }}
- lower-repo: ${{ needs.generate-inputs.outputs.lower-repo }}
+ project: backend
+ secrets: inherit