diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 467853f..b006c0b 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -5,72 +5,14 @@ name: 'checks' pull_request: branches: - 'main' - push: - branches: - - 'main' jobs: - linting: - runs-on: 'ubuntu-latest' - steps: - - name: 'Checkout repo' - uses: 'actions/checkout@v4' - - - name: Install poetry - run: pipx install poetry - - - name: 'Set up Python 3.10' - uses: actions/setup-python@v5 - with: - cache: 'poetry' - python-version: '3.10' - - - name: 'Configure Poetry' - run: 'poetry config virtualenvs.in-project true' - - - name: 'Install dependencies' - run: 'poetry install' - - - name: 'Lint with yamllint' - run: 'poetry run yamllint . -s' - - - name: 'Lint with pylama' - run: "poetry run pylama -v --skip '.venv/*'" + pre-commit: + uses: broadinstitute/shared-workflows/.github/workflows/pre-commit.yaml@v2.0.0 + linting: + uses: broadinstitute/shared-workflows/.github/workflows/python-lint.yaml@v2.0.0 unit-tests: - runs-on: 'ubuntu-latest' - strategy: - matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] - steps: - - name: 'Checkout repo' - uses: 'actions/checkout@v4' - - - name: Install poetry - run: pipx install poetry - - - name: Set up Python ${{ matrix.python-version }} - uses: 'actions/setup-python@v5' - with: - cache: 'poetry' - python-version: ${{ matrix.python-version }} - - - name: 'Configure Poetry' - run: 'poetry config virtualenvs.in-project true' - - - name: 'Check pyproject.toml' - run: 'poetry check' - - - name: 'Install dependencies' - run: 'poetry install' - - - name: 'Test with green' - # test with one test for now - run: | - poetry run green tests - poetry run coverage xml - - - name: 'Run a test module build and install' - run: | - poetry build - pip install dist/pysudoers-*.tar.gz + uses: broadinstitute/shared-workflows/.github/workflows/python-unit-test.yaml@v2.0.0 + with: + python_package_name: pysudoers diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 19dcc55..1e58e83 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -8,35 +8,6 @@ name: 'deploy' jobs: pypi_deploy: - - runs-on: 'ubuntu-latest' - - steps: - - name: 'Checkout repo' - uses: 'actions/checkout@v4' - - - name: Install poetry - run: pipx install poetry - - - name: 'Set up Python 3.10' - uses: actions/setup-python@v5 - with: - cache: 'poetry' - python-version: '3.10' - - - name: 'Configure Poetry' - run: 'poetry config virtualenvs.in-project true' - - - name: 'Install dependencies' - run: 'poetry install' - - - name: 'Setup PyPi credential' - env: - PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} - run: 'poetry config pypi-token.pypi "$PYPI_TOKEN"' - - - name: 'Package build' - run: 'poetry build' - - - name: 'Publish package to PyPi' - run: 'poetry publish' + uses: broadinstitute/shared-workflows/.github/workflows/python-deploy-to-pypi.yaml@v2.0.0 + secrets: + pypi_token: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/test_deploy.yaml b/.github/workflows/test_deploy.yaml index 6d69658..d3940a2 100644 --- a/.github/workflows/test_deploy.yaml +++ b/.github/workflows/test_deploy.yaml @@ -2,43 +2,12 @@ name: 'test_deploy' 'on': - push: + pull_request: branches: - 'main' jobs: - pypi_deploy: - - runs-on: 'ubuntu-latest' - - steps: - - name: 'Checkout repo' - uses: 'actions/checkout@v4' - - - name: Install poetry - run: pipx install poetry - - - name: 'Set up Python 3.10' - uses: actions/setup-python@v5 - with: - cache: 'poetry' - python-version: '3.10' - - - name: 'Configure Poetry' - run: 'poetry config virtualenvs.in-project true' - - - name: 'Install dependencies' - run: 'poetry install' - - - name: 'Setup PyPi credential' - env: - PYPI_TOKEN: ${{ secrets.PYPI_TEST_TOKEN }} - run: | - poetry config repositories.testpypi https://test.pypi.org/legacy/ - poetry config pypi-token.testpypi "$PYPI_TOKEN" - - - name: 'Package build' - run: 'poetry build' - - - name: 'Publish package to PyPi' - run: 'poetry publish --dry-run -r testpypi' + pypi_test_deploy: + uses: broadinstitute/shared-workflows/.github/workflows/python-test-deploy-to-pypi.yaml@v2.0.0 + secrets: + pypi_test_token: ${{ secrets.PYPI_TEST_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8345bb7..75db195 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-added-large-files - id: check-ast @@ -32,7 +32,7 @@ repos: hooks: - id: pylama - repo: https://github.com/adrienverge/yamllint.git - rev: v1.32.0 + rev: v1.33.0 hooks: - id: yamllint args: diff --git a/.yamllint b/.yamllint index 6c0ab94..4d22fe2 100644 --- a/.yamllint +++ b/.yamllint @@ -6,5 +6,5 @@ rules: indentation: spaces: 2 line-length: - max: 120 level: warning + max: 120