diff --git a/.ci/build.sh b/.ci/build.sh index 266471b04..2b5c84b0a 100644 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -111,12 +111,6 @@ function install { make install } -function precommit { - install - make precommit - make unit -} - function it38 { install make it38 diff --git a/.ci/jobs/periodic-precommit.yml b/.ci/jobs/periodic-precommit.yml deleted file mode 100644 index 38666157d..000000000 --- a/.ci/jobs/periodic-precommit.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -jjbb-template: precommit.yml -vars: - - jobname: periodic - - branch: master diff --git a/.ci/jobs/pull-request-precommit.yml b/.ci/jobs/pull-request-precommit.yml deleted file mode 100644 index d1b196ff2..000000000 --- a/.ci/jobs/pull-request-precommit.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- - -- job: - name: "elastic+rally+pull-request+precommit" - display-name: "elastic / rally # pull-request+precommit" - description: "Precommit (checkstyle + unit) tests for rally pull requests" - scm: - - git: - refspec: "+refs/pull/*:refs/remotes/origin/pr/* +refs/heads/*:refs/remotes/origin/*" - branches: - - "${ghprbActualCommit}" - triggers: - - github-pull-request: - org-list: - - elastic - allow-whitelist-orgs-as-admins: true - trigger-phrase: '.*run\W+rally/precommit.*' - github-hooks: true - status-context: "rally/precommit" - cancel-builds-on-update: true - black-list-labels: - - '>test-mute' - builders: - - shell: | - #!/usr/local/bin/runbld - set -o errexit - bash .ci/build.sh precommit diff --git a/.ci/jobs/push-precommit.yml b/.ci/jobs/push-precommit.yml deleted file mode 100644 index 85be3e58b..000000000 --- a/.ci/jobs/push-precommit.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- - -jjbb-template: precommit.yml -vars: - - jobname: push - - branch: master diff --git a/.ci/templates/periodic.yml b/.ci/templates/periodic.yml index d9cd62da0..1f8e21a1d 100644 --- a/.ci/templates/periodic.yml +++ b/.ci/templates/periodic.yml @@ -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 diff --git a/.ci/templates/precommit.yml b/.ci/templates/precommit.yml deleted file mode 100644 index e60737714..000000000 --- a/.ci/templates/precommit.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- - -- job: - name: "elastic+rally+{jobname}+{branch}-precommit" - display-name: "elastic / rally # {branch} - {jobname}+precommit" - description: "Precommit (checkstyle + unit) tests for elastic/rally" - concurrent: true - scm: - - git: - refspec: +refs/pull/*:refs/remotes/origin/pr/* - builders: - - shell: | - #!/usr/local/bin/runbld - set -o errexit - bash .ci/build.sh precommit diff --git a/.ci/templates/push.yml b/.ci/templates/push.yml index f08085d07..b680461cc 100644 --- a/.ci/templates/push.yml +++ b/.ci/templates/push.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..4dff79fd5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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/action@v3.0.0 + + 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}} diff --git a/Makefile b/Makefile index dc32ab7a6..b1c7c40ce 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 000000000..f8877dc49 --- /dev/null +++ b/noxfile.py @@ -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") diff --git a/pyproject.toml b/pyproject.toml index 4482ced1b..953dcfe6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/tox.ini b/tox.ini index 8d143e6e8..1b41820e4 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,6 @@ [tox] isolated_build = True envlist = - py{38,39,310}-unit py{38,39,310}-it rally-tracks-compat platform = @@ -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 =