Skip to content

Commit

Permalink
feat: move Actions to shared workflows
Browse files Browse the repository at this point in the history
fix: update pre-commit versions
fix: order in .yamllint
  • Loading branch information
coreone committed Dec 19, 2023
1 parent c284443 commit a7867bb
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 136 deletions.
72 changes: 7 additions & 65 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
35 changes: 3 additions & 32 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
41 changes: 5 additions & 36 deletions .github/workflows/test_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ rules:
indentation:
spaces: 2
line-length:
max: 120
level: warning
max: 120

0 comments on commit a7867bb

Please sign in to comment.