-
Notifications
You must be signed in to change notification settings - Fork 49
124 lines (102 loc) · 3.73 KB
/
build-cpp.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Build C++ SDK
on:
push:
branches:
- main
- rc
- hotfix-rc
pull_request:
workflow_dispatch:
jobs:
generate-schemas:
uses: ./.github/workflows/generate_schemas.yml
build_rust:
uses: ./.github/workflows/build-rust-cross-platform.yml
build:
name: Build for ${{ matrix.settings.os }} ${{ matrix.settings.target }}
needs:
- generate-schemas
- build_rust
runs-on: ${{ matrix.settings.os }}
strategy:
fail-fast: false
matrix:
settings:
- os: macos-12
target: x86_64-apple-darwin
- os: macos-12
target: aarch64-apple-darwin
- os: windows-2022
target: x86_64-pc-windows-msvc
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: install dependencies linux
if: runner.os == 'Linux'
run: |
sudo apt-get install -y nlohmann-json3-dev
sudo apt-get install -y libboost-all-dev
- name: install dependencies macos
if: runner.os == 'macOS'
run: |
brew install nlohmann-json
brew install boost
- name: Set up conda environment
uses: conda-incubator/setup-miniconda@030178870c779d9e5e1b4e563269f3aa69b04081 # v3.0.3
with:
miniconda-version: "latest"
auto-update-conda: true
activate-environment: conda-env
if: runner.os == 'Windows' #|| runner.os == 'Linux'
- name: Install libraries for Windows
run: |
conda install -c conda-forge boost
conda install -c conda-forge nlohmann_json
conda list
shell: pwsh
if: runner.os == 'Windows'
# - name: Install libraries for Linux
# run: |
# conda install -c conda-forge boost
# conda install -c conda-forge nlohmann_json
# # sudo apt-get update
# # sudo apt-get install libboost-all-dev
# shell: bash
# if: runner.os == 'Linux'
- name: Download schemas
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
name: sdk-schemas-cpp
path: languages/cpp/include
- name: Download ${{ matrix.settings.target }} files
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
with:
name: libbitwarden_c_files-${{ matrix.settings.target }}
path: languages/cpp/include
- name: Build
working-directory: languages/cpp
run: |
if [[ ${{ runner.os }} == 'macOS' ]]; then
export DNLOHMANN_PATH=/usr/local/opt/nlohmann-json
export DBOOST_PATH=/usr/local/opt/boost
fi
if [[ ${{ runner.os }} == 'Linux' ]]; then
export DNLOHMANN_PATH=/usr/share/doc/nlohmann-json3-dev
export DBOOST_PATH=/usr/share/doc/libboost-all-dev
fi
if [[ ${{ runner.os }} == 'Windows' ]]; then
export DNLOHMANN_PATH=C:\Users\runneradmin\miniconda3\envs\conda-env\nlohmann_json
export DBOOST_PATH=C:\Users\runneradmin\miniconda3\envs\conda-env\boost
fi
mkdir build
cd build
cmake .. -DNLOHMANN=$DNLOHMANN_PATH -DBOOST=$DBOOST_PATH -DTARGET=include/libbitwarden_c.dylib
cmake --build .
- name: Upload C++ package for ${{ matrix.settings.target }}
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: libbitwarden_c-${{ matrix.settings.target }}
path: languages/cpp/target/release
if-no-files-found: error