-
Notifications
You must be signed in to change notification settings - Fork 6
160 lines (137 loc) · 5.66 KB
/
release.yaml
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
name: release
on:
push:
tags:
- v*
permissions:
contents: write
jobs:
get-protobuf:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.protobuf.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Protobuf
id: protobuf
run: |
tag=$(git describe --tags --abbrev=0 --exact-match)
release_version="${tag:1}"
curl -L https://github.com/protocolbuffers/protobuf/releases/download/${tag}/protobuf-${release_version}.tar.gz > ./protobuf.tar.gz
echo "version=${release_version}" >> $GITHUB_OUTPUT
- name: Upload Protobuf
uses: actions/upload-artifact@v4
with:
name: protobuf
path: ./protobuf.tar.gz
build-linux_x86_64:
runs-on: ubuntu-20.04
needs: get-protobuf
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Protobuf
uses: actions/download-artifact@v4
with:
name: protobuf
- name: Bazel Cache
id: bazel-cache
uses: actions/cache@v4
env:
version: 4.2.1
with:
path: |
~/.cache/bazel
key: ${{ runner.os }}-{{ env.version }}-bazel-cache
- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-linux-amd64"
mkdir -p "${GITHUB_WORKSPACE}/bin/"
mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
- name: Build Binary
run: |
tar -xf protobuf.tar.gz
cd ./protobuf-${{ needs.get-protobuf.outputs.version }}
USE_BAZEL_VERSION=6.3.0 BAZEL_CXXOPTS="-std=c++14" bazel build conformance:conformance_test_runner --toolchain_resolution_debug=@bazel_tools//tools/cpp:toolchain_type
- name: Rename Binary
run: |
mkdir -p .tmp/bin
cp ./protobuf-${{ needs.get-protobuf.outputs.version }}/bazel-bin/conformance/conformance_test_runner .tmp/bin/conformance_test_runner
- name: Verify Binary
run: |
.tmp/bin/conformance_test_runner --help 2>&1 | grep 'Usage: conformance-test-runner \[options\] <test-program>' || { echo "Build looks broken"; exit 1; }
- name: Copy Protos
run: |
mkdir -p .tmp/include/conformance
mkdir -p .tmp/include/google/protobuf
cp ./protobuf-${{ needs.get-protobuf.outputs.version }}/conformance/conformance.proto .tmp/include/conformance
cp ./protobuf-${{ needs.get-protobuf.outputs.version }}/src/google/protobuf/test_messages*.proto .tmp/include/google/protobuf
- name: Zip Binary
run: |
cd .tmp
zip -r ../conformance_test_runner-${{ needs.get-protobuf.outputs.version }}-linux-x86_64.zip ./bin ./include
- name: Publish GitHub artifacts
uses: softprops/action-gh-release@v1
with:
generate_release_notes: false
body: Conformance runner binaries for Protobuf v${{ needs.get-protobuf.outputs.version }}
append_body: false
files: |
./conformance_test_runner-${{ needs.get-protobuf.outputs.version }}-linux-x86_64.zip
build-darwin_x86_64:
runs-on: macos-11
needs: get-protobuf
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Protobuf
uses: actions/download-artifact@v4
with:
name: protobuf
- name: Bazel Cache
id: bazel-cache
uses: actions/cache@v4
env:
version: 4.2.1
with:
path: |
~/.cache/bazel
key: ${{ runner.os }}-{{ env.version }}-bazel-cache
- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-darwin-amd64"
mkdir -p "${GITHUB_WORKSPACE}/bin/"
mv bazelisk-darwin-amd64 "${GITHUB_WORKSPACE}/bin/bazel"
chmod +x "${GITHUB_WORKSPACE}/bin/bazel"
- name: Build Binary
run: |
tar -xf protobuf.tar.gz
cd ./protobuf-${{ needs.get-protobuf.outputs.version }}
USE_BAZEL_VERSION=6.3.0 BAZEL_CXXOPTS="-std=c++14" bazel build conformance:conformance_test_runner --toolchain_resolution_debug=@bazel_tools//tools/cpp:toolchain_type
- name: Rename Binary
run: |
mkdir -p .tmp/bin
cp ./protobuf-${{ needs.get-protobuf.outputs.version }}/bazel-bin/conformance/conformance_test_runner .tmp/bin/conformance_test_runner
- name: Verify Binary
run: |
.tmp/bin/conformance_test_runner --help 2>&1 | grep 'Usage: conformance-test-runner \[options\] <test-program>' || { echo "Build looks broken"; exit 1; }
- name: Copy Protos
run: |
mkdir -p .tmp/include/conformance
mkdir -p .tmp/include/google/protobuf
cp ./protobuf-${{ needs.get-protobuf.outputs.version }}/conformance/conformance.proto .tmp/include/conformance
cp ./protobuf-${{ needs.get-protobuf.outputs.version }}/src/google/protobuf/test_messages*.proto .tmp/include/google/protobuf
- name: Zip Binary
run: |
cd .tmp
zip -r ../conformance_test_runner-${{ needs.get-protobuf.outputs.version }}-osx-x86_64.zip ./bin ./include
- name: Publish GitHub artifacts
uses: softprops/action-gh-release@v1
with:
generate_release_notes: false
body: Conformance runner binaries for Protobuf v${{ needs.get-protobuf.outputs.version }}
append_body: false
files: |
./conformance_test_runner-${{ needs.get-protobuf.outputs.version }}-osx-x86_64.zip