-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: build/deploy | ||
on: push | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
service: [api] | ||
name: build ${{ matrix.service }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: setup buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: prepare build metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/${{ github.repository }}/${{ matrix.service }} | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: login to GitHub container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: build and push image | ||
uses: docker/build-push-action@v6 | ||
id: build | ||
with: | ||
file: ${{ matrix.service }}/Dockerfile | ||
context: ${{ matrix.service }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha,scope=image-${{ matrix.service }} | ||
cache-to: type=gha,mode=max,scope=image-${{ matrix.service }} | ||
push: ${{ github.ref == 'refs/heads/main' }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: test | ||
on: push | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
env: | ||
DOCKER_BUILDKIT: 1 | ||
COMPOSE_DOCKER_CLI_BUILD: 1 | ||
COMPOSE: docker compose -f compose-test.yaml | ||
|
||
jobs: | ||
api: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: login to GitHub container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Build the images with BUILDKIT_INLINE_CACHE=1, so that we can | ||
# reuse layers in a later step. This works in combination with | ||
# cache_from (in the compose file), thus we do not need to pull here. | ||
- name: build images | ||
run: $COMPOSE build --build-arg BUILDKIT_INLINE_CACHE=1 | ||
- name: push cache | ||
run: $COMPOSE push --ignore-push-failures | ||
|
||
# Run linting steps | ||
- name: flake8 | ||
run: $COMPOSE run --rm --no-deps --entrypoint '' api flake8 | ||
- name: isort | ||
run: $COMPOSE run --rm --no-deps --entrypoint '' api isort --check-only --quiet --settings pyproject.toml . | ||
if: always() | ||
- name: black | ||
run: $COMPOSE run --rm --no-deps --entrypoint '' api black --check . | ||
if: always() | ||
|
||
# Run tests | ||
- name: pytest | ||
run: $COMPOSE run --rm api pytest | ||
|
||
- name: logs | ||
if: always() | ||
run: $COMPOSE logs |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name: geophotoradar-test | ||
services: | ||
api: | ||
build: | ||
context: api | ||
target: test |