Skip to content

Commit

Permalink
Run lint and tests on GitHub Actions (#1671)
Browse files Browse the repository at this point in the history
  • Loading branch information
pquentin authored Feb 16, 2023
1 parent efe2425 commit 6915655
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 66 deletions.
6 changes: 0 additions & 6 deletions .ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ function install {
make install
}

function precommit {
install
make precommit
make unit
}

function it38 {
install
make it38
Expand Down
6 changes: 0 additions & 6 deletions .ci/jobs/periodic-precommit.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .ci/jobs/pull-request-precommit.yml

This file was deleted.

6 changes: 0 additions & 6 deletions .ci/jobs/push-precommit.yml

This file was deleted.

1 change: 0 additions & 1 deletion .ci/templates/periodic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@
- multijob:
name: all CI tests
projects:
- name: elastic+rally+periodic+{branch}-precommit
- name: elastic+rally+periodic+{branch}-it-python38
- name: elastic+rally+periodic+{branch}-it-python310
15 changes: 0 additions & 15 deletions .ci/templates/precommit.yml

This file was deleted.

1 change: 0 additions & 1 deletion .ci/templates/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@
- multijob:
name: all CI tests
projects:
- name: elastic+rally+push+{branch}-precommit
- name: elastic+rally+push+{branch}-it-python38
- name: elastic+rally+push+{branch}-it-python310
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on: [push, pull_request]

permissions: "read-all"

jobs:
lint:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
cache-dependency-path: pyproject.toml
- name: "Install dependencies"
run: python -m pip install .[develop]
- uses: pre-commit/[email protected]

test:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
os:
- macos-latest
- ubuntu-latest

runs-on: ${{ matrix.os }}
name: unit ${{ fromJson('{"macos-latest":"macOS","ubuntu-latest":"Ubuntu"}')[matrix.os] }} ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: pyproject.toml
- name: "Install dependencies"
run: python -m pip install --upgrade nox
- name: "Run tests"
run: nox -s test-${{matrix.python-version}}
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ serve-docs: check-venv
test: check-venv
. $(VENV_ACTIVATE_FILE); pytest tests/

precommit: lint

unit: check-venv python-caches-clean tox-env-clean
. $(VENV_ACTIVATE_FILE); tox -e py38-unit
. $(VENV_ACTIVATE_FILE); tox -e py310-unit
Expand Down
7 changes: 7 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import nox


@nox.session(python=["3.8", "3.9", "3.10"])
def test(session: nox.Session) -> None:
session.install(".[develop]")
session.run("pytest")
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ develop = [
"pytest-asyncio==0.19.0",
"pytest-httpserver==1.0.5",
"tox==3.25.0",
"nox==2022.11.21",
"sphinx==5.1.1",
"furo==2022.06.21",
"twine==4.0.1",
Expand Down
2 changes: 0 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
[tox]
isolated_build = True
envlist =
py{38,39,310}-unit
py{38,39,310}-it
rally-tracks-compat
platform =
Expand Down Expand Up @@ -43,7 +42,6 @@ setenv =
# applications behave identically, we also set LANG explicitly.
LANG=C
commands =
unit: pytest --junitxml=junit-{envname}.xml
it: pytest -s it --junitxml=junit-{envname}.xml

whitelist_externals =
Expand Down

0 comments on commit 6915655

Please sign in to comment.