Repository navigation
81 lines (72 loc) · 2.51 KB
/
Copy pathbuild.yml
File metadata and controls
81 lines (72 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Build / Test / Push
on:
push:
branches:
- "**"
workflow_call:
workflow_dispatch:
env:
BUILD_SUFFIX: -build-${{ github.run_id }}_${{ github.run_attempt }}
jobs:
docker-build:
uses: BerkeleyLibrary/.github/.github/workflows/docker-build.yml@3.1.0
with:
image: ghcr.io/${{ github.repository }}
secrets: inherit
test:
runs-on: ubuntu-24.04
needs: docker-build
env:
COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml
DOCKER_APP_IMAGE: ${{ needs.docker-build.outputs.image }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Docker Compose
uses: docker/setup-compose-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Basic setup
run: |
ARTIFACTS_DIR="${RUNNER_TEMP}/artifacts"
mkdir -p "$ARTIFACTS_DIR"
echo "ARTIFACTS_DIR=${ARTIFACTS_DIR}" >> $GITHUB_ENV
echo "TEST_START=$(date +%s)" >> $GITHUB_ENV
- name: Setup the stack
run: |
docker compose run app bin/dbinit
docker compose up --wait
- name: Install testing and linting dependencies
run: |
docker compose exec app pip install --no-cache-dir -e .[test,lint]
- name: Run pytest
run: |
docker compose exec app pytest
- name: Copy out artifacts
if: ${{ always() }}
run: |
docker compose cp app:/app/artifacts "${ARTIFACTS_DIR}" || true
docker compose logs > "${ARTIFACTS_DIR}/docker-compose-services.log"
docker compose config > "${ARTIFACTS_DIR}/docker-compose.merged.yml"
docker events --json --since $TEST_START --until `date +%s` | tee "${ARTIFACTS_DIR}/docker-events.json"
- name: Upload the test report
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: quiabo Build Report (${{ github.run_id }}_${{ github.run_attempt }})
path: ${{ env.ARTIFACTS_DIR }}
if-no-files-found: error
push:
needs:
- docker-build
- test
uses: BerkeleyLibrary/.github/.github/workflows/docker-push.yml@3.1.0
with:
image: ghcr.io/${{ github.repository }}
build-image-arm64: ${{ needs.docker-build.outputs.image-arm64 }}
build-image-x64: ${{ needs.docker-build.outputs.image-x64 }}
secrets: inherit