Skip to content

Commit

Permalink
ci: update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
amitkparekh committed Dec 1, 2023
1 parent 8e15720 commit 690456a
Show file tree
Hide file tree
Showing 13 changed files with 229 additions and 1,043 deletions.
20 changes: 0 additions & 20 deletions .github/dependabot.yml

This file was deleted.

103 changes: 23 additions & 80 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ on:
types: [opened, reopened, synchronize, ready_for_review]
branches:
- main
push:
branches: [main]

env:
PYTHON_VERSION: 3.9

jobs:
changes:
name: Check for Python file changes
runs-on: self-hosted
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
outputs:
python: ${{steps.filter.outputs.python}}
Expand All @@ -37,57 +39,35 @@ jobs:
name: Type check Python
needs: [changes]
if: ${{needs.changes.outputs.python == 'true' && !github.event.pull_request.draft }}
runs-on: self-hosted
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
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 All @@ -113,44 +93,25 @@ jobs:
name: Lint Python
needs: [changes]
if: ${{needs.changes.outputs.python == 'true' && !github.event.pull_request.draft }}
runs-on: self-hosted
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
run: poetry install

- name: Run flake8
env:
Expand All @@ -172,48 +133,30 @@ jobs:
format:
name: Format
runs-on: self-hosted
runs-on: ubuntu-latest
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: Setup Node
uses: actions/setup-node@v3
with:
node-version: "14"

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false

- 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
83 changes: 0 additions & 83 deletions .github/workflows/releases.yml

This file was deleted.

43 changes: 13 additions & 30 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
workflow_call:
pull_request:
branches: [main]
paths-ignore: ["**/*.md", "**/*.rst"]
push:
branches: [main]
paths-ignore: ["**/*.md", "**/*.rst"]

env:
PYTHON_VERSION: 3.9
Expand All @@ -18,7 +22,7 @@ env:
jobs:
changes:
name: Check for Python file changes
runs-on: self-hosted
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
outputs:
python: ${{steps.filter.outputs.python}}
Expand All @@ -35,55 +39,34 @@ jobs:
- 'pyproject.toml'
- 'poetry.lock'
- '.github/workflows/tests.yml'
- 'src/**/*'
python:
name: Run Python test suite
defaults:
run:
shell: bash

runs-on: self-hosted
runs-on: ubuntu-latest
needs: [changes]
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
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ target/
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand Down
Loading

0 comments on commit 690456a

Please sign in to comment.