build: handle nginx build on rhel #481
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: Build Casual - Alpha | |
on: | |
push: | |
branches: | |
- 'feature/**' | |
- '!feature/*/main' | |
- 'patch/**' | |
- '!patch/*/main' | |
env: | |
build_type: alpha | |
centos_image: casual/centos-builder | |
suse_image: casual/suse-builder | |
jobs: | |
calculate-version: | |
runs-on: self-hosted | |
outputs: | |
major_minor: ${{ steps.major_minor.outputs.value }} | |
base_version: ${{ steps.base_version.outputs.value }} | |
build_version: ${{ steps.build_version.outputs.value }} | |
casual_version: ${{ steps.casual_version.outputs.value }} | |
casual_release: ${{ steps.casual_release.outputs.value }} | |
steps: | |
- name: check out repository casual | |
uses: actions/checkout@v4 | |
with: | |
path: 'casual' | |
fetch-depth: 0 | |
- name: retrieve major/minor from branch | |
uses: kaisugi/action-regex-match@v1.0.1 | |
id: regex-match | |
with: | |
text: ${{ github.ref }} | |
regex: '^.*/([0-9.]+)/.*$' | |
- name: set major/minor-version | |
id: major_minor | |
run: echo "value=${{ steps.regex-match.outputs.group1 }}" >> $GITHUB_OUTPUT | |
- name: set base_version | |
id: base_version | |
run: | | |
cd ${{ github.workspace }}/casual | |
echo "value=$( ${{ github.workspace }}/casual/pipeline/script/version.py ${{ steps.regex-match.outputs.group1 }} ${{ env.build_type}} )" >> $GITHUB_OUTPUT | |
- name: normalized branch | |
id: normalized_branch | |
run: echo "value=$( echo ${{ github.ref }} | sed -E -e 's/refs\/heads\/feature\/[0-9.]+\///g' -e 's/-/_/g' -e 's/\//_/g' )" >> $GITHUB_OUTPUT | |
- name: set build_version | |
id: build_version | |
run: | | |
echo "value=${{ steps.base_version.outputs.value }}${{ steps.normalized_branch.outputs.value }}.${{ github.run_number }}" >> $GITHUB_OUTPUT | |
- name: set casual_version | |
id: casual_version | |
run: | | |
echo "value=$( echo ${{ steps.build_version.outputs.value }} | awk -F'-' '{ print $1 }' )" >> $GITHUB_OUTPUT | |
- name: set casual_release | |
id: casual_release | |
run: | | |
echo "value=$( echo ${{ steps.build_version.outputs.value }} | awk -F'-' '{ print $2 }' )" >> $GITHUB_OUTPUT | |
notification-start: | |
runs-on: ubuntu-latest | |
needs: [calculate-version] | |
steps: | |
- name: Discord notification | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/action-discord@0.3.2 | |
with: | |
args: "Starting a new build, Repo: ${{ github.repository }}, Branch: ${{ github.ref_name }}, Version: ${{ needs.calculate-version.outputs.build_version }}, URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
build-centos: | |
runs-on: [self-hosted, builder] | |
if: ${{ success() }} | |
needs: [calculate-version,notification-start] | |
env: | |
DISTRIBUTION: 'centos' | |
steps: | |
- name: check out repository casual | |
uses: actions/checkout@v4 | |
with: | |
path: 'casual' | |
fetch-depth: 0 | |
- name: check out casual-thirdparty | |
uses: actions/checkout@v4 | |
with: | |
repository: 'casualcore/casual-thirdparty' | |
ref: ${{ needs.calculate-version.outputs.major_minor }} | |
path: 'casual-thirdparty' | |
- name: check out casual-make | |
uses: actions/checkout@v4 | |
with: | |
repository: 'casualcore/casual-make' | |
ref: 'master' | |
path: 'casual-make' | |
- name: prepare build-script | |
run: | | |
cat << EOD > builder.sh | |
#! /bin/bash | |
set -e | |
source /git/casual/casual/pipeline/script/pipeline.env | |
bash /git/casual/casual/pipeline/script/pre/cleanup | |
touch /git/casual/casual.log | |
chmod 777 /git/casual/casual.log | |
bash /git/casual/casual/pipeline/script/backend/$DISTRIBUTION/build ${{ needs.calculate-version.outputs.build_version }} | |
bash /git/casual/casual/pipeline/script/package ${{ needs.calculate-version.outputs.casual_version }} ${{ needs.calculate-version.outputs.casual_release }} $DISTRIBUTION | |
bash /git/casual/casual/pipeline/script/post/cleanup | |
EOD | |
chmod +x builder.sh | |
- name: Build | |
run: | | |
docker run --rm -v ${{ github.workspace }}:/git/casual:Z -i ${{ env.centos_image}}:${{ needs.calculate-version.outputs.major_minor }} | |
- name: Logpublisher | |
if: ${{ failure() || cancelled() }} | |
run: | | |
${{ github.workspace }}/casual/pipeline/script/post/logpublisher ${{ github.workspace }}/casual.log ${DISTRIBUTION}-${{ needs.calculate-version.outputs.build_version }} | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: ${{ success() || failure() }} # run this step even if previous step failed | |
with: | |
name: Google Tests - Centos # Name of the check run which will be created | |
path: ./**/report.xml # Path to test results | |
reporter: java-junit # Format of test result | |
working-directory: casual | |
- name: Save artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: centos_rpm | |
path: ./**/casual-middleware*.rpm | |
build-suse: | |
runs-on: [self-hosted, builder] | |
if: ${{ success() }} | |
needs: [calculate-version,notification-start] | |
env: | |
DISTRIBUTION: 'suse' | |
steps: | |
- name: check out repository casual | |
uses: actions/checkout@v4 | |
with: | |
path: 'casual' | |
fetch-depth: 0 | |
- name: check out casual-thirdparty | |
uses: actions/checkout@v4 | |
with: | |
repository: 'casualcore/casual-thirdparty' | |
ref: ${{ needs.calculate-version.outputs.major_minor }} | |
path: 'casual-thirdparty' | |
- name: check out casual-make | |
uses: actions/checkout@v4 | |
with: | |
repository: 'casualcore/casual-make' | |
ref: 'master' | |
path: 'casual-make' | |
- name: prepare build-script | |
run: | | |
cat << EOD > builder.sh | |
#! /bin/bash | |
set -e | |
source /git/casual/casual/pipeline/script/pipeline.env | |
bash /git/casual/casual/pipeline/script/pre/cleanup | |
touch /git/casual/casual.log | |
chmod 777 /git/casual/casual.log | |
bash /git/casual/casual/pipeline/script/backend/$DISTRIBUTION/build ${{ needs.calculate-version.outputs.build_version }} | |
bash /git/casual/casual/pipeline/script/package ${{ needs.calculate-version.outputs.casual_version }} ${{ needs.calculate-version.outputs.casual_release }} $DISTRIBUTION | |
bash /git/casual/casual/pipeline/script/post/cleanup | |
EOD | |
chmod +x builder.sh | |
- name: Build | |
run: | | |
docker run --rm -v ${{ github.workspace }}:/git/casual:Z -i ${{ env.suse_image}}:${{ needs.calculate-version.outputs.major_minor }} | |
- name: Logpublisher | |
if: ${{ failure() || cancelled() }} | |
run: | | |
${{ github.workspace }}/casual/pipeline/script/post/logpublisher ${{ github.workspace }}/casual.log ${DISTRIBUTION}-${{ needs.calculate-version.outputs.build_version }} | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: ${{ success() || failure() }} # run this step even if previous step failed | |
with: | |
name: Google Tests - Suse # Name of the check run which will be created | |
path: ./**/report.xml # Path to test results | |
reporter: java-junit # Format of test result | |
working-directory: casual | |
- name: Save artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: suse_rpm | |
path: ./**/casual-middleware*.rpm | |
notification-end: | |
runs-on: ubuntu-latest | |
needs: [calculate-version,build-centos,build-suse] | |
if: ${{ always() }} | |
steps: | |
- uses: martialonline/workflow-status@v4 | |
id: check | |
- name: Discord notification | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/action-discord@0.3.2 | |
with: | |
args: "Build status ${{ steps.check.outputs.status }}, Repo: ${{ github.repository }}, Branch: ${{ github.ref_name }}, Version: ${{ needs.calculate-version.outputs.build_version }}, URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" |