Skip to content

2.4.2rc11

2.4.2rc11 #223

# This workflow will build and upload WMCore core services to the production PyPI
# based on tag releases, see build_and_publish_services job. Then, the second
# named build_images, will build appropriate docker images using CMSKubernetes
# Dockefiles and upload them to CERN registry.
#
# The build_and_publish_services job relies on pypi_build_template.yaml
# The build_images relies on docker_images_template.yaml template
# Each job use matrics target (as input list to iterate) and setup
# wmcore_component which is used by corresponding template to perform
# set of actions. We also define here necessary secrets used by given template.
on:
# this section fires workflow on a specific tag which matches some pattern
push:
tags:
- '*.*.*'
# this section forces manual builds
workflow_dispatch:
inputs:
name:
description: 'WMCore services'
jobs:
# first job performs build and upload of packages to PyPI
build_and_publish_services:
name: Build_and_upload_to_pypi
runs-on: ubuntu-latest
environment:
name: production
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
strategy:
matrix:
target: [wmagent, wmagentdev, wmcore, reqmon, reqmgr2, wmglobalqueue, acdcserver, msunmerged,
msoutput, mspileup, msrulecleaner, mstransferor, msmonitor]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
# setup ubuntu Linux with packages required for installing locally WM
# python packages, e.g. we need curl-config for pycurl (it comes from dev
# libcurl library), etc.
- name: Update system packages to include pycurl
run: |
echo "update system packages to include pycurl dev library (required for pycurl)"
sudo apt update
sudo apt install -y curl libcurl4-openssl-dev
# upgrade pip
- name: Upgrade pip3 and install build tools
run: |
python3 -m pip install --upgrade pip
python3 -m pip install setuptools wheel
# create appropriate setup.py for python builds
- name: Update the setup script template with package name
run: |
sed "s/PACKAGE_TO_BUILD/${{ matrix.target }}/" setup_template.py > setup.py
# perform CI/CD actions to install WM packages locally
# first we create proper requirements file, but will skip gfal dependency
# as it only exist for CERN/WLCG based Linux distribution
- name: Create requirements file
run: |
echo "create new requirements.txt without gfal dependencies for CI/CD"
cat requirements.txt | egrep -v "gfal2-python|python-gfal2" > requirements.${{ matrix.target }}.txt
awk "/(${{ matrix.target }}$)|(${{ matrix.target }},)/ {print \$1}" requirements.${{ matrix.target }}.txt > requirements.txt
# this step will build tarball and whl files for our matrix.target WM package
- name: Build sdist and bdist_wheel
run: |
echo "build WMCore sdist and wheels"
python3 setup.py clean sdist bdist_wheel
# the local dist area now should have both WM tarballs and wheels files, e.g.
# wmagent-2.3.10-py3-none-any.whl wmagent-2.3.10.tar.gz
- name: Verify built package
run: ls -lh dist/
# this step will take local tarball or whl file and install it via pip
- name: Install package locally from built artifacts
run: |
pip install -r requirements.txt
pip install --no-index --find-links=dist/ ${{ matrix.target }}
# this step should print on stdout the installed package from
# matrix.target, e.g. wmagent==2.3.10rc6
- name: Test package installation
run: |
pip list --format=freeze | grep ${{ matrix.target }}
# perform CI/CD actions to upload WM packages to PyPi
- name: Upload package distribution to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
# second job, depends on build_and_publish_services, builds and upload
# docker images to CERN registry
build_images:
name: Build_images
needs: [build_and_publish_services]
strategy:
matrix:
target: [wmagent, reqmon, t0reqmon, reqmgr2, msunmerged, wmglobalqueue,
msoutput, mspileup, msrulecleaner, mstransferor, msmonitor]
uses: ./.github/workflows/docker_images_template.yaml
with:
wmcore_component: ${{ matrix.target }}
secrets:
cern_user: ${{ secrets.CERN_LOGIN }}
cern_token: ${{ secrets.CERN_TOKEN }}