diff --git a/.github/workflows/full_test.yml b/.github/workflows/full_test.yml deleted file mode 100644 index 2f8951545..000000000 --- a/.github/workflows/full_test.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Full test - - -# Run this workflow only on release -on: - - release - - workflow_dispatch - -jobs: - - test: - strategy: - max-parallel: 4 - matrix: - python-version: ["3.8", "3.9"] - mongodb-version: ['4.0'] - - runs-on: ubuntu-latest - - env: - PMG_MAPI_KEY: ${{ secrets.PMG_MAPI_KEY }} - MPDS_KEY: ${{ secrets.MPDS_KEY }} - CITRINATION_API_KEY: ${{ secrets.CITRINATION_API_KEY }} - RUNNING_ON_GHACTIONS: "True" - MATMINER_DATASET_FULL_TEST: True - MPLBACKEND: "Agg" - - steps: - - uses: actions/checkout@v2 - - - name: Start MongoDB - uses: supercharge/mongodb-github-action@1.6.0 - with: - mongodb-version: ${{ matrix.mongodb-version }} - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - cache: "pip" - - - name: Install Python dependencies - run: | - python${{ matrix.python-version }} -m pip install --upgrade pip pip-tools - python${{ matrix.python-version }} -m piptools sync --user requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt - # Using non-editable install for testing building of MANIFEST files - python${{ matrix.python-version }} -m pip install --no-deps . - - - name: Run full tests including dataset downloads - run: | - # Sleeping to allow mongo a bit more time to boot, avoiding connect errors - sleep 10 - mongo localhost/admin --eval 'db.createUser({user: "admin",pwd: "password",roles: [ { role: "root", db: "admin" } ]})' - python${{ matrix.python-version }} -m pytest --cov=matminer matminer diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index dcbae860d..000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Linting - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.9"] - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: '**/setup.py' - - name: Install dependencies - run: | - python${{ matrix.python-version }} -m pip install --upgrade pip pip-tools - python${{ matrix.python-version }} -m piptools sync --user requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt - -# - name: mypy -# run: | -# mypy --version -# rm -rf .mypy_cache -# mypy matminer -# - name: pydocstyle -# run: | -# pydocstyle --count matminer -# - name: pylint -# run: | -# pylint matminer - - name: black - run: | - black --version - black --check --diff --color matminer - - name: flake8 - run: | - flake8 --version - flake8 --count --show-source --statistics matminer - # exit-zero treats all errors as warnings. - flake8 --count --exit-zero --max-complexity=20 --statistics matminer diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..6abb007fa --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,77 @@ +name: release + +on: + release: + types: [published] + +jobs: + deploy: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9"] + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + cache-dependency-path: '**/setup.py' + + - name: Build package + run: | + python${{ matrix.python-version }} -m pip install --upgrade pip pip-tools build setuptools setuptools_scm wheel + python${{ matrix.python-version }} -m build + + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1.5 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + + docs: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9"] + needs: + - deploy + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + cache-dependency-path: '**/setup.py' + + - name: Install dependencies + run: | + python${{ matrix.python-version }} -m pip install --upgrade pip pip-tools setuptools_scm + python${{ matrix.python-version }} -m piptools sync --user requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt + # Using non-editable install for testing building of MANIFEST files + python${{ matrix.python-version }} -m pip install --no-deps . + + - name: Build + run: | + cd docs_rst + python${{ matrix.python-version }} featurizer_summary.py > featurizer_summary.rst + python${{ matrix.python-version }} dataset_summary.py > dataset_summary.rst + sphinx-apidoc -o . -f ../matminer + make html + cp _static/* ../docs/html/_static + cd ../docs + cp -r html/* . + rm -r html + rm -r doctrees + touch .nojekyll + git add . + git commit -a -m "update docs" + git push diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c7f924d02..be7167589 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,13 +3,27 @@ # The ext package is also only tested in this workflow. Coverage is also computed based on this platform. name: Testing -on: [ push, pull_request ] +on: + push: + branches: + - main + + pull_request: + branches: + - main + + workflow_dispatch: + inputs: + fullTest: + description: "run full test" + required: true + default: false + type: boolean jobs: test: strategy: - max-parallel: 4 matrix: python-version: ["3.8", "3.9"] mongodb-version: ['4.0'] @@ -20,9 +34,9 @@ jobs: PMG_MAPI_KEY: ${{ secrets.PMG_MAPI_KEY }} MPDS_KEY: ${{ secrets.MPDS_KEY }} CITRINATION_API_KEY: ${{ secrets.CITRINATION_API_KEY }} - MATMINER_DATASET_FULL_TEST: False RUNNING_ON_GHACTIONS: "True" MPLBACKEND: "Agg" + MATMINER_DATASET_FULL_TEST: ${{ inputs.fullTest }} steps: - uses: actions/checkout@v3 @@ -33,23 +47,59 @@ jobs: cache: "pip" cache-dependency-path: '**/setup.py' - - name: Start MongoDB - uses: supercharge/mongodb-github-action@1.6.0 - with: - mongodb-version: ${{ matrix.mongodb-version }} - - name: Install Python dependencies run: | - python${{ matrix.python-version }} -m pip install --upgrade pip pip-tools + python${{ matrix.python-version }} -m pip install --upgrade pip pip-tools build setuptools setuptools_scm wheel python${{ matrix.python-version }} -m piptools sync --user requirements/ubuntu-latest_py${{ matrix.python-version }}_extras.txt # Using non-editable install for testing building of MANIFEST files python${{ matrix.python-version }} -m pip install --no-deps . + - name: linting + run: | + black --version + black --check --diff --color matminer + flake8 --version + flake8 --count --show-source --statistics matminer + # exit-zero treats all errors as warnings. + flake8 --count --exit-zero --max-complexity=20 --statistics matminer + # mypy --version + # rm -rf .mypy_cache + # mypy matminer + # pydocstyle --count matminer + # pylint matminer + + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.6.0 + with: + mongodb-version: ${{ matrix.mongodb-version }} + - name: Run tests run: | # Sleeping to allow mongo a bit more time to boot, avoiding connect errors sleep 10 - echo "start mongo ..." mongo localhost/admin --eval 'db.createUser({user: "admin",pwd: "password",roles: [ { role: "root", db: "admin" } ]})' - echo "run tests ..." python${{ matrix.python-version }} -m pytest --cov=matminer matminer + + - name: Build package + if: matrix.python-version == "3.9" + run: python${{ matrix.python-version }} -m build + + - name: Publish distribution 📦s to Test PyPI + if: matrix.python-version == "3.9" + uses: pypa/gh-action-pypi-publish@release/v1.5 + with: + skip_existing: true + repository_url: https://test.pypi.org/legacy/ + user: __token__ + password: ${{ secrets.TEST_PYPI_TOKEN }} + + auto-gen-release: + needs: + - test + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + steps: + - uses: rymndhng/release-on-push-action@v0.25.0 + with: + bump_version_scheme: norelease