Skip to content

Commit 39443d6

Browse files
authored
BLD-6874 GitHub workflow (#18)
* Build conquest python with github workflow (BLD-6874) * Try run build script (BLD-6874) * old zlib source no longer available (BLD-6874) * Install required dependency (BLD-6874) * Try uploading to artifactory (BLD-6874) * Run again with jfrog config (BLD-6874) * Extract build output explicitly (BLD-6874) * Use "linux" in archive name (BLD-6874) * Update workflow as per review (BLD-6874) * Keep zlib version (BLD-6874)
1 parent 4f3ba60 commit 39443d6

File tree

5 files changed

+121
-188
lines changed

5 files changed

+121
-188
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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/"

azure-pipelines.yml

Lines changed: 0 additions & 112 deletions
This file was deleted.

build_conquest_python.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,17 @@ def main():
707707
except OSError:
708708
pass
709709

710+
if Package().linux:
711+
subprocess.run('sudo dnf update -y ', shell=True, check=True)
712+
#subprocess.run("sudo dnf install -y 'dnf-command(config-manager)'", shell=True, check=True)
713+
#subprocess.run('sudo dnf config-manager --enable powertools', shell=True, check=True)
714+
#subprocess.run('sudo dnf install -y epel-release', shell=True, check=True)
715+
subprocess.run(
716+
'sudo dnf install -y libXmu-devel',
717+
shell=True,
718+
check=True
719+
)
720+
710721
if not Package().windows:
711722
ZlibPackage().build()
712723
SqlitePackage().build()

ccdc/thirdparty/package.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def ubuntu_version(self):
5656

5757
@property
5858
def platform(self):
59+
if sys.platform.startswith('linux'):
60+
return 'linux'
5961
if not self.use_distribution_in_base_name:
6062
return sys.platform
6163
if not self.linux:
@@ -138,8 +140,8 @@ def output_base_name(self):
138140
self.name,
139141
self.version,
140142
]
141-
if 'BUILD_BUILDNUMBER' in os.environ:
142-
components.append(os.environ['BUILD_BUILDNUMBER'])
143+
if 'GITHUB_RUN_NUMBER' in os.environ:
144+
components.append(os.environ['GITHUB_RUN_NUMBER'])
143145
else:
144146
components.append('do-not-use-me-developer-version')
145147
components.append(self.platform)

common-tasks.yml

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)