Skip to content

Add trials and threads to GreedyPauliSimp #3868

Add trials and threads to GreedyPauliSimp

Add trials and threads to GreedyPauliSimp #3868

Workflow file for this run

name: build libraries
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: {}
jobs:
changes:
runs-on: ubuntu-24.04
outputs:
tklog: ${{ steps.filter.outputs.tklog }}
tkassert: ${{ steps.filter.outputs.tkassert }}
tkrng: ${{ steps.filter.outputs.tkrng }}
tktokenswap: ${{ steps.filter.outputs.tktokenswap }}
tkwsm: ${{ steps.filter.outputs.tkwsm }}
libs: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v4
- uses: dorny/[email protected]
id: filter
with:
base: ${{ github.ref }}
filters: |
tklog:
- 'libs/tklog/conanfile.py'
- '.github/workflows/build_libs.yml'
tkassert:
- 'libs/tkassert/conanfile.py'
- '.github/workflows/build_libs.yml'
tkrng:
- 'libs/tkrng/conanfile.py'
- '.github/workflows/build_libs.yml'
tktokenswap:
- 'libs/tktokenswap/conanfile.py'
- '.github/workflows/build_libs.yml'
tkwsm:
- 'libs/tkwsm/conanfile.py'
- '.github/workflows/build_libs.yml'
build_libraries:
name: build library
needs: changes
if: ${{ needs.changes.outputs.libs != '[]' && needs.changes.outputs.libs != '' }}
strategy:
matrix:
os: ['ubuntu-24.04', 'macos-13', 'macos-15', 'windows-2022']
lib: ${{ fromJson(needs.changes.outputs.libs) }}
build_type: ['Release', 'Debug']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: normalize line endings in conanfile and src directory
if: matrix.os == 'windows-2022'
# This is necessary to ensure consistent revisions across platforms.
# Conan's revision hash is composed of hashes all the exported files, so
# we must normalize the line endings in these.
run: |
$lib_files = Get-ChildItem "libs/${{ matrix.lib }}" -File -Recurse
foreach ($f in $lib_files) {
$normalized_file = [IO.File]::ReadAllText($f) -replace "`r`n", "`n"
[IO.File]::WriteAllText($f, $normalized_file)
}
- name: Select Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install conan
uses: turtlebrowser/[email protected]
- name: Set up conan
shell: bash
run: |
conan profile detect
DEFAULT_PROFILE_PATH=`conan profile path default`
PROFILE_PATH=./conan-profiles/${{ matrix.os }}
diff ${DEFAULT_PROFILE_PATH} ${PROFILE_PATH} || true
cp ${PROFILE_PATH} ${DEFAULT_PROFILE_PATH}
conan remote add tket-libs https://quantinuumsw.jfrog.io/artifactory/api/conan/tket1-libs --index 0
- name: build ${{ matrix.lib }}
run: conan create -s build_type=${{ matrix.build_type }} -o boost/*:header_only=True libs/${{ matrix.lib }} --build=missing --user=tket --channel=stable --format json > ${{ matrix.lib }}.json
- name: build shared ${{ matrix.lib }}
if: matrix.lib == 'tklog'
run: conan create -s build_type=${{ matrix.build_type }} -o boost/*:header_only=True -o ${{ matrix.lib }}/*:shared=True libs/${{ matrix.lib }} --build=missing --user=tket --channel=stable
- name: get version
shell: bash
run: |
lib_label=`./libver ${{ matrix.lib }}.json ${{ matrix.lib }}`
echo "LIB_LABEL=${lib_label}" >> $GITHUB_ENV
- name: upload package
if: github.event_name == 'push'
run: |
conan remote login -p ${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }} tket-libs ${{ secrets.JFROG_ARTIFACTORY_USER_3 }}
conan upload ${{ env.LIB_LABEL }} -r=tket-libs
manylinux:
name: build library (manylinux)
needs: changes
if: ${{ needs.changes.outputs.libs != '[]' && needs.changes.outputs.libs != '' }}
runs-on: ubuntu-24.04
strategy:
matrix:
lib: ${{ fromJson(needs.changes.outputs.libs) }}
env:
UPLOAD_PACKAGE: "NO"
steps:
- uses: actions/checkout@v4
- name: set up container
run: |
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux_2_28_x86_64:latest /bin/bash
docker cp ./libs/${{ matrix.lib }} linux_build:/
docker cp ./libver linux_build:/
docker cp ./.github/workflows/linuxbuildlib linux_build:/
docker cp ./conan-profiles linux_build:/
- name: determine whether to upload package
if: github.event_name == 'push'
run: echo "UPLOAD_PACKAGE=YES" >> ${GITHUB_ENV}
- name: build ${{ matrix.lib }}
run: |
docker start linux_build
cat <<EOF > env-vars
TKLIB=${{ matrix.lib }}
UPLOAD_PACKAGE=${UPLOAD_PACKAGE}
JFROG_ARTIFACTORY_TOKEN_3=${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }}
JFROG_ARTIFACTORY_USER_3=${{ secrets.JFROG_ARTIFACTORY_USER_3 }}
CONAN_PROFILE=linux-x86_64-gcc12
EOF
docker exec --env-file env-vars linux_build /bin/bash -c "/linuxbuildlib"