-
-
Notifications
You must be signed in to change notification settings - Fork 21
72 lines (65 loc) · 2.59 KB
/
Copy pathpull-request.yml
File metadata and controls
72 lines (65 loc) · 2.59 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
name: PR build
# Builds (without pushing) the images a pull request touches, for both architectures, so a base
# image bump or a Dockerfile change is proven before it lands on dev. Changes to the build
# machinery itself are exercised on messagebus (base + one small service).
on:
pull_request:
branches: [dev]
permissions:
contents: read
packages: write
id-token: write
concurrency:
group: pr-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
contract:
name: Contract
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- run: pip install --disable-pip-version-check pyyaml
# contract.yml is what ovos-installer pins this repository for: the compose file names, the
# container names it execs into, the variables the compose reads and the images it pulls.
# Any of those can change here and break an install with no failure in this repository, so
# the declaration is checked against compose/ on every pull request.
- run: python3 scripts/contract.py
# the gate is only worth having if it reads the compose files the way compose does
- run: python3 scripts/test_contract.py
select:
name: Affected targets
runs-on: ubuntu-24.04
outputs:
targets: ${{ steps.sel.outputs.targets }}
count: ${{ steps.sel.outputs.count }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
- id: sel
env:
BASE: ${{ github.event.pull_request.base.sha }}
HEAD: ${{ github.event.pull_request.head.sha }}
run: |
files=$(git diff --name-only "$BASE" "$HEAD")
printf '%s\n' "$files"
targets=$(printf '%s\n' "$files" | python3 scripts/affected.py paths)
if [ "$(echo "$targets" | jq length)" = "0" ] && printf '%s\n' "$files" | grep -qE '^(\.github/workflows/build-images\.yml|scripts/)'; then
targets='["messagebus"]'
fi
echo "targets: $targets"
echo "targets=$(echo "$targets" | jq -r 'join(" ")')" >> "$GITHUB_OUTPUT"
echo "count=$(echo "$targets" | jq length)" >> "$GITHUB_OUTPUT"
build:
name: alpha (dry run)
needs: select
if: needs.select.outputs.count != '0'
uses: ./.github/workflows/build-images.yml
with:
channel: alpha
targets: ${{ needs.select.outputs.targets }}
push: false
secrets: inherit