Run unit tests in CI #171
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- synchronize | |
- opened | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
source: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
architecture: x64 | |
- run: pip3 install poetry | |
- run : | | |
cd libs/gl-client-py | |
poetry build --format=sdist | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: libs/gl-client-py/dist/gl_client-*.tar.gz | |
linux: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- x86_64 | |
- i686 | |
- aarch64 | |
- armv7 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
version: "23.2" # Fixed since we mount the path below | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
working-directory: libs/gl-client-py | |
rust-toolchain: nightly | |
target: ${{ matrix.target }} | |
manylinux: auto | |
args: --release --out dist | |
docker-options: -v /opt/hostedtoolcache/protoc/v23.2/x64/bin/protoc:/usr/bin/protoc:ro | |
- name: Install built wheel (emulated) | |
uses: uraimo/[email protected] | |
if: matrix.target != 'ppc64' && matrix.target != 'x86_64' && matrix.target != 'i686' | |
with: | |
arch: ${{ matrix.target }} | |
distro: ubuntu22.04 | |
githubToken: ${{ github.token }} | |
install: | | |
apt-get update | |
apt-get install -y --no-install-recommends python3 python3-pip | |
pip3 install -U pip pytest | |
run: | | |
pip install libs/gl-client-py/dist/gl_client*.whl --force-reinstall | |
python3 -c "import glclient;tls=glclient.TlsConfig();signer=glclient.Signer(b'\x00'*32,'bitcoin', tls);print(repr(tls));print(signer.version())" | |
- name: Install built wheel (native) | |
if: matrix.target == 'x86_64' | |
run: | | |
pip install libs/gl-client-py/dist/gl_client*.whl --force-reinstall | |
python3 -c "import glclient;tls=glclient.TlsConfig();signer=glclient.Signer(b'\x00'*32,'bitcoin', tls);print(repr(tls));print(signer.version())" | |
- name: Install testing dependencies | |
if: matrix.target == 'x86_64' | |
run: pip3 install pytest | |
- name: Run tests | |
if: matrix.target == 'x86_64' | |
run: python3 -m pytest libs/gl-client-py/tests | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: libs/gl-client-py/dist/ | |
macos: | |
runs-on: macos-11 | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- x86_64 | |
- aarch64 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
architecture: x64 | |
- uses: dtolnay/rust-toolchain@nightly | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
version: "23.2" | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build wheels - ${{ matrix.target }} | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
working-directory: libs/gl-client-py | |
args: --release --out dist | |
docker-options: -v /opt/hostedtoolcache/protoc/v23.2/x64/bin/protoc:/usr/bin/protoc:ro | |
env: | |
MACOSX_DEPLOYMENT_TARGET: 10.9 | |
- name: Install built wheel | |
if: matrix.target == 'x86_64' | |
run: | | |
pip install libs/gl-client-py/dist/gl_client*.whl --force-reinstall | |
python3 -c "import glclient;tls=glclient.TlsConfig();signer=glclient.Signer(b'\x00'*32,'bitcoin', tls);print(repr(tls));print(signer.version())" | |
- name: Install testing dependencies | |
run: | | |
pip3 install pytest | |
- name: Run tests | |
if: matrix.target == 'x86_64' | |
run: python3 -m pytest libs/gl-client-py/tests | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: libs/gl-client-py/dist/ | |
windows: | |
runs-on: windows-2019 | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- x64 | |
- x86 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
architecture: ${{ matrix.target }} | |
- uses: dtolnay/rust-toolchain@nightly | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
working-directory: libs\\gl-client-py | |
args: --release --out dist | |
# Wildcard expansion on windows is different... | |
# - name: Install built wheel | |
# run: | | |
# pip install libs\gl-client-py\dist\gl_client*.whl --force-reinstall | |
# python3 -c "import glclient;tls=glclient.TlsConfig();signer=glclient.Signer(b'\x00'*32,'bitcoin', tls);print(repr(tls));print(signer.version())" | |
# - name: Install testing dependencies | |
# run: | | |
# pip3 install pytest | |
# - name: Run tests | |
# run: python3 -m pytest libs/gl-client-py/tests | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: libs\gl-client-py\dist |