diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..1c47345 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,52 @@ +--- + +name: CI + +on: # yamllint disable-line rule:truthy + push: + pull_request: + branches: + - master + +jobs: + lint: + name: Linters + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - run: python -m pip install flake8 flake8-import-order doc8 sphinx + - run: python -m pip install . + - run: flake8 . + - run: doc8 $(git ls-files '*.rst') + - run: yamllint --strict $(git ls-files '*.yaml' '*.yml') + - run: python setup.py build_sphinx + + test: + name: Tests + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - 3.5 + - 3.6 + - 3.7 + - 3.8 + - 3.9 + - nightly + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.pyver }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.pyver }} + - run: python -m pip install coveralls + - run: python -m pip install . + - run: coverage run --source=yamllint -m unittest discover + - name: Coveralls + uses: AndreMiras/coveralls-python-action@develop diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 90a432f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069) -language: python -python: - - 3.5 - - 3.6 - - 3.7 - - 3.8 - - 3.9 - - nightly -env: - - REMOVE_LOCALES=false - - REMOVE_LOCALES=true -install: - - pip install pyyaml coveralls flake8 flake8-import-order doc8 sphinx - - pip install . - - if [[ $REMOVE_LOCALES = "true" ]]; then sudo rm -rf /usr/lib/locale/*; fi -script: - - if [[ $TRAVIS_PYTHON_VERSION != nightly ]]; then flake8 .; fi - - doc8 $(git ls-files '*.rst') - - yamllint --strict $(git ls-files '*.yaml' '*.yml') - - coverage run --source=yamllint -m unittest discover - - python setup.py build_sphinx -after_success: - coveralls diff --git a/setup.cfg b/setup.cfg index c5ef250..c5adb55 100644 --- a/setup.cfg +++ b/setup.cfg @@ -67,3 +67,6 @@ yamllint = conf/*.yaml [options.entry_points] console_scripts = yamllint = yamllint.cli:run + +[coverage:run] +relative_files = True diff --git a/tests/test_cli.py b/tests/test_cli.py index 0cb300a..79c4320 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -297,6 +297,7 @@ class CommandLineTestCase(unittest.TestCase): cli.run(('-c', f.name, os.path.join(self.wd, 'a.yaml'))) self.assertEqual(ctx.returncode, 1) + @unittest.skipIf(os.environ.get('GITHUB_RUN_ID'), '$HOME not overridable') def test_run_with_user_global_config_file(self): home = os.path.join(self.wd, 'fake-home') dir = os.path.join(home, '.config', 'yamllint')