Skip to content

Commit

Permalink
ci: update and run on GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
amitkparekh committed Nov 30, 2023
1 parent 2144a95 commit db98151
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 93 deletions.
85 changes: 19 additions & 66 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
types: [opened, reopened, synchronize, ready_for_review]
branches:
- main
push:
branches: [main]

env:
PYTHON_VERSION: 3.9
Expand Down Expand Up @@ -39,55 +41,33 @@ jobs:
if: ${{needs.changes.outputs.python == 'true' && !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout the repository
uses: actions/checkout@v4

- name: Setup reviewdog
uses: reviewdog/action-setup@v1

- name: Install Poetry
run: pipx install poetry

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Configure GitHub to download private repos
env:
PAT: ${{ secrets.PAT }}
run: |
git config --global url."https://${PAT}@github.com/".insteadOf "https://github.com/"
- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install PoethePoet
run: poetry self add 'poethepoet[poetry_plugin]'

- name: Load cached Python
uses: tespkg/actions-cache@v1
id: python-cache
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}-${{ hashFiles('pyproject.toml') }}
bucket: ${{ secrets.AWS_S3_BUCKET_NAME }}
accessKey: ${{ secrets.AWS_ACCESS_KEY_ID }}
secretKey: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
cache: "poetry"

- name: Install dependencies
run: |
poetry install --all-extras
run: poetry install

- name: Load mypy cache
uses: tespkg/actions-cache@v1
uses: actions/cache@v3
id: mypy-cache
with:
path: .mypy_cache
key: ${{ runner.os }}-mypy-cache-${{ hashFiles('poetry.lock') }}-${{hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-mypy-cache-${{ hashFiles('poetry.lock') }}-${{hashFiles('pyproject.toml') }}
${{ runner.os }}-mypy-cache-
bucket: ${{ secrets.AWS_S3_BUCKET_NAME }}
accessKey: ${{ secrets.AWS_ACCESS_KEY_ID }}
secretKey: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Run mypy with reviewdog
env:
Expand Down Expand Up @@ -116,41 +96,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup reviewdog
uses: reviewdog/action-setup@v1

- name: Install Poetry
run: pipx install poetry

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Configure GitHub to download private repos
env:
PAT: ${{ secrets.PAT }}
run: |
git config --global url."https://${PAT}@github.com/".insteadOf "https://github.com/"
- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install PoethePoet
run: poetry self add 'poethepoet[poetry_plugin]'

- name: Load cached Python
uses: tespkg/actions-cache@v1
id: python-cache
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}-${{ hashFiles('pyproject.toml') }}
bucket: ${{ secrets.AWS_S3_BUCKET_NAME }}
accessKey: ${{ secrets.AWS_ACCESS_KEY_ID }}
secretKey: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
cache: "poetry"

- name: Install dependencies
run: |
poetry install --all-extras
run: poetry install

- name: Run flake8
env:
Expand All @@ -176,34 +137,26 @@ jobs:
if: ${{ !github.event.pull_request.draft }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Configure GitHub to download private repos
env:
PAT: ${{ secrets.PAT }}
run: |
git config --global url."https://${PAT}@github.com/".insteadOf "https://github.com/"
cache: "pip"

- name: Install pre-commit
run: |
pip install pre-commit
- name: Load cached pre-commit environment
uses: tespkg/actions-cache@v1
uses: actions/cache@v3
id: pre-commit-cache
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
bucket: ${{ secrets.AWS_S3_BUCKET_NAME }}
accessKey: ${{ secrets.AWS_ACCESS_KEY_ID }}
secretKey: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Run pre-commit hook
id: run-pre-commit-hooks
Expand Down
37 changes: 10 additions & 27 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [main]
paths-ignore: ["**/*.md", "**/*.rst"]
push:
branches: [main]
paths-ignore: ["**/*.md", "**/*.rst"]

env:
PYTHON_VERSION: 3.9
Expand Down Expand Up @@ -48,42 +51,22 @@ jobs:
if: ${{needs.changes.outputs.python == 'true' && !github.event.pull_request.draft }}
steps:
- name: Checkout the repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Poetry
run: pipx install poetry

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install PoethePoet
run: poetry self add 'poethepoet[poetry_plugin]'

- name: Configure GitHub to download private repos
env:
PAT: ${{ secrets.PAT }}
run: |
git config --global url."https://${PAT}@github.com/".insteadOf "https://github.com/"
- name: Load cached Python
uses: tespkg/actions-cache@v1
id: python-cache
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}-${{ hashFiles('pyproject.toml') }}
bucket: ${{ secrets.AWS_S3_BUCKET_NAME }}
accessKey: ${{ secrets.AWS_ACCESS_KEY_ID }}
secretKey: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
cache: "poetry"

- name: Install dependencies
run: |
poetry install --all-extras
run: poetry install

- name: Run test suite
run: |
poetry run poe test-everything | tee pytest-coverage.txt
run: poetry run poe test-everything | tee pytest-coverage.txt

- name: Comment the coverage
if: ${{ always() && github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
Expand Down

0 comments on commit db98151

Please sign in to comment.