Skip to content

Commit

Permalink
Merge pull request #436 from CQCL/release/1.4
Browse files Browse the repository at this point in the history
Release/1.4
  • Loading branch information
cqc-alec authored Jul 12, 2022
2 parents eb7ca62 + 0e68d3e commit 634bee6
Show file tree
Hide file tree
Showing 469 changed files with 25,385 additions and 1,925 deletions.
69 changes: 61 additions & 8 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
conan_cmd=/home/runner/.local/bin/conan
${conan_cmd} profile new tket --detect
${conan_cmd} profile update settings.compiler.libcxx=libstdc++11 tket
${conan_cmd} profile update options.tklog:shared=True tket
${conan_cmd} profile update options.tket:shared=True tket
echo "CONAN_CMD=${conan_cmd}" >> $GITHUB_ENV
- name: set option to run full test suite
Expand Down Expand Up @@ -94,7 +95,7 @@ jobs:
run: |
cd pytket/tests
pip install -r requirements.txt
pytest --ignore=simulator/ --doctest-modules
pytest --ignore=simulator/ --doctest-modules --cov=../pytket --cov-branch --cov-report=html --cov-report=xml:htmlcov/cov.xml
- name: Set up Python 3.9
if: github.event_name == 'pull_request'
uses: actions/setup-python@v3
Expand All @@ -116,7 +117,7 @@ jobs:
run: |
cd pytket/tests
pip install -r requirements.txt
pytest --ignore=simulator/ --doctest-modules
pytest --ignore=simulator/ --doctest-modules --cov=../pytket --cov-branch --cov-report=html --cov-report=xml:htmlcov/cov.xml
- name: Set up Python 3.10
if: github.event_name == 'schedule'
uses: actions/setup-python@v3
Expand All @@ -133,6 +134,13 @@ jobs:
cd pytket/tests
pip install -r requirements.txt
pytest --ignore=simulator/ --doctest-modules
- name: Upload pytket coverage artefact
if: github.event_name == 'pull_request' || github.event_name == 'push'
uses: actions/upload-artifact@v3
with:
name: pytket_test_coverage
path: pytket/tests/htmlcov


macos:
name: Build and test (MacOS)
Expand Down Expand Up @@ -181,6 +189,7 @@ jobs:
run: |
pip install conan
conan profile new tket --detect --force
conan profile update options.tklog:shared=True tket
conan profile update options.tket:shared=True tket
export CC=`which conan`
echo "CONAN_CMD=${CC}" >> $GITHUB_ENV
Expand All @@ -189,10 +198,8 @@ jobs:
run: conan profile update options.tket-tests:full=True tket
- name: add remote
run: conan remote add tket-conan https://tket.jfrog.io/artifactory/api/conan/tket-conan --force
- name: Install boost
run: conan install --profile=tket boost/1.79.0@ --build=missing
- name: Build tket
run: conan create --profile=tket recipes/tket --build=tket
run: conan create --profile=tket recipes/tket --build=missing
- name: Build and run tket tests
run: conan create --profile=tket recipes/tket-tests
- name: Build and run tket proptests
Expand Down Expand Up @@ -275,6 +282,7 @@ jobs:
id: conan
run: |
conan profile new tket --detect --force
conan profile update options.tklog:shared=True tket
conan profile update options.tket:shared=True tket
export CC=`which conan`
echo "CONAN_CMD=${CC}" >> $GITHUB_ENV
Expand All @@ -283,10 +291,8 @@ jobs:
run: conan profile update options.tket-tests:full=True tket
- name: add remote
run: conan remote add tket-conan https://tket.jfrog.io/artifactory/api/conan/tket-conan --force
- name: Install boost
run: conan install --profile=tket boost/1.79.0@ --build=missing
- name: Build tket
run: conan create --profile=tket recipes/tket --build=tket
run: conan create --profile=tket recipes/tket --build=missing
- name: Build and run tket tests
run: conan create --profile=tket recipes/tket-tests
- name: Build and run tket proptests
Expand Down Expand Up @@ -379,6 +385,7 @@ jobs:
run: |
pip install conan
conan profile new tket --detect
conan profile update options.tklog:shared=True tket
conan profile update options.tket:shared=True tket
$conan_cmd = (gcm conan).Path
echo "CONAN_CMD=${conan_cmd}" >> $GITHUB_ENV
Expand Down Expand Up @@ -441,3 +448,49 @@ jobs:
cd tests
pip install -r requirements.txt
pytest --ignore=simulator/ --doctest-modules
publish_pytket_coverage:
name: Publish pytket coverage
needs: linux
concurrency: gh_pages
if: github.event_name == 'push'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
ref: gh-pages
- name: Download artefact
uses: actions/download-artifact@v3
with:
name: pytket_test_coverage
path: htmlcov/
- name: Configure git
run: |
git config --global user.email "[email protected]"
git config --global user.name "«$GITHUB_WORKFLOW» github action"
- name: Remove old report
run: git rm -r docs/pytket/test-coverage
- name: Add report to repository
run: |
mv htmlcov docs/pytket/test-coverage
git add -f docs/pytket/test-coverage
git commit --allow-empty -m "Add generated pytket coverage report."
- name: Publish report
run: git push origin gh-pages:gh-pages

check_pytket_coverage:
name: Check pytket line and branch coverage
needs: linux
if: github.event_name == 'pull_request'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Download artefact
uses: actions/download-artifact@v3
with:
name: pytket_test_coverage
path: pytket-test-coverage/
- name: Compare with latest report from develop
run: |
wget https://cqcl.github.io/tket/pytket/test-coverage/cov.xml -O oldcov.xml
./.github/workflows/compare-pytket-coverage oldcov.xml pytket-test-coverage/cov.xml
166 changes: 166 additions & 0 deletions .github/workflows/build_libs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
name: build libraries
on:
push:
branches:
- develop
pull_request:
branches:
- develop
jobs:
changes:
runs-on: ubuntu-20.04
outputs:
tklog: ${{ steps.filter.outputs.tklog }}
tkassert: ${{ steps.filter.outputs.tkassert }}
tkrng: ${{ steps.filter.outputs.tkrng }}
libs: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
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-20.04', 'macos-11', 'windows-2019']
lib: ${{ fromJson(needs.changes.outputs.libs) }}
build_type: ['Release', 'Debug']
shared: ['True', 'False']
runs-on: ${{ matrix.os }}
env:
CONAN_REVISIONS_ENABLED: 1
steps:
- uses: actions/checkout@v3
- name: normalize line endings in conanfile and src directory
if: matrix.os == 'windows-2019'
# 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: |
$conanfile ='libs/${{ matrix.lib }}/conanfile.py'
$normalized_file = [IO.File]::ReadAllText($conanfile) -replace "`r`n", "`n"
[IO.File]::WriteAllText($conanfile, $normalized_file)
$src_files = Get-ChildItem "libs/${{ matrix.lib }}/src" -File -Recurse
foreach ($f in $src_files) {
$normalized_file = [IO.File]::ReadAllText($f) -replace "`r`n", "`n"
[IO.File]::WriteAllText($f, $normalized_file)
}
- name: set compiler
if: matrix.os == 'ubuntu-20.04'
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100
sudo update-alternatives --set gcc /usr/bin/gcc-10
sudo update-alternatives --set g++ /usr/bin/g++-10
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: install conan
run: pip install conan
- name: create profile
run: conan profile new tket --detect
- name: set libcxx
if: matrix.os == 'ubuntu-20.04'
run: conan profile update settings.compiler.libcxx=libstdc++11 tket
- name: add remote
run: conan remote add tket-conan https://tket.jfrog.io/artifactory/api/conan/tket-conan
- name: build ${{ matrix.lib }}
run: conan create --profile=tket -s build_type=${{ matrix.build_type }} -o ${{ matrix.lib }}:shared=${{ matrix.shared }} libs/${{ matrix.lib }} tket/stable --build=missing
- name: authenticate to repository
run: conan user -p ${{ secrets.JFROG_ARTIFACTORY_TOKEN_1 }} -r tket-conan ${{ secrets.JFROG_ARTIFACTORY_USER_1 }}
- name: get version
if: matrix.os != 'windows-2019'
run: |
lib_ver=$(conan inspect --raw version libs/${{ matrix.lib }}/conanfile.py)
echo "LIB_VER=${lib_ver}" >> $GITHUB_ENV
- name: get version
if: matrix.os == 'windows-2019'
run: |
$${{ matrix.lib }}_ver = conan inspect --raw version libs/${{ matrix.lib }}/conanfile.py
echo "LIB_VER=${${{ matrix.lib }}_ver}" >> $env:GITHUB_ENV
- name: upload package (dry run)
if: github.event_name == 'pull_request'
run: conan upload ${{ matrix.lib }}/${{ env.LIB_VER }}@tket/stable --all -r=tket-conan --skip-upload
- name: upload package
if: github.event_name == 'push'
run: conan upload ${{ matrix.lib }}/${{ env.LIB_VER }}@tket/stable --all -r=tket-conan
macos-m1:
name: build library (macos-m1)
needs: changes
if: ${{ needs.changes.outputs.libs != '[]' && needs.changes.outputs.libs != '' }}
runs-on: [self-hosted, macos, M1]
strategy:
matrix:
lib: ${{ fromJson(needs.changes.outputs.libs) }}
build_type: ['Release', 'Debug']
shared: ['True', 'False']
env:
CONAN_REVISIONS_ENABLED: 1
steps:
- uses: actions/checkout@v3
- name: install conan
run: pip install -U conan
- name: create profile
run: conan profile new tket --detect --force
- name: add remote
run: conan remote add tket-conan https://tket.jfrog.io/artifactory/api/conan/tket-conan --force
- name: build ${{ matrix.lib }}
run: conan create --profile=tket -s build_type=${{ matrix.build_type }} -o ${{ matrix.lib }}:shared=${{ matrix.shared }} libs/${{ matrix.lib }} tket/stable --build=missing
- name: authenticate to repository
run: conan user -p ${{ secrets.JFROG_ARTIFACTORY_TOKEN_1 }} -r tket-conan ${{ secrets.JFROG_ARTIFACTORY_USER_1 }}
- name: get version
run: |
lib_ver=$(conan inspect --raw version libs/${{ matrix.lib }}/conanfile.py)
echo "LIB_VER=${lib_ver}" >> $GITHUB_ENV
- name: upload package (dry run)
if: github.event_name == 'pull_request'
run: conan upload ${{ matrix.lib }}/${LIB_VER}@tket/stable --all -r=tket-conan --skip-upload
- name: upload package
if: github.event_name == 'push'
run: conan upload ${{ matrix.lib }}/${LIB_VER}@tket/stable --all -r=tket-conan
manylinux:
name: build library (manylinux)
needs: changes
if: ${{ needs.changes.outputs.libs != '[]' && needs.changes.outputs.libs != '' }}
runs-on: ubuntu-20.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 ./.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_1=${{ secrets.JFROG_ARTIFACTORY_TOKEN_1 }}
JFROG_ARTIFACTORY_USER_1=${{ secrets.JFROG_ARTIFACTORY_USER_1 }}
EOF
docker exec --env-file env-vars linux_build /bin/bash -c "/linuxbuildlib"
Loading

0 comments on commit 634bee6

Please sign in to comment.