simplify vcpkg port overrides #506
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |