forked from hpcc-systems/HPCC-Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (173 loc) · 8.99 KB
/
build-docker-enterprise.yml
File metadata and controls
188 lines (173 loc) · 8.99 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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: Build Enterprise Platform
on:
workflow_call:
inputs:
os:
description: 'Operating System'
required: true
type: string
container:
description: 'Containerized build'
required: false
default: false
type: boolean
community_ref:
description: 'Community Ref'
required: true
type: string
build-docker-image:
description: 'Build Docker Image'
required: false
default: false
type: boolean
workflow_dispatch:
inputs:
os:
type: string
description: 'Operating System'
required: true
container:
type: boolean
description: 'Containerized build'
required: false
default: false
community_ref:
type: string
description: 'Community Ref'
required: true
build-docker-image:
type: boolean
description: 'Build Docker Image'
required: false
default: false
jobs:
build:
name: Build enterprise platform
runs-on: ubuntu-latest
steps:
- name: Free additional disk space (remove Android SDK + Tools)
continue-on-error: true
run: |
df -h
sudo rm -rf ${ANDROID_HOME}
sudo rm -rf ${JAVA_HOME_8_X64}
sudo rm -rf ${JAVA_HOME_11_X64}
sudo rm -rf ${JAVA_HOME_17_X64}
sudo rm -rf ${JAVA_HOME_21_X64}
sudo rm -rf ${CHROMEWEBDRIVER}
sudo rm -rf ${EDGEWEBDRIVER}
sudo rm -rf ${GECKOWEBDRIVER}
sudo rm -rf ${SELENIUM_JAR_PATH}
- name: Display disk space (post free)
run: |
df -h
- name: Checkout HPCC-Platform
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/HPCC-Platform
ref: ${{ inputs.community_ref }}
fetch-depth: 0
fetch-tags: true
submodules: recursive
path: ${{ github.workspace }}/HPCC-Platform
- name: Calculate Variables
id: vars
working-directory: ${{ github.workspace }}/HPCC-Platform/vcpkg
run: |
echo "folder_platform=${{ github.workspace }}/HPCC-Platform" >> $GITHUB_OUTPUT
echo "folder_eclide"=${{ github.workspace }}/ECLIDE >> $GITHUB_OUTPUT
echo "folder_prettygitlogs"=${{ github.workspace }}/PrettyGitLogs >> $GITHUB_OUTPUT
echo 'mount_platform=source="${{ github.workspace }}/HPCC-Platform",target=/hpcc-dev/HPCC-Platform,type=bind,consistency=cached' >> $GITHUB_OUTPUT
echo "folder_ln=${{ github.workspace }}/LN" >> $GITHUB_OUTPUT
echo 'mount_ln=source="${{ github.workspace }}/LN",target=/hpcc-dev/LN,type=bind,consistency=cached' >> $GITHUB_OUTPUT
echo "folder_build=${{ github.workspace }}/build" >> $GITHUB_OUTPUT
echo 'mount_build=source="${{ github.workspace }}/build",target=/hpcc-dev/build,type=bind,consistency=cached' >> $GITHUB_OUTPUT
community_ref=${{ github.ref }}
echo "community_ref=$community_ref" >> $GITHUB_OUTPUT
echo "internal_ref=$(echo $community_ref | sed 's/community/internal/')" >> $GITHUB_OUTPUT
echo "eclide_ref=$(echo $community_ref | sed 's/community/eclide/')" >> $GITHUB_OUTPUT
community_tag=$(echo $community_ref | cut -d'/' -f3)
echo "community_tag=$community_tag" >> $GITHUB_OUTPUT
echo "internal_tag=$(echo $community_tag | sed 's/community/internal/')" >> $GITHUB_OUTPUT
echo "hpcc_version=$(echo $community_tag | sed 's/community_//' | sed 's/-[0-9]$//')" >> $GITHUB_OUTPUT
echo "hpcc_version_full=$(echo $community_tag | sed 's/community_//')" >> $GITHUB_OUTPUT
community_base_ref=${{ github.event.base_ref || github.ref }}
candidate_branch=$(echo $community_base_ref | cut -d'/' -f3)
echo "candidate_branch=$candidate_branch" >> $GITHUB_OUTPUT
candidate_base_branch=$(echo $candidate_branch | awk -F'.' -v OFS='.' '{ $3="x"; print }')
echo "candidate_base_branch=$candidate_base_branch" >> $GITHUB_OUTPUT
echo "cmake_docker_config=-DCMAKE_BUILD_TYPE=RelWithDebInfo -DVCPKG_FILES_DIR=/hpcc-dev -DCPACK_THREADS=0 -DUSE_OPTIONAL=OFF -DSIGN_MODULES=${{ github.repository_owner == 'hpcc-systems' && 'ON' || 'OFF' }}" >> $GITHUB_OUTPUT
echo 'gpg_import=gpg --batch --import /hpcc-dev/build/private.key' >> $GITHUB_OUTPUT
latest_tag=$(git tag -l | grep -E "^community_[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,3}-[0-9]{1,2}" | sort -V | tail -n 1)
echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT
echo "is_latest=$(echo $latest_tag | grep -q $community_tag && echo true || echo false)" >> $GITHUB_OUTPUT
vcpkg_sha_short=$(git rev-parse --short=8 HEAD)
echo "vcpkg_sha_short=$vcpkg_sha_short" >> $GITHUB_OUTPUT
docker_build_label=hpccsystems/platform-build-${{ inputs.os }}
echo "docker_build_label=$docker_build_label" >> $GITHUB_OUTPUT
echo "docker_tag=$docker_build_label:$vcpkg_sha_short" >> $GITHUB_OUTPUT
echo "docker_tag_candidate_base=$docker_build_label:$candidate_base_branch" >> $GITHUB_OUTPUT
- name: Print Vars
run: echo "${{ toJson(steps.vars.outputs)}}"
- name: Checkout LN
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/LN
ref: ${{ steps.vars.outputs.internal_ref }}
token: ${{ secrets.LNB_TOKEN }}
submodules: recursive
path: ${{ steps.vars.outputs.folder_ln }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create Build Image
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
file: ${{ steps.vars.outputs.folder_platform }}/dockerfiles/${{ inputs.os }}.dockerfile
context: ${{ steps.vars.outputs.folder_platform }}/dockerfiles
push: ${{ github.repository_owner == 'hpcc-systems' }}
load: ${{ github.repository_owner != 'hpcc-systems' }}
build-args: |
VCPKG_REF=${{ steps.vars.outputs.vcpkg_sha_short }}
tags: |
${{ steps.vars.outputs.docker_tag_candidate_base }}
cache-from: |
type=registry,ref=${{ steps.vars.outputs.docker_tag_candidate_base }}
type=registry,ref=${{ steps.vars.outputs.docker_tag }}
cache-to: type=inline
- name: CMake Packages (enterprise)
run: |
mkdir -p ${{ steps.vars.outputs.folder_build }}
echo "${{ secrets.SIGNING_SECRET }}" > ${{ steps.vars.outputs.folder_build }}/private.key
sudo rm -f ${{ steps.vars.outputs.folder_build }}/CMakeCache.txt
sudo rm -rf ${{ steps.vars.outputs.folder_build }}/CMakeFiles
docker run --rm --mount ${{ steps.vars.outputs.mount_platform }} --mount ${{ steps.vars.outputs.mount_ln }} --mount ${{ steps.vars.outputs.mount_build }} ${{ steps.vars.outputs.docker_tag_candidate_base }} "${{ steps.vars.outputs.gpg_import }} && \
cmake -S /hpcc-dev/LN -B /hpcc-dev/build -DHPCC_SOURCE_DIR=/hpcc-dev/HPCC-Platform ${{ steps.vars.outputs.cmake_docker_config }} -DBUILD_LEVEL=ENTERPRISE -DSIGN_MODULES_PASSPHRASE=${{ secrets.SIGN_MODULES_PASSPHRASE }} -DSIGN_MODULES_KEYID=${{ secrets.SIGN_MODULES_KEYID }} -DPLATFORM=ON -DINCLUDE_PLUGINS=ON -DCONTAINERIZED=OFF -DSUPPRESS_REMBED=ON -DSUPPRESS_V8EMBED=ON -DSUPPRESS_SPARK=ON -DCPACK_STRIP_FILES=OFF && \
cmake --build /hpcc-dev/build --parallel $(nproc) --target package"
find ${{ steps.vars.outputs.folder_build }}/ -type f -name '*.deb'
- name: Upload Assets to Jfrog (debian)
if: ${{ contains(inputs.os, 'ubuntu') && github.repository_owner == 'hpcc-systems'}}
shell: bash
run: |
cd ${{ steps.vars.outputs.folder_build }}
version=$(echo "${{ steps.vars.outputs.internal_tag }}" | sed 's/internal_//')
packages=($(ls -1 hpccsystems-*.deb ))
for _package in ${packages[@]}; do
distribution=$( echo "${_package}" | sed "s/^.*${version}//" | awk -F '_' '{print $1;}' )
curl -u${{ secrets.JFROG_USERNAME }}:${{ secrets.JFROG_PASSWORD }} -XPUT "https://${{ secrets.JFROG_REGISTRY }}/hpccpl-debian-local/pool/EE/${_package};deb.distribution=${distribution};deb.component=EE;deb.architecture=amd64" -T ${{ steps.vars.outputs.folder_build }}/${_package}
done
- name: Cleanup Environment
if: always()
run: rm -f ${{ steps.vars.outputs.folder_build }}/private.key
- name: Upload error logs
if: ${{ failure() || cancelled() }}
uses: actions/upload-artifact@v4
with:
name: build-platform-enterprise-${{ inputs.os }}${{ inputs.container && '-containerized' || '' }}-logs
path: ${{ steps.vars.outputs.folder_build }}/**/*.log