This repository was archived by the owner on Jan 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
131 lines (112 loc) · 4.32 KB
/
zxc-build-library.yaml
File metadata and controls
131 lines (112 loc) · 4.32 KB
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
name: "ZXC: Build Library"
on:
workflow_call:
inputs:
hapi-version-tag:
type: string
required: false
default: "v0.30.0"
defaults:
run:
shell: bash
permissions:
contents: read
jobs:
hapi-version:
name: Version Check
runs-on: client-sdk-linux-medium
outputs:
tag: ${{ steps.version.outputs.tag }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Install Semantic Version Tools
run: |
echo "::group::Download SemVer Binary"
sudo curl -L -o /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver
echo "::endgroup::"
echo "::group::Change SemVer Binary Permissions"
sudo chmod -v +x /usr/local/bin/semver
echo "::endgroup::"
echo "::group::Show SemVer Binary Version Info"
semver --version
echo "::endgroup::"
- name: Validate HAPI Version Tag
id: version
run: |
HAPI_VERSION="${{ inputs.hapi-version-tag }}"
VALID_VERSION="$(semver validate "${HAPI_VERSION}")"
if [[ "${VALID_VERSION}" != "valid" ]]; then
echo "::error title=Version Error::The supplied hapi-version-tag parameter (${HAPI_VERSION}) is invalid and does not conform to the semantic versioning specifications."
exit 2
fi
[[ "${HAPI_VERSION}" == v* ]] || HAPI_VERSION="v${HAPI_VERSION}"
echo "number=${HAPI_VERSION}" >> "${GITHUB_OUTPUT}"
build:
name: Build
runs-on: client-sdk-${{ matrix.os }}-large
strategy:
matrix:
include:
- os: linux
preset: linux-x64
# - os: macos-latest
# preset: macos-x64
# - os: windows-latest
# preset: windows-x64
needs:
- hapi-version
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: true
- name: Install Linux Prerequisites
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install -y pkg-config linux-headers-5.15.0-79-generic build-essential
- name: Ensure Binary Cache Path Exists
run: mkdir -p "${{ github.workspace }}/b/vcpkg_cache"
- name: CMake Android Build
if: github.event.pull_request.merged == true
run: |
docker build -t ubuntu-jammy-hedera-protobufs-cpp-android-build . --build-arg BRANCH_NAME=${{ github.base_ref }}
docker cp $(docker create ubuntu-jammy-hedera-protobufs-cpp-android-build:latest):/hedera-protobufs-cpp/package .
- name: Install CMake & Ninja
uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2
- name: Setup VCPkg
uses: step-security/run-vcpkg@fbc33ad33d903ec30b90a53d535afb6d03050ce2 # v11.5
with:
binaryCachePath: ${{ github.workspace }}/b/vcpkg_cache
- name: Convert VCPkg to Full Clone
run: |
cd vcpkg
git fetch --unshallow --prune
- name: CMake Build (Debug)
uses: lukka/run-cmake@af1be47fd7c933593f687731bc6fdbee024d3ff4 # v10.8
with:
configurePreset: ${{ matrix.preset }}-debug
buildPreset: ${{ matrix.preset }}-debug
- name: CMake Build (Release)
if: github.event.pull_request.merged == true
uses: lukka/run-cmake@af1be47fd7c933593f687731bc6fdbee024d3ff4 # v10.8
with:
configurePreset: ${{ matrix.preset }}-release
buildPreset: ${{ matrix.preset }}-release
- name: Compute Short SHA
id: sha
run: echo "short=$(echo -n "${{ github.sha }}" | cut -c1-8)" >> "${GITHUB_OUTPUT}"
- name: Attach Artifact
if: github.event.pull_request.merged == true
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: hapi-library-${{ runner.os }}-${{ steps.sha.outputs.short }}
path: package/
if-no-files-found: warn