chore: added docker ci 2d4f5401
Steve · 2026-04-13 22:27 1 file(s) · +68 −0
.github/workflows/docker-test.yml (added) +68 −0
1 +
name: Docker Test
2 +
3 +
on:
4 +
  pull_request:
5 +
    branches:
6 +
      - main
7 +
8 +
jobs:
9 +
  changes:
10 +
    name: Detect changes
11 +
    runs-on: ubuntu-latest
12 +
    outputs:
13 +
      apps: ${{ steps.filter.outputs.apps }}
14 +
    steps:
15 +
      - uses: actions/checkout@v4
16 +
        with:
17 +
          fetch-depth: 0
18 +
19 +
      - name: Determine which apps to build
20 +
        id: filter
21 +
        run: |
22 +
          ALL='["cellar","sipp","feeds","parcels","jotts","og","shrink","backup","posts"]'
23 +
24 +
          changed=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
25 +
26 +
          if echo "$changed" | grep -qE '^(Cargo\.(toml|lock)|crates/|\.github/workflows/docker(-test)?\.yml)'; then
27 +
            echo "apps=${ALL}" >> "$GITHUB_OUTPUT"
28 +
            exit 0
29 +
          fi
30 +
31 +
          apps=()
32 +
          for app in cellar sipp feeds parcels jotts og shrink backup posts; do
33 +
            if echo "$changed" | grep -q "^apps/${app}/"; then
34 +
              apps+=("\"${app}\"")
35 +
            fi
36 +
          done
37 +
38 +
          if [ ${#apps[@]} -eq 0 ]; then
39 +
            echo 'apps=[]' >> "$GITHUB_OUTPUT"
40 +
          else
41 +
            echo "apps=[$(IFS=,; echo "${apps[*]}")]" >> "$GITHUB_OUTPUT"
42 +
          fi
43 +
44 +
  build:
45 +
    name: build (${{ matrix.app }})
46 +
    needs: changes
47 +
    if: needs.changes.outputs.apps != '[]'
48 +
    runs-on: ubuntu-latest
49 +
    strategy:
50 +
      fail-fast: false
51 +
      matrix:
52 +
        app: ${{ fromJson(needs.changes.outputs.apps) }}
53 +
    steps:
54 +
      - uses: actions/checkout@v4
55 +
56 +
      - name: Set up Docker Buildx
57 +
        uses: docker/setup-buildx-action@v3
58 +
59 +
      - name: Build
60 +
        uses: docker/build-push-action@v6
61 +
        with:
62 +
          context: .
63 +
          file: apps/${{ matrix.app }}/Dockerfile
64 +
          push: false
65 +
          load: true
66 +
          tags: ${{ matrix.app }}:test
67 +
          cache-from: type=gha,scope=${{ matrix.app }}
68 +
          cache-to: type=gha,mode=max,scope=${{ matrix.app }}