Skip to content

Commit f0b34b0

Browse files
authored
Merge pull request #106 from OpenSimulationInterface/build/update-actions
Modernize actions and use OSI protobuf build setup
2 parents 6dc30c2 + 7b112c3 commit f0b34b0

File tree

3 files changed

+36
-25
lines changed

3 files changed

+36
-25
lines changed

.github/workflows/antora-generator.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
steps:
2121
- name: Trigger generator
2222
if: ${{ env.MUP_KEY != '' }}
23-
uses: peter-evans/repository-dispatch@v2
23+
uses: peter-evans/repository-dispatch@v3
2424
with:
2525
token: ${{ secrets.MACHINE_USER_PAT }}
2626
event-type: antora-build-trigger

.github/workflows/protobuf.yml

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name: ProtoBuf CI Builds
22

3+
env:
4+
PROTOBUF_VERSION: 3.20.1
5+
PROTOBUF_VARIANT: '-all' # Use '-all' prior to 22.0, '' after
6+
ABSEIL_VERSION: 20230802.1
7+
38
on:
49
push:
510
branches:
@@ -22,52 +27,58 @@ jobs:
2227

2328
steps:
2429
- name: Checkout OSI
25-
uses: actions/checkout@v2
30+
uses: actions/checkout@v4
2631
with:
2732
submodules: true
2833

2934
- name: Setup Python
30-
uses: actions/setup-python@v2
35+
uses: actions/setup-python@v5
3136
with:
32-
python-version: '3.7'
37+
python-version: '3.8'
3338

34-
# cache dependencies
3539
- name: Cache Dependencies
3640
id: cache-depends
37-
uses: actions/cache@v3
41+
uses: actions/cache@v4
3842
with:
39-
path: protobuf-3.15.8
43+
path: protobuf-${{ env.PROTOBUF_VERSION }}
4044
key: ${{ runner.os }}-v2-depends
4145

42-
# Download and build protobuf
43-
- name: Download ProtoBuf
46+
- name: Download ProtoBuf ${{ env.PROTOBUF_VERSION }}
4447
if: steps.cache-depends.outputs.cache-hit != 'true'
45-
run: curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protobuf-all-3.15.8.tar.gz && tar xzvf protobuf-all-3.15.8.tar.gz
48+
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
4649

47-
- name: Build ProtoBuf
48-
if: steps.cache-depends.outputs.cache-hit != 'true'
49-
working-directory: protobuf-3.15.8
50+
- name: Download Abseil ${{ env.ABSEIL_VERSION }}
51+
if: steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == ''
52+
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
53+
54+
- name: Build ProtoBuf ${{ env.PROTOBUF_VERSION }} via autotools
55+
if: steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == '-all'
56+
working-directory: protobuf-${{ env.PROTOBUF_VERSION }}
5057
run: ./configure DIST_LANG=cpp --prefix=/usr && make
5158

52-
- name: Install ProtoBuf
53-
working-directory: protobuf-3.15.8
59+
- name: Build ProtoBuf ${{ env.PROTOBUF_VERSION }} via cmake
60+
if: steps.cache-depends.outputs.cache-hit != 'true' && env.PROTOBUF_VARIANT == ''
61+
working-directory: protobuf-${{ env.PROTOBUF_VERSION }}
62+
run: cmake -DCMAKE_CXX_STANDARD=17 -Dprotobuf_BUILD_SHARED_LIBS=ON -Dprotobuf_BUILD_TESTS=OFF . && cmake --build . --config Release -j 4
63+
64+
- name: Install ProtoBuf ${{ env.PROTOBUF_VERSION }}
65+
working-directory: protobuf-${{ env.PROTOBUF_VERSION }}
5466
run: sudo make install && sudo ldconfig
5567

56-
# prepare build
5768
- name: Prepare C++ Build
5869
working-directory: examples
5970
run: mkdir build
6071

61-
- name: cmake prepare
72+
- name: Configure C++ Build
6273
working-directory: examples/build
63-
run: cmake -D CMAKE_PREFIX_PATH:PATH=${DEPS_DIR}/protobuf/install ..
74+
run: cmake ${{ env.PROTOBUF_VARIANT =='' && '-DCMAKE_CXX_STANDARD=17' }} ..
6475

6576
- name: Build C++
6677
working-directory: examples/build
67-
run: cmake --build .
68-
78+
run: cmake --build . --config Release -j 4
79+
6980
- name: Upload build artifacts
70-
uses: actions/upload-artifact@v3.1.2
81+
uses: actions/upload-artifact@v4
7182
with:
7283
name: Examples
7384
path: examples/build
@@ -79,12 +90,12 @@ jobs:
7990
if: ${{ github.event.client_payload }}
8091
steps:
8192
- name: Collect previous artifacts
82-
uses: actions/download-artifact@v3.0.2
93+
uses: actions/download-artifact@v4
8394
with:
8495
name: Examples
8596
path: examples/build
8697
- name: Zip artifacts
87-
uses: TheDoctor0/zip-release@0.6.2
98+
uses: TheDoctor0/zip-release@0.7.6
8899
with:
89100
filename: Examples.zip
90101
path: examples/build

.github/workflows/remote_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: Ubuntu-latest
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818
with:
1919
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
2020

@@ -40,7 +40,7 @@ jobs:
4040
git tag ${REPO_TAG}
4141
4242
- name: GitHub Push
43-
uses: CasperWA/push-protected@v2.14.0
43+
uses: CasperWA/push-protected@v2.15.0
4444
with:
4545
# Token for the repo. Can be passed in using $\{{ secrets.GITHUB_TOKEN }}
4646
token: ${{ secrets.MACHINE_USER_PAT }}

0 commit comments

Comments
 (0)