diff options
Diffstat (limited to '')
-rw-r--r-- | .github/workflows/checks.yml | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 348fb47..710245c 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -1,19 +1,27 @@ name: Tests and Checks -on: [push] +on: [push, pull_request] jobs: checks: runs-on: "ubuntu-latest" strategy: matrix: - python-version: [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3] + python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, pypy2, pypy3] os: ["macos-latest", "ubuntu-latest"] steps: - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} # Checkout pull request HEAD commit instead of merge commit + + # Because gitlint is a tool that uses git itself under the hood, we remove git tracking from the checked out + # code by temporarily renaming the .git directory. + # This is to ensure that the tests don't have a dependency on the version control of gitlint itself. + - name: Temporarily remove git version control from code + run: mv .git ._git - name: Setup python - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} @@ -57,24 +65,36 @@ jobs: # with: # github-token: ${{ secrets.GITHUB_TOKEN }} + # Re-add git version control so we can run gitlint on itself. + - name: Re-add git version control to code + run: mv ._git .git + - name: Gitlint check - run: ./run_tests.sh -g + run: ./run_tests.sh -g --debug windows-checks: runs-on: windows-latest strategy: matrix: - python-version: [2.7, 3.5] + python-version: [2.7, 3.6] steps: - uses: actions/checkout@v2 - + with: + ref: ${{ github.event.pull_request.head.sha }} # Checkout pull request HEAD commit instead of merge commit + + # Because gitlint is a tool that uses git itself under the hood, we remove git tracking from the checked out + # code by temporarily renaming the .git directory. + # This is to ensure that the tests don't have a dependency on the version control of gitlint itself. + - name: Temporarily remove git version control from code + run: Rename-Item .git ._git + - name: Setup python - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: "Upgrade pip on Python 3" - if: matrix.python-version == '3.5' + if: matrix.python-version == '3.6' run: python -m pip install --upgrade pip - name: Install requirements @@ -88,8 +108,8 @@ jobs: - name: Tests (sanity) run: tools\windows\run_tests.bat "gitlint\tests\cli\test_cli.py::CLITests::test_lint" - - name: Tests (ignore test_cli.py) - run: pytest --ignore gitlint\tests\cli\test_cli.py -rw -s gitlint + - name: Tests (ignore cli\*) + run: pytest --ignore gitlint\tests\cli -rw -s gitlint - name: Tests (test_cli.py only - continue-on-error:true) run: tools\windows\run_tests.bat "gitlint\tests\cli\test_cli.py" @@ -109,5 +129,9 @@ jobs: - name: PyLint run: pylint gitlint qa --rcfile=".pylintrc" -r n + # Re-add git version control so we can run gitlint on itself. + - name: Re-add git version control to code + run: Rename-Item ._git .git + - name: Gitlint check run: gitlint --debug |