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