Skip to content

Fix errors after stub typing PR #2089

Fix errors after stub typing PR

Fix errors after stub typing PR #2089

Workflow file for this run

name: build libraries
on:
push:
branches:
- develop
pull_request:
branches:
- develop
workflow_dispatch: {}
jobs:
changes:
runs-on: ubuntu-22.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@v3
- uses: dorny/[email protected]
id: filter
with:
base: ${{ github.ref }}
filters: |
tklog:
- 'libs/tklog/conanfile.py'
tkassert:
- 'libs/tkassert/conanfile.py'
tkrng:
- 'libs/tkrng/conanfile.py'
tktokenswap:
- 'libs/tktokenswap/conanfile.py'
tkwsm:
- 'libs/tkwsm/conanfile.py'
build_libraries:
name: build library
needs: changes
if: ${{ needs.changes.outputs.libs != '[]' && needs.changes.outputs.libs != '' }}
strategy:
matrix:
os: ['ubuntu-22.04', 'macos-12', 'windows-2022']
lib: ${{ fromJson(needs.changes.outputs.libs) }}
build_type: ['Release', 'Debug']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- 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: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install conan
uses: turtlebrowser/[email protected]
- name: create profile
run: conan profile detect
- name: add remote
run: 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: authenticate to repository
run: conan remote login -p ${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }} tket-libs ${{ secrets.JFROG_ARTIFACTORY_USER_3 }}
- 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 upload ${{ env.LIB_LABEL }} -r=tket-libs
macos-m1:
name: build library (macos-m1)
needs: changes
if: ${{ needs.changes.outputs.libs != '[]' && needs.changes.outputs.libs != '' }}
runs-on: ['self-hosted', 'macOS', 'ARM64']
strategy:
matrix:
lib: ${{ fromJson(needs.changes.outputs.libs) }}
build_type: ['Release', 'Debug']
steps:
- uses: actions/checkout@v3
- name: Install conan
uses: turtlebrowser/[email protected]
- name: create profile
run: conan profile detect --force
- name: set remotes
run: conan remote add --force 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: authenticate to repository
run: conan remote login -p ${{ secrets.JFROG_ARTIFACTORY_TOKEN_3 }} tket-libs ${{ secrets.JFROG_ARTIFACTORY_USER_3 }}
- name: get version
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 upload ${{ env.LIB_LABEL }} -r=tket-libs
- name: unauthenticate
if: always()
run: conan remote logout tket-libs
manylinux:
name: build library (manylinux)
needs: changes
if: ${{ needs.changes.outputs.libs != '[]' && needs.changes.outputs.libs != '' }}
runs-on: ubuntu-22.04
strategy:
matrix:
lib: ${{ fromJson(needs.changes.outputs.libs) }}
env:
UPLOAD_PACKAGE: "NO"
steps:
- uses: actions/checkout@v3
- name: set up container
run: |
docker create --name linux_build -i -v /:/host quay.io/pypa/manylinux2014_x86_64:latest /bin/bash
docker cp ./libs/${{ matrix.lib }} linux_build:/
docker cp ./libver linux_build:/
docker cp ./.github/workflows/linuxbuildlib 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 }}
EOF
docker exec --env-file env-vars linux_build /bin/bash -c "/linuxbuildlib"