|
| 1 | +on: [push] |
| 2 | + |
| 3 | +name: Code Quality |
| 4 | + |
| 5 | +jobs: |
| 6 | + pre-commit: |
| 7 | + name: Run pre-commit Lints |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v2 |
| 11 | + |
| 12 | + - name: Install rust nightly toolchain |
| 13 | + uses: actions-rs/toolchain@v1 |
| 14 | + with: |
| 15 | + profile: minimal |
| 16 | + toolchain: nightly |
| 17 | + override: true |
| 18 | + components: rustfmt, clippy |
| 19 | + |
| 20 | + - name: Setup python |
| 21 | + uses: actions/setup-python@v2 |
| 22 | + with: |
| 23 | + python-version: "3.8.x" |
| 24 | + |
| 25 | + - name: Install poetry |
| 26 | + run: | |
| 27 | + curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python |
| 28 | +
|
| 29 | + - name: Install virtualenv |
| 30 | + run: | |
| 31 | + sudo apt-get install python3-venv |
| 32 | +
|
| 33 | + - name: Install dependencies |
| 34 | + run: | |
| 35 | + env PATH="${PATH}:${HOME}/.poetry/bin" poetry install |
| 36 | +
|
| 37 | + - name: Run pre-commit checks |
| 38 | + run: | |
| 39 | + env RUSTFLAGS="-D unused_crate_dependencies" PATH="${PATH}:${HOME}/.poetry/bin" poetry run pre-commit run --hook-stage push --all-files |
| 40 | +
|
| 41 | + tests-python: |
| 42 | + name: Python ${{ matrix.python-version }} ${{ matrix.os }} tests |
| 43 | + strategy: |
| 44 | + matrix: |
| 45 | + os: [ubuntu-latest] |
| 46 | + python-version: ['3.6', '3.7', '3.8'] |
| 47 | + runs-on: ${{ matrix.os}} |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v2 |
| 50 | + - name: Install rust nightly toolchain |
| 51 | + uses: actions-rs/toolchain@v1 |
| 52 | + with: |
| 53 | + profile: minimal |
| 54 | + toolchain: nightly |
| 55 | + override: true |
| 56 | + - name: Setup python |
| 57 | + uses: actions/setup-python@v2 |
| 58 | + with: |
| 59 | + python-version: ${{ matrix.python-version }} |
| 60 | + - name: Install poetry |
| 61 | + run: | |
| 62 | + curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python |
| 63 | +
|
| 64 | + - name: Install dependencies |
| 65 | + run: | |
| 66 | + env PATH="${PATH}:${HOME}/.poetry/bin" poetry install |
| 67 | +
|
| 68 | + - name: Build the project |
| 69 | + run: | |
| 70 | + env PATH="${PATH}:${HOME}/.poetry/bin" poetry run maturin develop |
| 71 | +
|
| 72 | + - name: Run tests |
| 73 | + run: | |
| 74 | + env PATH="${PATH}:${HOME}/.poetry/bin" poetry run pytest tests/ |
0 commit comments