Repository: nipreps/nireports (language: python)

Issue:
Set up CI workflow with GitHub actions
Create basic build and test workflow. 
Create testing infrastructure
Include dependencies and any relevant configurations / boilterplate.


Discussion / hints:
GitHub actions is good for the full matrix (Python 3.8 - 3.11-dev; min/max versions, pre-releases).

We should consider using CircleCI as well for the sake of easy viewing of artifacts. I would suggest a minimum Python/dependencies run and a stable Python/dependencies run.


Fix patch:
diff --git a/min-requirements.txt b/min-requirements.txt
new file mode 100644
index 00000000..b5324145
--- /dev/null
+++ b/min-requirements.txt
@@ -0,0 +1,1 @@
+nibabel==3.0.1
diff --git a/setup.cfg b/setup.cfg
index 436234cc..7522f934 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -20,15 +20,7 @@ classifiers =
 [options]
 python_requires = >= 3.7
 install_requires =
-    attrs
     nibabel >= 3.0.1
-    templateflow 
-
-test_requires =
-    coverage
-    pytest
-    pytest-cov
-    pytest-xdist
 packages = find:
 
 [options.package_data]
@@ -41,29 +33,20 @@ exclude =
 
 [options.extras_require]
 doc =
-    pydot >= 1.2.3
-    pydotplus
-    sphinx >= 2.1.2
-    sphinx_rtd_theme
-    sphinxcontrib-apidoc ~= 0.3.0
-    sphinxcontrib-napoleon
-    sphinxcontrib-versioning
+    sphinx
 docs =
     %(doc)s
-duecredit =
-    duecredit
 style =
-    flake8 >= 3.7.0
+    flake8
 test =
-    coverage < 5
-    pytest >= 4.4
+    coverage
+    pytest
     pytest-cov
-    pytest-xdist >= 1.28
+    pytest-xdist
 tests =
     %(test)s
-all =
+dev =
     %(doc)s
-    %(duecredit)s
     %(style)s
     %(test)s
 


Test patch:
diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml
new file mode 100644
index 00000000..0f640f4d
--- /dev/null
+++ b/.github/workflows/build_test_deploy.yml
@@ -0,0 +1,95 @@
+name: Build-Test-Deploy
+
+on:
+  push:
+    branches:
+      - main
+      - maint/*
+    tags:
+      - '*'
+  pull_request:
+    branches:
+      - main
+      - maint/*
+  schedule:
+    # 8am EST / 9am EDT Mondays
+    - cron: '0 13 * * 1'
+
+defaults:
+  run:
+    shell: bash
+
+jobs:
+  build:
+    runs-on: 'ubuntu-latest'
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          submodules: recursive
+          fetch-depth: 0
+      - uses: actions/setup-python@v4
+        with:
+          python-version: '3.x'
+      - name: Install build dependencies
+        run: pip install --upgrade pip build twine
+      - name: Build sdist and wheel
+        run: python -m build
+      - name: Check distributions
+        run: twine check dist/*
+      - uses: actions/upload-artifact@v3
+        with:
+          name: dist
+          path: dist/
+
+  test:
+    needs: [build]
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
+        python-version: [3.8, 3.9, '3.10']
+        architecture: ['x64', 'x86']
+        package: ['.', 'dist/*.whl', 'dist/*.tar.gz']
+        requirements: ['', 'min-requirements.txt']
+        exclude:
+          # 32-bit is a Windows-only consideration
+          - os: ubuntu-latest
+            architecture: x86
+          - os: macos-latest
+            architecture: x86
+          # Only install minimum requirements for one installation type
+          # Doesn't matter which
+          - package: 'dist/*.whl'
+            requirements: 'min-requirements.txt'
+          - package: 'dist/*.tar.gz'
+            requirements: 'min-requirements.txt'
+    env:
+      REQUIREMENTS: ${{ matrix.requirements }}
+      PACKAGE: ${{ matrix.package }}
+
+    steps:
+      - uses: actions/checkout@v3
+      - name: Fetch packages
+        uses: actions/download-artifact@v3
+        with:
+          name: dist
+          path: dist/
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v4
+        with:
+          python-version: ${{ matrix.python-version }}
+          architecture: ${{ matrix.architecture }}
+      - name: Display Python version
+        run: python -c "import sys; print(sys.version)"
+      - name: Install dependencies
+        run: if [[ -n "$REQUIREMENTS" ]]; then pip install -r $REQUIREMENTS; fi
+      - name: Install package
+        run: pip install $PACKAGE
+      - name: Verify installation
+        run: python -c "import nireports; print(nireports.__version__)"
+      - name: Install test dependencies
+        run: pip install nireports[test]
+      - name: Run tests
+        run: pytest -sv --doctest-modules --cov nireports -n auto nireports
+      - uses: codecov/codecov-action@v3
+        if: ${{ always() }}