-
Notifications
You must be signed in to change notification settings - Fork 18
108 lines (90 loc) · 3.69 KB
/
protobuf.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
100
101
102
103
104
105
106
107
108
name: ProtoBuf CI Builds
env:
PROTOBUF_VERSION: 3.20.1
PROTOBUF_VARIANT: '-all' # Use '-all' prior to 22.0, '' after
ABSEIL_VERSION: 20230802.1
on:
push:
branches:
- '**'
paths-ignore: [ .github/**, .gitmodules ]
tags-ignore:
- '**'
pull_request:
branches: [ master ]
repository_dispatch:
types: [examples-build]
# this is a test
jobs:
build-osmp-examples:
name: Build OSMP examples
runs-on: ubuntu-22.04
steps:
- name: Checkout OSI
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Cache Dependencies
id: cache-depends
uses: actions/cache@v4
with:
path: protobuf-${{ env.PROTOBUF_VERSION }}
key: ${{ runner.os }}-v2-depends
- name: Download ProtoBuf ${{ env.PROTOBUF_VERSION }}
if: steps.cache-depends.outputs.cache-hit != 'true'
run: curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${{env.PROTOBUF_VERSION}}/protobuf${{env.PROTOBUF_VARIANT}}-${{env.PROTOBUF_VERSION}}.tar.gz && tar xzvf protobuf${{env.PROTOBUF_VARIANT}}-${{env.PROTOBUF_VERSION}}.tar.gz
- name: Download Abseil ${{ env.ABSEIL_VERSION }}
if: steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == ''
run: curl -OL https://github.com/abseil/abseil-cpp/archive/refs/tags/${{env.ABSEIL_VERSION}}.tar.gz && tar xzvf ${{env.ABSEIL_VERSION}}.tar.gz && rm -rf protobuf-${{env.PROTOBUF_VERSION}}/third_party/abseil-cpp && mv abseil-cpp-${{env.ABSEIL_VERSION}} protobuf-${{env.PROTOBUF_VERSION}}/third_party/abseil-cpp
- name: Build ProtoBuf ${{ env.PROTOBUF_VERSION }} via autotools
if: steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == '-all'
working-directory: protobuf-${{ env.PROTOBUF_VERSION }}
run: ./configure DIST_LANG=cpp --prefix=/usr && make
- name: Build ProtoBuf ${{ env.PROTOBUF_VERSION }} via cmake
if: steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == ''
working-directory: protobuf-${{ env.PROTOBUF_VERSION }}
run: cmake -DCMAKE_CXX_STANDARD=17 -Dprotobuf_BUILD_SHARED_LIBS=ON -Dprotobuf_BUILD_TESTS=OFF . && cmake --build . --config Release -j 4
- name: Install ProtoBuf ${{ env.PROTOBUF_VERSION }}
working-directory: protobuf-${{ env.PROTOBUF_VERSION }}
run: sudo make install && sudo ldconfig
- name: Prepare C++ Build
working-directory: examples
run: mkdir build
- name: Configure C++ Build
working-directory: examples/build
run: cmake ${{ env.PROTOBUF_VARIANT =='' && '-DCMAKE_CXX_STANDARD=17' }} ..
- name: Build C++
working-directory: examples/build
run: cmake --build . --config Release -j 4
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: Examples
path: examples/build
update_interface_release:
name: Update OSI release
runs-on: ubuntu-22.04
needs: [build-osmp-examples]
if: ${{ github.event.client_payload }}
steps:
- name: Collect previous artifacts
uses: actions/download-artifact@v4
with:
name: Examples
path: examples/build
- name: Zip artifacts
uses: TheDoctor0/[email protected]
with:
filename: Examples.zip
path: examples/build
- name: Upload artifacts to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.MACHINE_USER_PAT }}
file: Examples.zip
tag: ${{ github.event.client_payload.tag }}
repo_name: ${{ github.event.client_payload.source_repo }}