ci.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. name: CI
  2. on:
  3. pull_request:
  4. push:
  5. branches: [main]
  6. tags: ['v*']
  7. jobs:
  8. mypy:
  9. if: ${{ !github.event.pull_request.draft }}
  10. runs-on: ubuntu-latest
  11. steps:
  12. - name: Check out repository
  13. uses: actions/checkout@v3
  14. - uses: ./.github/actions/setup
  15. with:
  16. python-version: "3.9"
  17. venv-id: "docs"
  18. poetry-dependency-install-flags: "--all-extras --only 'main,dev'"
  19. - name: mypy
  20. run: MYPYPATH=stubs poetry run mypy src
  21. docs:
  22. if: ${{ !github.event.pull_request.draft }}
  23. runs-on: ubuntu-latest
  24. steps:
  25. - name: Check out repository
  26. uses: actions/checkout@v3
  27. - uses: ./.github/actions/setup
  28. with:
  29. python-version: "3.9"
  30. venv-id: "docs"
  31. poetry-dependency-install-flags: "--all-extras --only 'main,docs'"
  32. - name: docs
  33. run: poetry run sphinx-build -W --keep-going -T -b html docs/source docs/build
  34. tests:
  35. strategy:
  36. fail-fast: false
  37. matrix:
  38. os: [ "ubuntu-latest" ]
  39. python-version: [ "3.9", "3.10", "3.11" ]
  40. runs-on: "${{ matrix.os }}"
  41. steps:
  42. - name: Check out repository
  43. uses: actions/checkout@v3
  44. - uses: ./.github/actions/setup
  45. with:
  46. python-version: "${{ matrix.python-version }}"
  47. venv-id: "tests-${{ runner.os }}"
  48. poetry-dependency-install-flags: "--all-extras"
  49. - name: Run tests
  50. run: |
  51. poetry run pytest -r a -v src tests --doctest-modules --cov=src --cov-report=term-missing --cov-report=xml
  52. poetry run coverage report
  53. - name: Upload coverage reports to Codecov
  54. uses: codecov/codecov-action@v3
  55. imports-without-extras:
  56. strategy:
  57. fail-fast: false
  58. matrix:
  59. os: [ "ubuntu-latest" ]
  60. python-version: [ "3.9", "3.10", "3.11" ]
  61. runs-on: "${{ matrix.os }}"
  62. steps:
  63. - name: Check out repository
  64. uses: actions/checkout@v3
  65. - uses: ./.github/actions/setup
  66. with:
  67. python-version: "${{ matrix.python-version }}"
  68. venv-id: "imports-without-extras-${{ runner.os }}"
  69. poetry-dependency-install-flags: "--only main"
  70. - name: Check importable without extras
  71. run: poetry run python scripts/test-install.py
  72. check-build:
  73. runs-on: ubuntu-latest
  74. steps:
  75. - name: Check out repository
  76. uses: actions/checkout@v3
  77. - uses: ./.github/actions/setup
  78. with:
  79. python-version: "3.9"
  80. venv-id: "check-build-${{ runner.os }}"
  81. run-poetry-install: false
  82. poetry-dependency-install-flags: "not used"
  83. - name: Build package
  84. run: |
  85. poetry build --no-interaction
  86. - name: Check build
  87. run: |
  88. tar -tvf dist/unfccc_ghg_data-*.tar.gz --wildcards '*unfccc_ghg_data/py.typed'
  89. check-dependency-licences:
  90. runs-on: ubuntu-latest
  91. steps:
  92. - name: Check out repository
  93. uses: actions/checkout@v3
  94. - uses: ./.github/actions/setup
  95. with:
  96. python-version: "3.9"
  97. venv-id: "licence-check"
  98. poetry-dependency-install-flags: "--all-extras"
  99. - name: Check licences of dependencies
  100. shell: bash
  101. run: |
  102. TEMP_FILE=$(mktemp)
  103. poetry export --without=tests --without=docs --without=dev > $TEMP_FILE
  104. poetry run liccheck -r $TEMP_FILE -R licence-check.txt
  105. cat licence-check.txt