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' }} diff --git a/orix/tests/conftest.py b/orix/tests/conftest.py index a58b02fd..939d1f85 100644 --- a/orix/tests/conftest.py +++ b/orix/tests/conftest.py @@ -36,6 +36,11 @@ def rotations(): return Rotation([(2, 4, 6, 8), (-1, -3, -5, -7)]) +@pytest.fixture() +def eu(): + return np.random.rand(10, 3) + + ANGFILE_TSL_HEADER = ( "# TEM_PIXperUM 1.000000\n" "# x-star 0.413900\n" diff --git a/setup.py b/setup.py index 74bf73d6..f6dba090 100644 --- a/setup.py +++ b/setup.py @@ -30,6 +30,7 @@ "numpydoc", "pytest >= 5.4", "pytest-cov >= 2.8.1", + "pytest-xdist", ], } extra_feature_requirements["dev"] = [