Store build logs as artifacts for inspection (CQ-1519) #33
This file contains hidden or 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
# A github workflow file to build conquest python | |
name: Build Conquest Python | |
on: # yamllint disable-line rule:truthy | |
workflow_dispatch: | |
inputs: | |
artifactory-push: | |
description: "Push result to Artifactory" | |
default: false | |
type: boolean | |
platforms: | |
description: 'Platform to build for' | |
type: choice | |
options: | |
- 'rocky8' | |
- 'ubuntu' | |
- 'macos' | |
- 'windows' | |
push: | |
paths: | |
- '.github/workflows/build-conquest-python.yml' | |
- 'build_conquest_python.py' | |
- 'ccdc/thirdparty/package.py' | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
runson: ${{ steps.set_output.outputs.runson }} | |
container: ${{ steps.set_output.outputs.container }} | |
python: ${{ steps.set_output.outputs.python }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set output | |
id: set_output | |
run: | | |
if [[ "${{ inputs.platforms }}" == "ubuntu" ]]; then | |
echo runson=ubuntu-latest >> $GITHUB_OUTPUT | |
echo python=python3 >> $GITHUB_OUTPUT | |
elif [[ "${{ inputs.platforms }}" == "macos" ]]; then | |
echo runson=macos-12 >> $GITHUB_OUTPUT | |
echo python=python >> $GITHUB_OUTPUT | |
elif [[ "${{ inputs.platforms }}" == "windows" ]]; then | |
echo runson=windows-2019 >> $GITHUB_OUTPUT | |
echo python=python >> $GITHUB_OUTPUT | |
else | |
# default to Rocky | |
echo runson=ubuntu-latest >> $GITHUB_OUTPUT | |
echo container=ccdcrepository.azurecr.io/conan/rocky8-gcc10:latest >> $GITHUB_OUTPUT | |
echo python=python3 >> $GITHUB_OUTPUT | |
fi | |
build-upload: | |
needs: | |
- setup | |
runs-on: ${{ needs.setup.outputs.runson }} | |
container: | |
image: ${{ needs.setup.outputs.container }} | |
credentials: | |
username: ${{ secrets.AZURE_CR_USER }} | |
password: ${{ secrets.AZURE_CR_PASSWORD }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
if: ${{ needs.setup.outputs.python == 'python' }} | |
with: | |
python-version: '3.9' | |
- name: Set up Python environment | |
run: | | |
${{ needs.setup.outputs.python }} --version | |
${{ needs.setup.outputs.python }} -m pip install --upgrade pip wheel setuptools | |
- name: Install patch | |
run: | | |
if [[ "${{ needs.setup.outputs.runson }}" == "ubuntu-latest" ]]; then | |
if [[ -f /etc/rocky-release ]]; then | |
sudo dnf install -y patch | |
else | |
sudo apt update && sudo apt install -y patch | |
fi | |
fi | |
- name: Build conquest python | |
run: | | |
output=$(${{ needs.setup.outputs.python }} build_conquest_python.py | grep Creating | tail -n 1) | |
archive_filename=$(echo $output | awk '{print $2}') | |
archive_path=$(echo $output | awk '{print $NF}') | |
echo "archive_filename=$archive_filename" >> $GITHUB_ENV | |
echo "archive_path=$archive_path" >> $GITHUB_ENV | |
echo $output | |
- name: Store build logs as build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
retention-days: 1 | |
path: "/opt/ccdc/third-party-sources/logs/*" | |
name: "build_logs.zip" | |
- name: Store conquest python as build artifact | |
if: ${{ !inputs.artifactory-push }} | |
uses: actions/upload-artifact@v4 | |
with: | |
retention-days: 1 | |
path: "${{ env.archive_path }}/${{ env.archive_filename }}" | |
name: ${{ env.archive_filename }} | |
- name: Set up JFrog CLI | |
if: ${{ inputs.artifactory-push }} | |
uses: jfrog/setup-jfrog-cli@v4 | |
env: | |
JF_ENV_1: ${{ secrets.ARTIFACTORY_GH_CCDC_3RDPARTY_PYTHON_INTERPRETERS_READ_WRITE_EXPORT }} | |
- name: Upload conquest python to Artifactory | |
if: ${{ inputs.artifactory-push }} | |
shell: bash | |
run: | | |
# Upload the conquest python to Artifactory | |
jf c use gh-ccdc-3rdparty-python-interpreters-read-write | |
jfrog rt upload --flat \ | |
"${{ env.archive_path }}/${{ env.archive_filename }}" \ | |
"ccdc-3rdparty-python-interpreters/conquest_python/2.7/" |