Repository navigation
179 lines (169 loc) · 6.85 KB
/
Copy pathci.yaml
File metadata and controls
179 lines (169 loc) · 6.85 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
name: Validate DevContainer
# This workflow is checking that updates do not break stuff. If on main branch, publish to "latest" tag.
on:
pull_request:
types: [opened, synchronize, reopened, labeled]
push:
branches:
- main
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
changes:
name: Detect changed files
runs-on: ubuntu-24.04
permissions:
contents: read
outputs:
daily: ${{ steps.filter.outputs.daily }}
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v7
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
daily:
- '.github/workflows/daily.yml'
- '.github/renovate.json5'
build:
strategy:
matrix:
os: [arm64, amd64]
include:
- os: amd64
name: DevContainer (amd64)
runner: ubuntu-24.04
- os: arm64
name: DevContainer (arm64)
runner: ubuntu-24.04-arm
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: eclipse-score/more-disk-space@v1
- name: Checkout (GitHub)
uses: actions/checkout@v7
- name: Login to GitHub Container Registry
uses: docker/login-action@v4.8.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Use .devcontainer from THIS repo for building and testing
- name: Check, Build, Test, Publish
uses: devcontainers/ci@v0.3
with:
# The .devcontainer is never published as pre-built container.
# We want to only use it for building and testing the actual container, which resides in src/s-core-devcontainer.
push: never
runCmd: |
set -eux pipefail
# Check
pre-commit run --show-diff-on-failure --color=always --all-files || exit 1
# Metadata and README generation must also work without importing
# the container installer or installing a Python package.
python3 -m unittest discover -s tools/tests -p '*_test.py' -v
# A fake uv executable makes the launcher contract deterministic:
# arguments, cwd, and environment are checked without network I/O.
bazelisk test //tools:python_tool_runner_test --test_output=errors
bazelisk test //tools:run_tool_test --test_output=errors
# The real target covers the integration boundary between
# rules_multitool, Bazel runfiles, uvx, and the Python package.
bazelisk run //tools:pre-commit -- --version
# Create builder for multi-arch builds
./scripts/create_builder.sh
# Build
./scripts/build.sh --${{ matrix.os }} "main"
# Test
./scripts/test.sh
# Test consumer repository, arm64 is skipped because not all bazel dependencies are available for arm64
# By default this is skipped in pull requests, unless the label "test-consumer" is added
if [ "${{ matrix.os }}" = "amd64" ] && ( [ "${{ github.event_name }}" != "pull_request" ] || echo "${{ toJSON(github.event.pull_request.labels) }}" | grep -q "test-consumer" ); then
./scripts/test_consumer.sh "https://github.com/eclipse-score/inc_someip_gateway.git" "14a733a1f3d5f6fa76ac13365d57c8df30b62a86"
./scripts/test_consumer.sh "https://github.com/eclipse-score/score.git" "7cbb86d54dced80e33a6405bc92f8abe62200ad4"
fi
# Optionally: Publish
# We do not use the push feature of devcontainers/ci here, since that would push the wrong container.
# Instead, we use the publish script which pushes the correct container (residing in src/s-core-devcontainer).
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
# manually login to ghcr.io for publishing
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
./scripts/publish.sh --${{ matrix.os }} "main"
fi
daily:
secrets: inherit
needs: [changes]
if: needs.changes.outputs.daily == 'true'
uses: ./.github/workflows/daily.yml
permissions:
actions: write
contents: write
issues: write
pages: write
pull-requests: write
id-token: write
overall-result:
name: build/overall-result
runs-on: ubuntu-24.04
needs: [build, daily]
if: ${{ !cancelled() }}
permissions: {}
steps:
- name: Successful verification
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Failing verification
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
merge:
name: Merge Labels (main only)
needs: [build]
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/main'
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: eclipse-score/more-disk-space@v1
- name: Checkout (GitHub)
uses: actions/checkout@v7
- name: Login to GitHub Container Registry
uses: docker/login-action@v4.8.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Use .devcontainer from THIS repo for building and testing
- name: Merge
uses: devcontainers/ci@v0.3
with:
# The .devcontainer is never published as pre-built container.
# We want to only use it for building and testing the actual container, which resides in src/s-core-devcontainer.
push: never
runCmd: |
set -eux pipefail
# Merge
# We do not use the push feature of devcontainers/ci here, since that would push the wrong container.
# Instead, we use the publish script which pushes the correct container (residing in src/s-core-devcontainer).
# manually login to ghcr.io for publishing
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
./scripts/merge.sh "main"