diff --git a/.github/actions/cache/action.yml b/.github/actions/cache/action.yml index 53104039..81ac3428 100644 --- a/.github/actions/cache/action.yml +++ b/.github/actions/cache/action.yml @@ -39,14 +39,14 @@ runs: python -c "from pip._internal.locations import USER_CACHE_DIR; print('PIP_CACHE_DIR=' + USER_CACHE_DIR)" >> $GITHUB_ENV shell: bash - - name: Cache pip + - name: Cache 💽 pip uses: actions/cache@v3 with: path: $PIP_CACHE_DIR key: ${{ runner.os }}-py${{ inputs.python-version }}-pip-${{ inputs.offset }}-${{ hashFiles('requirements.txt') }} restore-keys: ${{ runner.os }}-py${{ inputs.python-version }}-pip-${{ inputs.offset }}- - - name: Cache conda + - name: Cache 💽 conda uses: actions/cache@v3 if: runner.os == 'Linux' with: diff --git a/.github/actions/unittesting/action.yml b/.github/actions/unittesting/action.yml index 4546e01b..eec327a1 100644 --- a/.github/actions/unittesting/action.yml +++ b/.github/actions/unittesting/action.yml @@ -32,7 +32,8 @@ runs: using: "composite" steps: - - run: | + - name: Python 🐍 details + run: | python --version pip --version pip list diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 3a90d805..87e9d217 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -13,10 +13,10 @@ jobs: mypy: runs-on: ubuntu-20.04 steps: - - name: Checkout + - name: Checkout 🛎️ uses: actions/checkout@v3 - - name: Set up Python ${{ inputs.python-version }} + - name: Set up Python 🐍 ${{ inputs.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ inputs.python-version }} @@ -46,28 +46,28 @@ jobs: pre-commit: runs-on: ubuntu-20.04 steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 + - name: Checkout 🛎️ + uses: actions/checkout@v3 + with: + fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ inputs.python-version }} + - name: Set up Python 🐍 + uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python-version }} - - name: Determine cache hash - run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV + - name: Determine cache hash + run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - - name: Cache pre-commit - uses: actions/cache@v3 - with: - path: ~/.cache/pre-commit - key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} + - name: Cache 💽 pre-commit + uses: actions/cache@v3 + with: + path: ~/.cache/pre-commit + key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} - - name: Run pre-commit - uses: pre-commit/action@v3.0.0 - # this action also provides an additional behaviour when used in private repositories - # when configured with a github token, the action will push back fixes to the pull request branch - # with: - # token: ${{ secrets.GITHUB_TOKEN }} + - name: Run pre-commit + uses: pre-commit/action@v3.0.0 + # this action also provides an additional behaviour when used in private repositories + # when configured with a github token, the action will push back fixes to the pull request branch + # with: + # token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/check-docs.yml b/.github/workflows/check-docs.yml index 84a6c055..bf28e9c0 100644 --- a/.github/workflows/check-docs.yml +++ b/.github/workflows/check-docs.yml @@ -30,62 +30,62 @@ jobs: runs-on: ubuntu-20.04 steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout 🛎 + uses: actions/checkout@v3 - - name: Set up Python ${{ inputs.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ inputs.python-version }} + - name: Set up Python 🐍 ${{ inputs.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python-version }} - - name: Install dependencies - run: | - pip install -e . -U -f https://download.pytorch.org/whl/cpu/torch_stable.html - pip install -r ${{ inputs.requirements-file }} - python --version - pip --version - pip list - shell: bash + - name: Install dependencies + run: | + pip install -e . -U -f https://download.pytorch.org/whl/cpu/torch_stable.html + pip install -r ${{ inputs.requirements-file }} + python --version + pip --version + pip list + shell: bash - # TODO: re-enable after the external usage is resolved, see #51 - # - uses: ./.github/actions/pip-list + # TODO: re-enable after the external usage is resolved, see #51 + # - uses: ./.github/actions/pip-list - - name: Test Documentation - working-directory: ${{ inputs.docs-dir }} - env: - SPHINX_MOCK_REQUIREMENTS: 0 - run: | - make doctest - make coverage + - name: Test Documentation + working-directory: ${{ inputs.docs-dir }} + env: + SPHINX_MOCK_REQUIREMENTS: 0 + run: | + make doctest + make coverage docs-html: runs-on: ubuntu-20.04 steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout 🛎 + uses: actions/checkout@v3 - - name: Set up Python ${{ inputs.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ inputs.python-version }} + - name: Set up Python 🐍 ${{ inputs.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python-version }} - - name: Install dependencies - run: | - pip install -e . -U -r ${{ inputs.requirements-file }} -f https://download.pytorch.org/whl/torch_stable.html - sudo apt-get update --fix-missing - sudo apt-get install -y texlive-latex-extra dvipng texlive-pictures - python --version - pip --version - pip list + - name: Install dependencies + run: | + pip install -e . -U -r ${{ inputs.requirements-file }} -f https://download.pytorch.org/whl/torch_stable.html + sudo apt-get update --fix-missing + sudo apt-get install -y texlive-latex-extra dvipng texlive-pictures + python --version + pip --version + pip list - - name: Build documentation - working-directory: ${{ inputs.docs-dir }} - run: make html --debug SPHINXOPTS="-W --keep-going" + - name: Build documentation + working-directory: ${{ inputs.docs-dir }} + run: make html --debug SPHINXOPTS="-W --keep-going" - - name: Upload built docs - uses: actions/upload-artifact@v3 - with: - name: docs-${{ github.sha }} - path: ${{ inputs.docs-dir }}/build/html/ - if: success() + - name: Upload built docs + uses: actions/upload-artifact@v3 + with: + name: docs-${{ github.sha }} + path: ${{ inputs.docs-dir }}/build/html/ + if: success() diff --git a/.github/workflows/check-package.yml b/.github/workflows/check-package.yml index dbcb5166..419ee760 100644 --- a/.github/workflows/check-package.yml +++ b/.github/workflows/check-package.yml @@ -64,40 +64,40 @@ jobs: matrix: ${{ fromJSON(inputs.build-matrix) }} steps: - - name: Checkout 🛎️ - uses: actions/checkout@v3 - - name: Download 📥 previous packages - uses: actions/download-artifact@v3 - with: - name: ${{ inputs.artifact-name }} - path: pypi - - name: Set up Python 🐍 - uses: actions/setup-python@v4 - with: - python-version: 3.8 - - - name: Check local package - run: python setup.py check --metadata --strict - - - name: Create package - run: | - pip install -q -U setuptools wheel - python setup.py sdist bdist_wheel - python setup.py clean - - - name: Check build package - run: | - pip install -q -U twine>=4.0.1 - # check package description - twine check dist/* - - - name: prepare for upload - run: cp dist/* pypi/ - - name: Upload 📤 to the share store - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.artifact-name }} - path: pypi + - name: Checkout 🛎️ + uses: actions/checkout@v3 + - name: Download 📥 previous packages + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.artifact-name }} + path: pypi + - name: Set up Python 🐍 + uses: actions/setup-python@v4 + with: + python-version: 3.8 + + - name: Check local package + run: python setup.py check --metadata --strict + + - name: Create package + run: | + pip install -q -U setuptools wheel + python setup.py sdist bdist_wheel + python setup.py clean + + - name: Check build package + run: | + pip install -q -U twine>=4.0.1 + # check package description + twine check dist/* + + - name: prepare for upload + run: cp dist/* pypi/ + - name: Upload 📤 to the share store + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.artifact-name }} + path: pypi pkg-check: needs: pkg-build @@ -107,38 +107,38 @@ jobs: matrix: ${{ fromJSON(inputs.testing-matrix) }} steps: - - name: Download 📥 all packages - uses: actions/download-artifact@v3 - with: - name: ${{ inputs.artifact-name }} - path: pypi - - name: show packages - working-directory: pypi - run: ls -lh - - name: Set up Python 🐍 ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install package (wheel) - working-directory: pypi - run: | - # TODO: reset env / conside add as conda - pip install *.whl ${{ inputs.install-flags }} - python -c "import ${{ inputs.import-name }} as pkg; print(f'version: {pkg.__version__}')" - pip list - - - name: Uninstall all - run: | - pip freeze > _reqs.txt - pip uninstall -y -r _reqs.txt - - - name: Install package (archive) - working-directory: pypi - run: | - # TODO: reset env / conside add as conda - pip install *.tar.gz ${{ inputs.install-flags }} - python -c "import ${{ inputs.import-name }} as pkg; print(f'version: {pkg.__version__}')" - pip list - - # TODO: add run doctests + - name: Download 📥 all packages + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.artifact-name }} + path: pypi + - name: show packages + working-directory: pypi + run: ls -lh + - name: Set up Python 🐍 ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install package (wheel) + working-directory: pypi + run: | + # TODO: reset env / conside add as conda + pip install *.whl ${{ inputs.install-flags }} + python -c "import ${{ inputs.import-name }} as pkg; print(f'version: {pkg.__version__}')" + pip list + + - name: Uninstall all + run: | + pip freeze > _reqs.txt + pip uninstall -y -r _reqs.txt + + - name: Install package (archive) + working-directory: pypi + run: | + # TODO: reset env / conside add as conda + pip install *.tar.gz ${{ inputs.install-flags }} + python -c "import ${{ inputs.import-name }} as pkg; print(f'version: {pkg.__version__}')" + pip list + + # TODO: add run doctests diff --git a/.github/workflows/check-schema.yml b/.github/workflows/check-schema.yml index 352d19e0..98c9ca53 100644 --- a/.github/workflows/check-schema.yml +++ b/.github/workflows/check-schema.yml @@ -13,28 +13,28 @@ jobs: schema: runs-on: ubuntu-20.04 steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout 🛎 + uses: actions/checkout@v3 - - name: Install dependencies - run: pip install check-jsonschema + - name: Install dependencies + run: pip install check-jsonschema - - name: Scan repo - run: python -c "import os; is_dir = os.path.isdir('.github/actions'); print(f'GH_ACTIONS={int(is_dir)}')" >> $GITHUB_ENV + - name: Scan repo + run: python -c "import os; is_dir = os.path.isdir('.github/actions'); print(f'GH_ACTIONS={int(is_dir)}')" >> $GITHUB_ENV - # https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json - - name: GitHub Actions - workflow - run: check-jsonschema -v $(find .github/workflows -name '*.yml' -a ! -name '_*.yml') --builtin-schema "github-workflows" + # https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json + - name: GitHub Actions - workflow + run: check-jsonschema -v $(find .github/workflows -name '*.yml' -a ! -name '_*.yml') --builtin-schema "github-workflows" - # https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-action.json - - name: GitHub Actions - action - if: ${{ env.GH_ACTIONS == '1' }} - run: check-jsonschema -v .github/actions/*/*.yml --builtin-schema "github-actions" + # https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-action.json + - name: GitHub Actions - action + if: ${{ env.GH_ACTIONS == '1' }} + run: check-jsonschema -v .github/actions/*/*.yml --builtin-schema "github-actions" - # https://github.com/microsoft/azure-pipelines-vscode/blob/main/service-schema.json - - name: Azure Pipelines - if: ${{ inputs.azure-dir != '' }} - env: - SCHEMA_FILE: https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/v1.205.0/service-schema.json - run: | - check-jsonschema -v ${{ inputs.azure-dir }}/*.yml --schemafile "$SCHEMA_FILE" + # https://github.com/microsoft/azure-pipelines-vscode/blob/main/service-schema.json + - name: Azure Pipelines + if: ${{ inputs.azure-dir != '' }} + env: + SCHEMA_FILE: https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/v1.205.0/service-schema.json + run: | + check-jsonschema -v ${{ inputs.azure-dir }}/*.yml --schemafile "$SCHEMA_FILE" diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index baac4a44..80fca35b 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -20,8 +20,9 @@ jobs: timeout-minutes: 35 steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} + - name: Checkout 🛎 + uses: actions/checkout@v3 + - name: Set up Python 🐍 ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} @@ -33,7 +34,8 @@ jobs: pip install -e '.[cli]' python -m lightning_utilities.cli requirements set-oldest - - uses: ./.github/actions/cache + - name: Complex 💽 caching + uses: ./.github/actions/cache with: python-version: ${{ matrix.python-version }} @@ -48,7 +50,8 @@ jobs: # TODO: re-enable after the external usage is resolved, see #51 # - uses: ./.github/actions/pip-list - - uses: ./.github/actions/unittesting + - name: Unittesting and coverage + uses: ./.github/actions/unittesting with: python-version: ${{ matrix.python-version }} pytorch-version: ${{ matrix.pytorch-version }} diff --git a/.github/workflows/clear-cache.yml b/.github/workflows/clear-cache.yml index aff5e707..02f3a9a1 100644 --- a/.github/workflows/clear-cache.yml +++ b/.github/workflows/clear-cache.yml @@ -13,27 +13,44 @@ jobs: runs-on: ubuntu-latest steps: - - name: Get the list of cache keys - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh api -H "Accept: application/vnd.github+json" /repos/${{ github.repository }}/actions/caches --paginate --jq ".actions_caches[].key" | sort | uniq > cache_keys.txt && cat cache_keys.txt || echo "no cache keys found with the pattern" + - name: Get the list of cache keys + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh api \ + -H "Accept: application/vnd.github+json" \ + /repos/${{ github.repository }}/actions/caches \ + --paginate \ + --jq ".actions_caches[].key" \ + | sort | uniq \ + > cache_keys.txt && cat cache_keys.txt \ + || echo "no cache keys found with the pattern" - - name: Filter cache keys - run: | - grep -E ${{ inputs.pattern }} cache_keys.txt > cache_keys_to_remove.txt && cat cache_keys_to_remove.txt || echo "no cache keys found with the pattern" + - name: Filter cache keys + run: | + grep -E ${{ inputs.pattern }} cache_keys.txt > cache_keys_to_remove.txt \ + && cat cache_keys_to_remove.txt || echo "no cache keys found with the pattern" - - name: Remove caches - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - echo created_at last_accessed_at ref key size_in_bytes - for key in $(cat cache_keys_to_remove.txt); do - gh api --method DELETE -H "Accept: application/vnd.github+json" "/repos/${{ github.repository }}/actions/caches?key=${key}" --jq '.actions_caches[] | [.created_at, .last_accessed_at, .ref, .key, .size_in_bytes] | join(" ")' - done + - name: Remove caches + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo created_at last_accessed_at ref key size_in_bytes + for key in $(cat cache_keys_to_remove.txt); do + gh api \ + --method DELETE \ + -H "Accept: application/vnd.github+json" \ + "/repos/${{ github.repository }}/actions/caches?key=${key}" \ + --jq '.actions_caches[] \ + | [.created_at, .last_accessed_at, .ref, .key, .size_in_bytes] | join(" ")' + done - - name: Show the list of remaining caches - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh api -H "Accept: application/vnd.github+json" /repos/${{ github.repository }}/actions/caches --paginate --jq ".actions_caches[].key" | sort | uniq + - name: Show the list of remaining caches + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh api -H "Accept: application/vnd.github+json" \ + /repos/${{ github.repository }}/actions/caches \ + --paginate \ + --jq ".actions_caches[].key" \ + | sort | uniq diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index 22f06f61..38ebe485 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -8,55 +8,56 @@ jobs: build-docs-deploy: runs-on: ubuntu-20.04 steps: - - name: Checkout 🛎️ - uses: actions/checkout@v3 - # If you're using actions/checkout@v3 you must set persist-credentials to false in most cases for the deployment to work correctly. - with: - persist-credentials: false - - uses: actions/setup-python@v4 - with: + - name: Checkout 🛎️ + uses: actions/checkout@v3 + # If you're using actions/checkout@v3 you must set persist-credentials to false in most cases for the deployment to work correctly. + with: + persist-credentials: false + - name: Set up Python 🐍 + uses: actions/setup-python@v4 + with: python-version: 3.7 - # Note: This uses an internal pip API and may not always work - # https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow - - name: Cache pip - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }} - restore-keys: | - ${{ runner.os }}-pip- + # Note: This uses an internal pip API and may not always work + # https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow + - name: Cache 💽 pip + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }} + restore-keys: | + ${{ runner.os }}-pip- - - name: Install dependencies - run: | - pip install -e . -U -f https://download.pytorch.org/whl/cpu/torch_stable.html --quiet - pip install --requirement requirements/docs.txt - # install Texlive, see https://linuxconfig.org/how-to-install-latex-on-ubuntu-20-04-focal-fossa-linux - sudo apt-get update - sudo apt-get install -y texlive-latex-extra dvipng texlive-pictures - python --version - pip --version - pip list - shell: bash + - name: Install dependencies + run: | + pip install -e . -U -f https://download.pytorch.org/whl/cpu/torch_stable.html --quiet + pip install --requirement requirements/docs.txt + # install Texlive, see https://linuxconfig.org/how-to-install-latex-on-ubuntu-20-04-focal-fossa-linux + sudo apt-get update + sudo apt-get install -y texlive-latex-extra dvipng texlive-pictures + python --version + pip --version + pip list + shell: bash - # TODO: re-enable after the external usage is resolved, see #51 - # - uses: ./.github/actions/pip-list + # TODO: re-enable after the external usage is resolved, see #51 + # - uses: ./.github/actions/pip-list - - name: Make Documentation - run: | - # First run the same pipeline as Read-The-Docs - cd docs - make clean - make html --jobs 2 - #touch build/html/.nojekyll + - name: Make Documentation + run: | + # First run the same pipeline as Read-The-Docs + cd docs + make clean + make html --jobs 2 + #touch build/html/.nojekyll - - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.4.1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - branch: gh-pages # The branch the action should deploy to. - folder: docs/build/html # The folder the action should deploy. - clean: true # Automatically remove deleted files from the deploy branch - target-folder: docs # If you'd like to push the contents of the deployment folder into a specific directory - single-commit: true # you'd prefer to have a single commit on the deployment branch instead of full history - if: success() + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4.4.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: gh-pages # The branch the action should deploy to. + folder: docs/build/html # The folder the action should deploy. + clean: true # Automatically remove deleted files from the deploy branch + target-folder: docs # If you'd like to push the contents of the deployment folder into a specific directory + single-commit: true # you'd prefer to have a single commit on the deployment branch instead of full history + if: success() diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 525c5e3f..362eb8e0 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -12,8 +12,10 @@ jobs: runs-on: ubuntu-20.04 timeout-minutes: 10 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - name: Checkout 🛎️ + uses: actions/checkout@v3 + - name: Set up Python 🐍 + uses: actions/setup-python@v4 with: python-version: 3.8 @@ -26,7 +28,8 @@ jobs: python setup.py sdist bdist_wheel ls -lh dist/ - - uses: actions/upload-artifact@v3 + - name: Upload 📤 artifact + uses: actions/upload-artifact@v3 with: name: pypi-packages-${{ github.sha }} path: dist @@ -36,12 +39,15 @@ jobs: runs-on: ubuntu-20.04 needs: build-package steps: - - uses: actions/checkout@v3 - - uses: actions/download-artifact@v3 + - name: Checkout 🛎️ + uses: actions/checkout@v3 + - name: Download 📥 artifact + uses: actions/download-artifact@v3 with: name: pypi-packages-${{ github.sha }} path: dist - - run: ls -lh dist/ + - name: local 🗃️ files + run: ls -lh dist/ - name: Upload to release if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' @@ -55,12 +61,15 @@ jobs: timeout-minutes: 10 needs: build-package steps: - - uses: actions/checkout@v3 - - uses: actions/download-artifact@v3 + - name: Checkout 🛎️ + uses: actions/checkout@v3 + - name: Download 📥 artifact + uses: actions/download-artifact@v3 with: name: pypi-packages-${{ github.sha }} path: dist - - run: ls -lh dist/ + - name: local 🗃️ files + run: ls -lh dist/ - name: Delay releasing if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'