CI package #317
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: # ignore push to tags | |
- '**' | |
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@v3 | |
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' }} | |
steps: | |
- name: Debug action | |
uses: hmarr/[email protected] | |
# 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: install contemporary Git in runner container if RedHat 7 | |
if: ${{ matrix.distro.name == 'redhat' && matrix.distro.version == '7' }} | |
shell: bash | |
run: | | |
yum -y update | |
yum -y install centos-release-scl | |
yum -y install rh-git218 | |
source scl_source enable rh-git218 && git --version | |
cat << 'EOF' >| /root/git.sh | |
#!/bin/bash | |
source scl_source enable rh-git218 && git "${@}" | |
EOF | |
chmod +x /root/git.sh | |
update-alternatives --install /usr/bin/git git /root/git.sh 50 | |
- name: checkout workspace | |
uses: actions/checkout@v3 | |
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: | | |
mv -v ./.github/actions/openziti-tunnel-build-action/${DISTRO_LABEL}/* ./.github/actions/openziti-tunnel-build-action/ | |
# entrypoint.sh uses the value of arch to select the cmake preset | |
- name: build binary and package | |
uses: ./.github/actions/openziti-tunnel-build-action | |
with: | |
arch: ${{ matrix.arch.cmake }} | |
config: Release | |
- name: list artifacts | |
shell: bash | |
run: | | |
set -x | |
cat /etc/*-release | |
ls -horAS ./build/*.${{ matrix.distro.type }} | |
ls -horAS ./build/programs/ziti-edge-tunnel/Release/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/Release/ziti-edge-tunnel | |
./build/programs/ziti-edge-tunnel/Release/ziti-edge-tunnel version --verbose | |
- name: Upload Package to Workflow Summary Page | |
uses: actions/upload-artifact@v3 | |
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@v3 | |
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 |