-
Notifications
You must be signed in to change notification settings - Fork 453
99 lines (95 loc) · 3.8 KB
/
regular_conformance.yml
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
name: Run Conformance Tests
# This workflow is a subset of the build.yml. It *only* try to run the
# conformance checks. It is triggered weekly on a cron to catch when new
# conformance tests are added and they don't pass.
#
# Without this workflow the new tests wouldn't be noticed until a PR was made.
#
# This workflow shares the caching logic with build.yml. It should serve to
# update a subset of the caches for when things do land on trunk. If that
# is deemed not worth it in the future, this can be simplify.
# NOTE: If making changes to most of the steps, please also look to update
# build.yml also.
on:
schedule:
# Every Sunday at 5am.
- cron: '0 5 * * 0'
# Also allow manual triggering from the github UX to revalidate things.
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# Looking at https://hub.docker.com/_/swift, the version only tags (i.e.
# - 5.9.2) can use different Ubuntu releases. But just to be safe we use
# the specific OS release.
#
# We could use less specific tags (i.e. - 5.9), so they "float" as
# new point release come, but to help make history/logs more clear,
# being explicit (at the cost of having to update with point releases)
# seems better. This should also ensure protobuf caching changes with
# each new image incase system in the Swift image are changed/updated.
swift:
- 6.0.0-noble
# protobuf_git can reference a commit, tag, or branch
# commit: "commits/6935eae45c99926a000ecbef0be20dfd3d159e71"
# tag: "ref/tags/v3.11.4"
# branch: "ref/heads/main"
protobuf_git: ["ref/heads/main"]
container:
image: swift:${{ matrix.swift }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: swift-protobuf
- name: Update and install dependencies
# dependencies from https://github.com/protocolbuffers/protobuf/blob/main/src/README.md
# this step is run before get-sha because we need curl and jq for get-sha
run: apt-get update && apt-get install -y curl make g++ cmake jq
- name: Get Protobuf Commit SHA
id: get-sha
run: |
set -eu
url="https://api.github.com/repos/protocolbuffers/protobuf/git/${{ matrix.protobuf_git }}"
case ${{ matrix.protobuf_git }} in
ref/*)
echo "sha=$( curl -s -u "u:${{ github.token }}" "${url}" | jq -r .object.sha )" >> $GITHUB_OUTPUT
;;
commits/*)
echo "sha=$( curl -s -u "u:${{ github.token }}" "${url}" | jq -r .sha )" >> $GITHUB_OUTPUT
;;
esac
- name: Cache protobuf
id: cache-protobuf
uses: actions/cache@v4
with:
path: protobuf
# NOTE: for refs that can float like 'main' the cache might be out of date!
key: ${{ runner.os }}-${{ matrix.swift }}-protobuf-${{ steps.get-sha.outputs.sha }}
- name: Checkout protobuf repo
if: steps.cache-protobuf.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: protocolbuffers/protobuf
ref: ${{ steps.get-sha.outputs.sha }}
submodules: true
path: protobuf
- name: Build protobuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
working-directory: protobuf
run: |
mkdir cmake_build
cd cmake_build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_INSTALL=OFF \
-Dprotobuf_BUILD_CONFORMANCE=ON \
-S ..
NUM_CPUS=$(getconf _NPROCESSORS_ONLN)
make -j "${NUM_CPUS}" protoc conformance_test_runner
- name: Test conformance
working-directory: swift-protobuf
run: make test-conformance CONFORMANCE_TEST_RUNNER=../protobuf/cmake_build/conformance_test_runner