Initialize JetBrains Junie 🚀 #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Code Quality | |
| on: | |
| pull_request: | |
| env: | |
| PARENT_ORG: operatehappy | |
| META_PATH: dotfiles-org | |
| SELF_PATH: repository | |
| PYTHON_VERSION: 3.8 | |
| PYTHON_ARCH: x64 | |
| PRECOMMIT_CACHE_PATH: ".cache/pre-commit" | |
| PRECOMMIT_VERSION: 1.18.3 | |
| PRECOMMIT_CONFIG: ".pre-commit-config.yaml" | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-latest | |
| name: pre-commit | |
| steps: | |
| - name: Checkout Meta Repository | |
| uses: actions/checkout@v2 | |
| with: | |
| repository: ${{ env.PARENT_ORG }}/${{ env.META_PATH }} | |
| ref: master | |
| path: ${{ env.META_PATH }} | |
| fetch-depth: 1 | |
| - name: Checkout Repository | |
| uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 1 | |
| path: ${{ env.SELF_PATH }} | |
| - name: Setup Python | |
| uses: actions/setup-python@v1 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| architecture: ${{ env.PYTHON_ARCH }} | |
| - name: Update and Restore pip Binaries Cache | |
| uses: actions/cache@v1 | |
| id: cache-pip-binaries | |
| with: | |
| path: "${{ env.pythonLocation }}/bin" | |
| key: "pip-binaries-${{ env.PYTHON_VERSION }}-${{ env.PRECOMMIT_VERSION }}" | |
| - name: Update and Restore pip Packages Cache | |
| uses: actions/cache@v1 | |
| id: cache-pip-packages | |
| with: | |
| path: "${{ env.pythonLocation }}/lib/python${{ env.PYTHON_VERSION }}/site-packages" | |
| key: "pip-packages-${{ env.PYTHON_VERSION }}-${{ env.PRECOMMIT_VERSION }}" | |
| - name: Update and Restore pre-commit Cache | |
| uses: actions/cache@v1 | |
| id: cache-precommit-hooks | |
| with: | |
| path: "~/${{ env.PRECOMMIT_CACHE_PATH }}" | |
| key: ${{ hashFiles(format('{0}/{1}/{2}', github.workspace, env.META_PATH, env.PRECOMMIT_CONFIG )) }} | |
| - name: Install `pre-commit` via `pip` | |
| run: | | |
| pip \ | |
| install "pre-commit==${{ env.PRECOMMIT_VERSION }}" | |
| shell: sh | |
| if: steps.cache-pip-binaries.outputs.cache-hit != 'true' && steps.cache-pip-packages.outputs.cache-hit != 'true' | |
| - name: Setup `pre-commit` | |
| run: | | |
| pre-commit \ | |
| install \ | |
| --config "${{ github.workspace }}${{ env.UPSTREAM_REP }}/${{ env.PRECOMMIT_CONFIG }}" | |
| shell: sh | |
| working-directory: "${{ github.workspace }}/${{ env.SELF_PATH }}" | |
| if: steps.cache-precommit.outputs.cache-hit != 'true' | |
| - name: Run `pre-commit` | |
| run: | | |
| pre-commit \ | |
| run \ | |
| --config "${{ github.workspace }}/${{ env.META_PATH }}/${{ env.PRECOMMIT_CONFIG }}" \ | |
| --all-files | |
| working-directory: "${{ github.workspace }}/${{ env.SELF_PATH }}" | |
| shell: sh |