Skip to content

Commit

Permalink
feat: improve ci github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
vncsna committed Feb 10, 2024
1 parent d4fb621 commit d447522
Show file tree
Hide file tree
Showing 18 changed files with 768 additions and 658 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
run: echo "branch=$(cat branch)" >> "$GITHUB_OUTPUT"

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ steps.extract_branch.outputs.branch }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: main

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: main

Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/ci-dbt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: CI dbt
on:
pull_request:
paths: ['**.sql', '**.yaml']
jobs:
lint:
name: Lint dbt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up poetry
run: pipx install poetry
- name: Set up python
uses: actions/setup-python@v4
with:
cache: poetry
python-version: '3.10'
- name: Install requirements
run: poetry install --only=dev
- name: Lint sql
run: poetry run sqlfmt --diff .
- name: Lint yaml
run: poetry run yamlfix --check .
16 changes: 16 additions & 0 deletions .github/workflows/ci-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: CI Docker
on:
pull_request:
paths: [Dockerfile]
jobs:
lint:
name: Lint dockerfile
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run hadolint
uses: reviewdog/action-hadolint@v1
with:
reporter: github-pr-review
19 changes: 19 additions & 0 deletions .github/workflows/ci-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: CI Pull Request
on:
pull_request:
jobs:
lint:
name: Lint pull request
runs-on: ubuntu-latest
steps:
- name: Lint pull request title
uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character.
42 changes: 42 additions & 0 deletions .github/workflows/ci-python.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: CI Python
on:
pull_request:
paths: ['**.py']
jobs:
lint:
name: Lint python
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Lint source code
uses: chartboost/ruff-action@v1
test:
name: Test python
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up poetry
run: pipx install poetry
- name: Set up python
uses: actions/setup-python@v4
with:
cache: poetry
architecture: x64
python-version: '3.11'
- name: Install requirements
run: poetry install --only=test
- name: Test
run: |
poetry run pytest \
--junitxml=pytest.xml \
--cov-report=term-missing:skip-covered \
--cov=bd_api bd_api | tee pytest-coverage.txt
- name: Report coverage
uses: MishaKav/pytest-coverage-comment@main
with:
hide-report: true
junitxml-path: ./pytest.xml
pytest-coverage-path: ./pytest-coverage.txt
61 changes: 0 additions & 61 deletions .github/workflows/ci.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4

- name: Configure Git
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fi
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ steps.select_branch.outputs.branch }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: main

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: main

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
if: contains('AldemirLucas vncsna', github.actor)
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Import secrets
id: import_secrets
Expand Down
17 changes: 13 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,22 @@ repos:
rev: 1.6.0
hooks:
- id: poetry-check
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.29.0
hooks:
- id: yamllint
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/tconbeer/sqlfmt
rev: v0.20.0
hooks:
- id: sqlfmt
language_version: python
additional_dependencies: ['.[jinjafmt]']
- repo: local
hooks:
- id: yamlfix
name: yamlfix
types: [yaml]
entry: yamlfix
language: system
21 changes: 0 additions & 21 deletions .yamllint

This file was deleted.

Loading

0 comments on commit d447522

Please sign in to comment.