-
Notifications
You must be signed in to change notification settings - Fork 16
173 lines (167 loc) · 5.37 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Test
on:
push:
branches:
- develop
pull_request:
jobs:
cpp-linux-macos-windows:
name: 'C++ tests (Linux-MacOS-Windows/x64)'
strategy:
fail-fast: false
matrix:
# Building for {g++, clang++}/Linux, clang++/MacOS, and msvc/Windows
# both in Debug and Release
os: [ubuntu-latest, macos-latest, windows-latest]
compiler: [g++, clang++, msvc]
build_type: [Debug, Release]
exclude:
- os: ubuntu-latest
compiler: msvc
- os: macos-latest
compiler: g++
- os: macos-latest
compiler: msvc
- os: windows-latest
compiler: g++
- os: windows-latest
compiler: clang++
runs-on: ${{ matrix.os }}
steps:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install conan
run: python -m pip install --upgrade pip conan
- name: Get latest CMake
uses: lukka/get-cmake@latest
- name: Checkout
uses: actions/checkout@v3
- name: Configure and build
run: |
conan profile detect
build_type=${{ matrix.build_type }}
lowercase_build_type=$(echo ${build_type} | tr '[:upper:]' '[:lower:]')
conan build . -pr=conan/profiles/tests-${lowercase_build_type}-compat -b missing
shell: bash
- name: Test
working-directory: build/${{ matrix.build_type }}
run: ctest -C ${{ matrix.build_type }} --output-on-failure
cpp-arm64:
name: 'C++ tests (gcc/Linux/ARM64, clang/MacOS/ARM64)'
runs-on: [self-hosted, ARM64, "${{ matrix.os }}"]
strategy:
fail-fast: false
matrix:
os:
- Linux
- macOS
steps:
- if: matrix.os == 'Linux'
name: Install gcc and python (Linux)
run: |
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install gcc python3 python3-pip python3-venv
shell: bash
- if: matrix.os == 'macOS'
# We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture
# m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator
# So, for the time being, we are installing flex/bison and java manually for this platform
name: Install bison, flex, gcc, java and python (MacOS)
run: |
brew install bison flex gcc java python
echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH
echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH
echo "$(brew --prefix java)/bin" >> $GITHUB_PATH
shell: bash
- name: Get latest CMake
uses: lukka/get-cmake@latest
- name: Checkout
uses: actions/checkout@v3
- name: Configure and build
env:
CXX: ${{ matrix.compiler }}
run: |
python3 -m venv venv
source venv/bin/activate
python3 -m pip install --upgrade pip conan
conan build . -pr=conan/profiles/tests-release-compat -b missing
- name: Test
working-directory: build/Release
run: ctest -C Release --output-on-failure
python:
name: Python
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Python dependencies
run: python -m pip install --upgrade pip numpy pytest setuptools wheel
- name: Install SWIG, and set build type (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install -y swig
echo "LIBQASM_BUILD_TYPE=Debug" >> $GITHUB_ENV
- name: Install flex/bison and SWIG, and set build type (MacOS)
if: matrix.os == 'macos-latest'
run: |
brew install swig
echo "LIBQASM_BUILD_TYPE=Debug" >> $GITHUB_ENV
- name: Set build type (Windows)
if: matrix.os == 'windows-latest'
shell: powershell
run: |
echo "LIBQASM_BUILD_TYPE=Release" >> $env:GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: python -m pip install --verbose .
- name: Test
run: python -m pytest
conda:
name: Conda
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
channels: conda-forge
miniconda-version: "latest"
show-channel-urls: true
- name: Install conda dependencies
run: conda install conda-build conda-verify -y
- name: Build & test
run: conda build python/conda
- name: Install
run: conda install libqasm --use-local
docker:
name: Docker
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build without pushing
uses: docker/build-push-action@v4
with:
push: false
tags: libqasm:latest