Skip to content

Commit a779cc3

Browse files
committed
ci: Port python library tests to GHA
1 parent 73f8bc2 commit a779cc3

File tree

2 files changed

+51
-19
lines changed

2 files changed

+51
-19
lines changed

.github/workflows/ci.yml

+51-6
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
runs-on: ${{ matrix.os }}
5757

5858
# Skip redundant checks for library releases
59-
if: "!startsWith(github.ref , 'refs/heads/release-library/')"
59+
if: "!startsWith(github.ref, 'refs/heads/release-library/')"
6060

6161
steps:
6262
- uses: actions/checkout@v2
@@ -89,7 +89,7 @@ jobs:
8989
runs-on: ubuntu-latest
9090

9191
# Skip redundant checks for library releases
92-
if: "!startsWith(github.ref , 'refs/heads/release-library/')"
92+
if: "!startsWith(github.ref, 'refs/heads/release-library/')"
9393

9494
# Testing all features requires Docker container operations that are only available on
9595
# `ubuntu-latest`. This `test-all` job is to be seen as complementary to the `test` job. If
@@ -128,12 +128,57 @@ jobs:
128128
command: test
129129
args: --workspace --all-features
130130

131+
test-py:
132+
strategy:
133+
fail-fast: false
134+
matrix:
135+
python-version: [2.7, 3.7]
136+
137+
# Skip redundant checks for binary releases
138+
if: "!startsWith(github.ref, 'refs/heads/release/')"
139+
140+
name: Test Python ${{ matrix.python-version }}
141+
142+
steps:
143+
- uses: actions/checkout@v2
144+
with:
145+
submodules: recursive
146+
147+
- uses: actions-rs/toolchain@v1
148+
id: toolchain
149+
with:
150+
toolchain: stable
151+
profile: minimal
152+
override: true
153+
154+
- uses: actions/setup-python@v2
155+
with:
156+
python-version: ${{ matrix.python-version }}
157+
158+
- name: Install Dependencies
159+
run: pip install -U pytest
160+
161+
- uses: actions/cache@v2
162+
with:
163+
path: |
164+
~/.cargo/registry
165+
~/.cargo/git
166+
target
167+
key: pytest-${{ runner.os }}-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}
168+
169+
- name: Build and Install Library
170+
run: pip install -v --editable py
171+
env: RELAY_DEBUG=1
172+
173+
- name: Run Python Tests
174+
run: pytest -v py
175+
131176
test-integration:
132177
name: Integration Tests
133178
runs-on: ubuntu-latest
134179

135180
# Skip redundant checks for library releases
136-
if: "!startsWith(github.ref , 'refs/heads/release-library/')"
181+
if: "!startsWith(github.ref, 'refs/heads/release-library/')"
137182

138183
services:
139184
redis: # https://docs.github.com/en/actions/guides/creating-redis-service-containers
@@ -193,7 +238,7 @@ jobs:
193238

194239
cargo_docs:
195240
name: Cargo Docs
196-
if: "!startsWith(github.ref , 'refs/heads/release')"
241+
if: "!startsWith(github.ref, 'refs/heads/release')"
197242
runs-on: ubuntu-latest
198243
steps:
199244
- uses: actions/checkout@v2
@@ -227,7 +272,7 @@ jobs:
227272

228273
event_schema:
229274
name: Event Schema
230-
if: "!startsWith(github.ref , 'refs/heads/release')"
275+
if: "!startsWith(github.ref, 'refs/heads/release')"
231276
runs-on: ubuntu-latest
232277
steps:
233278
- uses: actions/checkout@v2
@@ -288,7 +333,7 @@ jobs:
288333
289334
metrics_docs:
290335
name: Metrics Docs
291-
if: "!startsWith(github.ref , 'refs/heads/release')"
336+
if: "!startsWith(github.ref, 'refs/heads/release')"
292337
runs-on: ubuntu-latest
293338
steps:
294339
- uses: actions/checkout@v2

.travis.yml

-13
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,6 @@ before_cache:
2424
jobs:
2525
fast_finish: true
2626
include:
27-
# -------------------------------------
28-
# PYTHON LIBRARY TESTS
29-
# -------------------------------------
30-
31-
- name: "test: librelay"
32-
if: NOT branch ~= /^release\/[\d.]+$/
33-
script: make -e test-python
34-
35-
- name: "test: librelay[py2]"
36-
python: "2.7"
37-
if: NOT branch ~= /^release\/[\d.]+$/
38-
script: make -e RELAY_PYTHON_VERSION=python2 test-python
39-
4027
# -------------------------------------
4128
# RUST RELEASE BUILDS
4229
# -------------------------------------

0 commit comments

Comments
 (0)