-
Notifications
You must be signed in to change notification settings - Fork 16
175 lines (158 loc) · 6.48 KB
/
cpack.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
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
name: CI package
on:
workflow_dispatch:
push:
branches:
- main
- release-*
pull_request:
branches:
- main
- release-*
paths:
- programs/ziti-edge-tunnel/package/*
- .github/actions/openziti-tunnel-build-action/*
- .github/workflows/cpack.yml
release:
types:
- published
# cancel older, redundant runs of same workflow on same branch
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
set_matrix:
name: Set CPack Config Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set_matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set Matrix
id: set_matrix
shell: bash
run: |
matrix="$(
yq --output-format json .github/cpack-matrix.yml \
| jq --compact-output '.cpack_matrix'
)"
echo "matrix=$matrix" | tee -a $GITHUB_OUTPUT
package:
needs: set_matrix
name: ${{ matrix.arch.rpm }} ${{ matrix.distro.name }} ${{ matrix.distro.version }}
runs-on: ubuntu-20.04
# build image name it from matrix values name:version unless override container is specified
container: ${{ matrix.distro.container || format('{0}:{1}', matrix.distro.name, matrix.distro.version) }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.set_matrix.outputs.matrix) }}
env:
ZITI_DEB_TEST_REPO: ${{ vars.ZITI_DEB_TEST_REPO || 'zitipax-openziti-deb-test' }}
ZITI_RPM_TEST_REPO: ${{ vars.ZITI_RPM_TEST_REPO || 'zitipax-openziti-rpm-test' }}
"VCPKG_BINARY_SOURCES": "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite"
steps:
- name: Debug action
uses: hmarr/debug-action@v3
# only focal-20.04 has >= 2.18, which is required by actions/checkout to clone
# which enables cmake version discovery
- name: install contemporary Git in runner container if Ubuntu
if: ${{ matrix.distro.name == 'ubuntu' }}
shell: bash
run: |
apt-get update
apt-get install --yes software-properties-common
add-apt-repository --yes ppa:git-core/ppa
apt-get update
apt-get install --yes git
git --version
- name: install contemporary Git in runner container if RedHat 8 or 9
if: ${{ matrix.distro.name == 'redhat' && (matrix.distro.version == '8' || matrix.distro.version == '9') }}
shell: bash
run: |
dnf -y update
dnf -y install git
git --version
- name: checkout workspace
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: configure build action for distro version
env:
DISTRO_LABEL: ${{ format('{0}-{1}', matrix.distro.name, matrix.distro.version) }}
shell: bash
run: |
cp -vr ./.github/actions/openziti-tunnel-build-action/${DISTRO_LABEL}/* ./.github/actions/openziti-tunnel-build-action/
- uses: actions/cache@v4
with:
key: deps-cpack-${{ matrix.arch.rpm }}-${{ matrix.distro.name }}-${{ matrix.distro.version }}-${{ hashFiles('./vcpkg.json', './.github/actions/openziti-tunnel-build-action/vcpkg-overlays/**/vcpkg.json') }}
path: ./vcpkg_cache
# entrypoint.sh uses the value of arch to select the cmake preset
- name: build binary and package
uses: ./.github/actions/openziti-tunnel-build-action
env:
# map vcpkg cache so container uses the same directory as the rest of the workflow
"VCPKG_BINARY_SOURCES": "clear;files,/github/workspace/vcpkg_cache,readwrite"
with:
arch: ${{ matrix.arch.cmake }}
config: RelWithDebInfo
- name: list artifacts
shell: bash
run: |
set -x
cat /etc/*-release
ls -horAS ./build/*.${{ matrix.distro.type }}
ls -horAS ./build/programs/ziti-edge-tunnel/RelWithDebInfo/ziti-edge-tunnel
- name: install package artifact in runner container if Ubuntu x86_64
if: ${{ matrix.arch.cmake == 'ci-linux-x64' && matrix.distro.name == 'ubuntu' }}
env:
DEBIAN_FRONTEND: noninteractive
shell: bash
run: |
apt-get -y install ./build/ziti-edge-tunnel-*.deb
- name: install package artifact in runner container if RedHat
if: ${{ matrix.arch.cmake == 'ci-linux-x64' && matrix.distro.name == 'redhat' }}
shell: bash
run: |
set -x
yum -y install ./build/ziti-edge-tunnel-*.rpm
- name: run binary artifact
if: ${{ matrix.arch.cmake == 'ci-linux-x64' }}
shell: bash
run: |
set -x
cat /etc/*-release
ldd ./build/programs/ziti-edge-tunnel/RelWithDebInfo/ziti-edge-tunnel
./build/programs/ziti-edge-tunnel/RelWithDebInfo/ziti-edge-tunnel version --verbose
- name: Upload Package to Workflow Summary Page
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.distro.name }}-${{ matrix.distro.version }}-${{ matrix.arch.rpm }}-${{ matrix.distro.type }}
path: ./build/ziti-edge-tunnel-*.${{ matrix.distro.type }}
if-no-files-found: error
- name: Configure jFrog CLI
if: ${{ github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') }}
uses: jfrog/setup-jfrog-cli@v4
env:
JF_ENV_1: ${{ secrets.ZITI_ARTIFACTORY_CLI_CONFIG_PACKAGE_UPLOAD }}
- name: Upload RPM to Artifactory with jFrog CLI
if: ${{ github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') && matrix.distro.name == 'redhat' }}
shell: bash
run: >
jf rt upload
./build/ziti-edge-tunnel-*.${{ matrix.distro.type }}
${{ env.ZITI_RPM_TEST_REPO }}/redhat${{ matrix.distro.version }}/${{ matrix.arch.rpm }}/
--recursive=false
--flat=true
- name: Upload DEB to Artifactory with jFrog CLI
if: ${{ github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') && matrix.distro.name == 'ubuntu' }}
shell: bash
run: >
jf rt upload
./build/ziti-edge-tunnel-*.${{ matrix.distro.type }}
${{ env.ZITI_DEB_TEST_REPO }}/pool/ziti-edge-tunnel/${{ matrix.distro.release_name }}/${{ matrix.arch.deb }}/
--deb=${{ matrix.distro.release_name }}/main/${{ matrix.arch.deb }}
--recursive=false
--flat=true