Skip to content

Commit

Permalink
ci: implements CI/CD system
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecarenzo authored Sep 25, 2023
1 parent b6cc606 commit 971c9b2
Show file tree
Hide file tree
Showing 15 changed files with 917 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
root = true

[*]
end_of_line = = lf
end_of_line = lf
insert_final_newline = true

[*.{js, py}]
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Explorer Tests

on:
push:
branches: [main]
pull_request:

jobs:
mappings_explorer_tests:
runs-on: ubuntu-latest
steps:

# Configure Environment
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: 3.9

# Prepare Poetry
- name: Attempt Poetry install from cache
uses: actions/cache@v3
id: cached-poetry
with:
path: ./.poetry
key: venv::${{ runner.os }}::${{ steps.setup-python.outputs.python-version }}::poetry
- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
run: |
python -m venv .poetry
source ./.poetry/bin/activate
pip install poetry
deactivate
mkdir $PWD/.poetry/.bin
ln -s $PWD/.poetry/bin/poetry $PWD/.poetry/.bin/poetry
- name: Add Poetry to PATH
run: echo "$PWD/.poetry/.bin" >> $GITHUB_PATH

# Prepare Virtual Environment
- name: Configure Poetry
run: poetry config virtualenvs.in-project true
- name: Load cached virtual environment
uses: actions/cache@v3
id: cached-dependencies
with:
path: ./.venv
key: venv::${{ runner.os }}::${{ steps.setup-python.outputs.python-version }}::${{ hashFiles('./poetry.lock') }}
- name: Install dependencies
if: steps.cached-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install Mappings Explorer
run: poetry install --no-interaction --only-root

# Check Lint, Test, Security
- name: Lint Mappings Explorer
run: poetry run make lint
- name: Test Mappings Explorer
run: poetry run make test-ci
- name: Run Bandit security check
run: poetry run bandit -r ./src -ll -ii
- name: Safety vulnerability check
run: |
poetry export -f requirements.txt | poetry run safety check --full-report --stdin
# Upload Test Coverage
- name: Upload coverage to CodeCov
uses: codecov/codecov-action@v3
with:
token: $\{\{ secrets.CODECOV_SECRET \}\}
files: ./coverage.xml
verbose: true
42 changes: 0 additions & 42 deletions .github/workflows/python_test.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Update Release

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Update release
uses: google-github-actions/release-please-action@v3
with:
command: manifest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ docs/_build/
.mypy_cache/
*.tmp
TODO*
.DS_Store
.coverage
1 change: 1 addition & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
// See: https://go.microsoft.com/fwlink/?LinkId=827846
// for documentation about the extensions.json format.
"recommendations": [
"charliermarsh.ruff",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.black-formatter"
]
}
15 changes: 11 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"files.exclude": {
"**/__pycache__": true
"**/__pycache__": true,
"**/.ruff_cache": true,
"**/.mypy_cache": true,
"**/.pytest_cache": true
},
"editor.rulers": [
88
],
"python.formatting.autopep8Path": "black",
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
},
"markdown.extension.toc.levels": "2..6",
"python.formatting.provider": "black",
"editor.formatOnSave": true
}
Empty file removed make/.gitkeep
Empty file.
6 changes: 3 additions & 3 deletions make/python.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.PHONY: lint test test-ci

lint: ## Run black, isort, and mypy
poetry run black --check src/
poetry run isort --check src/
lint: ## Run ruff, black, and mypy
poetry run ruff check src/
poetry run black --check src/
poetry run mypy --check src/

test: ## Run Python tests
Expand Down
Loading

0 comments on commit 971c9b2

Please sign in to comment.