|
| 1 | +# A github workflow file to build conquest python |
| 2 | +name: Build Conquest Python |
| 3 | + |
| 4 | +on: # yamllint disable-line rule:truthy |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + artifactory-push: |
| 8 | + description: "Push result to Artifactory" |
| 9 | + default: false |
| 10 | + type: boolean |
| 11 | + platforms: |
| 12 | + description: 'Platform to build for, eg. ' |
| 13 | + options: |
| 14 | + - 'rocky8' |
| 15 | + - 'ubuntu' |
| 16 | + - 'macos' |
| 17 | + - 'windows' |
| 18 | + push: |
| 19 | + paths: |
| 20 | + - '.github/workflows/build-conquest-python.yml' |
| 21 | + - 'build_conquest_python.py' |
| 22 | + - 'ccdc/thirdparty/package.py' |
| 23 | + |
| 24 | +jobs: |
| 25 | + setup: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + outputs: |
| 28 | + runson: ${{ steps.set_output.outputs.runson }} |
| 29 | + container: ${{ steps.set_output.outputs.container }} |
| 30 | + python: ${{ steps.set_output.outputs.python }} |
| 31 | + |
| 32 | + steps: |
| 33 | + - name: Checkout |
| 34 | + uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - name: Set output |
| 37 | + id: set_output |
| 38 | + run: | |
| 39 | + if [[ "${{ inputs.platforms }}" == "rocky8" ]]; then |
| 40 | + echo runson=ubuntu-latest >> $GITHUB_OUTPUT |
| 41 | + echo container=ccdcrepository.azurecr.io/conan/rocky8-gcc10:latest >> $GITHUB_OUTPUT |
| 42 | + echo python=python3 >> $GITHUB_OUTPUT |
| 43 | + elif [[ "${{ inputs.platforms }}" == "ubuntu" ]]; then |
| 44 | + echo runson=ubuntu-latest >> $GITHUB_OUTPUT |
| 45 | + echo python=python3 >> $GITHUB_OUTPUT |
| 46 | + elif [[ "${{ inputs.platforms }}" == "macos" ]]; then |
| 47 | + echo runson=macos-12 >> $GITHUB_OUTPUT |
| 48 | + echo python=python >> $GITHUB_OUTPUT |
| 49 | + elif [[ "${{ inputs.platforms }}" == "windows" ]]; then |
| 50 | + echo runson=windows-2019 >> $GITHUB_OUTPUT |
| 51 | + echo python=python >> $GITHUB_OUTPUT |
| 52 | + fi |
| 53 | +
|
| 54 | + # Build the conquest python for rocky8 |
| 55 | + echo runson=ubuntu-latest >> $GITHUB_OUTPUT |
| 56 | + echo container=ccdcrepository.azurecr.io/conan/rocky8-gcc10:latest >> $GITHUB_OUTPUT |
| 57 | + echo python=python3 >> $GITHUB_OUTPUT |
| 58 | +
|
| 59 | + build-upload: |
| 60 | + needs: |
| 61 | + - setup |
| 62 | + runs-on: ${{ needs.setup.outputs.runson }} |
| 63 | + container: |
| 64 | + image: ${{ needs.setup.outputs.container }} |
| 65 | + credentials: |
| 66 | + username: ${{ secrets.AZURE_CR_USER }} |
| 67 | + password: ${{ secrets.AZURE_CR_PASSWORD }} |
| 68 | + |
| 69 | + steps: |
| 70 | + - name: Checkout |
| 71 | + uses: actions/checkout@v4 |
| 72 | + |
| 73 | + - name: Set up Python |
| 74 | + uses: actions/setup-python@v5 |
| 75 | + if: ${{ needs.setup.outputs.python == 'python' }} |
| 76 | + with: |
| 77 | + python-version: '3.9' |
| 78 | + |
| 79 | + - name: Set up Python environment |
| 80 | + run: | |
| 81 | + ${{ needs.setup.outputs.python }} --version |
| 82 | + ${{ needs.setup.outputs.python }} -m pip install --upgrade pip wheel setuptools |
| 83 | +
|
| 84 | + - name: Build conquest python |
| 85 | + run: | |
| 86 | + output=$(${{ needs.setup.outputs.python }} build_conquest_python.py | grep Creating | tail -n 1) |
| 87 | + archive_filename=$(echo $output | awk '{print $2}') |
| 88 | + archive_path=$(echo $output | awk '{print $NF}') |
| 89 | + echo "archive_filename=$archive_filename" >> $GITHUB_ENV |
| 90 | + echo "archive_path=$archive_path" >> $GITHUB_ENV |
| 91 | +
|
| 92 | + - name: Set up JFrog CLI |
| 93 | + if: ${{ inputs.artifactory-push }} |
| 94 | + uses: jfrog/setup-jfrog-cli@v4 |
| 95 | + env: |
| 96 | + JF_ENV_1: ${{ secrets.ARTIFACTORY_GH_CCDC_3RDPARTY_PYTHON_INTERPRETERS_READ_WRITE_EXPORT }} |
| 97 | + |
| 98 | + - name: Upload conquest python to Artifactory |
| 99 | + if: ${{ inputs.artifactory-push }} |
| 100 | + shell: bash |
| 101 | + run: | |
| 102 | + # Upload the conquest python to Artifactory |
| 103 | + jf c use gh-ccdc-3rdparty-python-interpreters-read-write |
| 104 | + jfrog rt upload --flat \ |
| 105 | + "${{ env.archive_path }}/${{ env.archive_filename }}" \ |
| 106 | + "ccdc-3rdparty-python-interpreters/conquest_python/2.7/" |
0 commit comments