From 616a6841e6787fcd2f9eccf99a8d205baa78cadd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Wiik=20=C3=85nes?= Date: Mon, 30 Jan 2023 21:55:13 +0100 Subject: [PATCH] Run tests in parallel on GitHub Actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Håkon Wiik Ånes --- .github/workflows/build.yml | 64 ++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ff2ea9c5..ebc802d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,48 +1,64 @@ name: build -on: [push, pull_request] +on: + push: + branches: + - '*' + pull_request: + branches: + - '*' + workflow_dispatch: + workflow: '*' + +env: + MPLBACKEND: agg jobs: code: name: code style runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - uses: psf/black@stable - - uses: actions/setup-python@v2 + + - uses: actions/setup-python@v4 with: python-version: 3.9 + - uses: isort/isort-action@master with: configuration: --profile black --filter-files --force-sort-within-sections --check-only --diff - name: Install Black with Jupyter extension - run: pip install black[jupyter] + run: | + pip install black[jupyter] - name: Check code style of Jupyter notebooks - run: black doc/**/*.ipynb --check + run: | + black doc/**/*.ipynb --check # Make sure all necessary files will be included in a release manifest: name: check manifest runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 - name: Install dependencies - run: pip install manifix + run: | + pip install manifix - name: Check MANIFEST.in file - run: python setup.py manifix + run: | + python setup.py manifix build-with-pip: name: ${{ matrix.os }}-py${{ matrix.python-version }}${{ matrix.LABEL }} runs-on: ${{ matrix.os }} timeout-minutes: 15 - env: - MPLBACKEND: agg strategy: fail-fast: false matrix: @@ -55,26 +71,28 @@ jobs: DEPENDENCIES: diffpy.structure==3 matplotlib==3.3 LABEL: -oldest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Display Python and pip versions - run: python -V; pip -V - - name: Install depedencies and package shell: bash - run: pip install -U -e .'[doc, tests]' + run: | + pip install -U -e .'[doc, tests]' - name: Install oldest supported version if: ${{ matrix.OLDEST_SUPPORTED_VERSION }} - run: pip install ${{ matrix.DEPENDENCIES }} + run: | + pip install ${{ matrix.DEPENDENCIES }} - - name: Display package versions - run: pip list + - name: Display Python, pip and package versions + run: | + python -V + pip -V + pip list - name: Run docstring tests if: ${{ matrix.os == 'ubuntu-latest' }} @@ -83,11 +101,13 @@ jobs: pytest --doctest-modules --ignore-glob=orix/tests orix/*.py - name: Run tests - run: pytest --cov=orix --pyargs orix + run: | + pytest -n 2 --cov=orix --pyargs orix - name: Generate line coverage if: ${{ matrix.os == 'ubuntu-latest' }} - run: coverage report --show-missing + run: | + coverage report --show-missing - name: Upload coverage to Coveralls if: ${{ matrix.os == 'ubuntu-latest' }}