-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from xSAVIKx/cicd
Add GitHub Actions config
- Loading branch information
Showing
33 changed files
with
7,759 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,249 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
- development | ||
env: | ||
PYTHON_VESRION: '3.7' | ||
POETRY_VERSION: '1.1.7' | ||
jobs: | ||
# JOB to run change detection | ||
changes: | ||
runs-on: ubuntu-20.04 | ||
outputs: | ||
app_engine_flex: ${{ steps.filter.outputs.app_engine_flex }} | ||
app_engine_standard: ${{ steps.filter.outputs.app_engine_standard }} | ||
cloud_functions: ${{ steps.filter.outputs.cloud_functions }} | ||
cloud_run: ${{ steps.filter.outputs.cloud_run }} | ||
compute_engine: ${{ steps.filter.outputs.compute_engine }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
token: ${{ github.token }} | ||
filters: | | ||
app_engine_flex: | ||
- 'app_engine_flex/**' | ||
app_engine_standard: | ||
- 'app_engine_standard/**' | ||
cloud_functions: | ||
- 'cloud_functions/**' | ||
cloud_run: | ||
- 'cloud_run/**' | ||
compute_engine: | ||
- 'compute_engine/**' | ||
app_engine_flex: | ||
needs: [ 'changes' ] | ||
if: ${{ needs.changes.outputs.app_engine_flex == 'true' }} | ||
defaults: | ||
run: | ||
working-directory: app_engine_flex | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.PYTHON_VESRION }} | ||
- name: Load cached venv | ||
id: cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: "app_engine_flex/.venv" | ||
key: venv-${{ runner.os }}-app_engine_flex-${{ hashFiles('poetry.lock') }} | ||
restore-keys: | | ||
venv-${{ runner.os }}-app_engine_flex-${{ hashFiles('poetry.lock') }} | ||
venv-${{ runner.os }}-app_engine_flex | ||
- name: Setup poetry | ||
uses: abatilo/[email protected] | ||
with: | ||
poetry-version: ${{ env.POETRY_VERSION }} | ||
- name: Install dependencies | ||
run: poetry install | ||
- name: Run Black | ||
run: poetry run black . --check --diff --color | ||
- name: "Set up GCloud SDK" | ||
uses: google-github-actions/setup-gcloud@master | ||
with: | ||
project_id: ${{ secrets.GCP_PROJECT_ID }} | ||
service_account_key: ${{ secrets.GCP_SA_KEY }} | ||
export_default_credentials: true | ||
- name: Configure GCR | ||
run: gcloud auth configure-docker | ||
- name: Run MyPy checks | ||
continue-on-error: true | ||
run: poetry run mypy . --show-error-context --pretty | ||
|
||
app_engine_standard: | ||
needs: [ 'changes' ] | ||
if: ${{ needs.changes.outputs.app_engine_standard == 'true' }} | ||
defaults: | ||
run: | ||
working-directory: app_engine_standard | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.PYTHON_VESRION }} | ||
- name: Load cached venv | ||
id: cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: "app_engine_standard/.venv" | ||
key: venv-${{ runner.os }}-app_engine_standard-${{ hashFiles('poetry.lock') }} | ||
restore-keys: | | ||
venv-${{ runner.os }}-app_engine_standard-${{ hashFiles('poetry.lock') }} | ||
venv-${{ runner.os }}-app_engine_standard | ||
- name: Setup poetry | ||
uses: abatilo/[email protected] | ||
with: | ||
poetry-version: ${{ env.POETRY_VERSION }} | ||
- name: Install dependencies | ||
run: poetry install | ||
- name: Run Black | ||
run: poetry run black . --check --diff --color | ||
- name: "Set up GCloud SDK" | ||
uses: google-github-actions/setup-gcloud@master | ||
with: | ||
project_id: ${{ secrets.GCP_PROJECT_ID }} | ||
service_account_key: ${{ secrets.GCP_SA_KEY }} | ||
export_default_credentials: true | ||
- name: Configure GCR | ||
run: gcloud auth configure-docker | ||
- name: Run MyPy checks | ||
continue-on-error: true | ||
run: poetry run mypy . --show-error-context --pretty | ||
|
||
cloud_functions: | ||
needs: [ 'changes' ] | ||
if: ${{ needs.changes.outputs.cloud_functions == 'true' }} | ||
defaults: | ||
run: | ||
working-directory: cloud_functions | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.PYTHON_VESRION }} | ||
- name: Load cached venv | ||
id: cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: "cloud_functions/.venv" | ||
key: venv-${{ runner.os }}-cloud_functions-${{ hashFiles('poetry.lock') }} | ||
restore-keys: | | ||
venv-${{ runner.os }}-cloud_functions-${{ hashFiles('poetry.lock') }} | ||
venv-${{ runner.os }}-cloud_functions | ||
- name: Setup poetry | ||
uses: abatilo/[email protected] | ||
with: | ||
poetry-version: ${{ env.POETRY_VERSION }} | ||
- name: Install dependencies | ||
run: poetry install | ||
- name: Run Black | ||
run: poetry run black . --check --diff --color | ||
- name: "Set up GCloud SDK" | ||
uses: google-github-actions/setup-gcloud@master | ||
with: | ||
project_id: ${{ secrets.GCP_PROJECT_ID }} | ||
service_account_key: ${{ secrets.GCP_SA_KEY }} | ||
export_default_credentials: true | ||
- name: Configure GCR | ||
run: gcloud auth configure-docker | ||
- name: Run MyPy checks | ||
continue-on-error: true | ||
run: poetry run mypy . --show-error-context --pretty | ||
|
||
cloud_run: | ||
needs: [ 'changes' ] | ||
if: ${{ needs.changes.outputs.cloud_run == 'true' }} | ||
defaults: | ||
run: | ||
working-directory: cloud_run | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.PYTHON_VESRION }} | ||
- name: Load cached venv | ||
id: cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: "cloud_run/.venv" | ||
key: venv-${{ runner.os }}-cloud_run-${{ hashFiles('poetry.lock') }} | ||
restore-keys: | | ||
venv-${{ runner.os }}-cloud_run-${{ hashFiles('poetry.lock') }} | ||
venv-${{ runner.os }}-cloud_run | ||
- name: Setup poetry | ||
uses: abatilo/[email protected] | ||
with: | ||
poetry-version: ${{ env.POETRY_VERSION }} | ||
- name: Install dependencies | ||
run: poetry install | ||
- name: Run Black | ||
run: poetry run black . --check --diff --color | ||
- name: "Set up GCloud SDK" | ||
uses: google-github-actions/setup-gcloud@master | ||
with: | ||
project_id: ${{ secrets.GCP_PROJECT_ID }} | ||
service_account_key: ${{ secrets.GCP_SA_KEY }} | ||
export_default_credentials: true | ||
- name: Configure GCR | ||
run: gcloud auth configure-docker | ||
- name: Run MyPy checks | ||
continue-on-error: true | ||
run: poetry run mypy . --show-error-context --pretty | ||
|
||
compute_engine: | ||
needs: [ 'changes' ] | ||
if: ${{ needs.changes.outputs.compute_engine == 'true' }} | ||
defaults: | ||
run: | ||
working-directory: compute_engine | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.PYTHON_VESRION }} | ||
- name: Load cached venv | ||
id: cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: "compute_engine/.venv" | ||
key: venv-${{ runner.os }}-compute_engine-${{ hashFiles('poetry.lock') }} | ||
restore-keys: | | ||
venv-${{ runner.os }}-compute_engine-${{ hashFiles('poetry.lock') }} | ||
venv-${{ runner.os }}-compute_engine | ||
- name: Setup poetry | ||
uses: abatilo/[email protected] | ||
with: | ||
poetry-version: ${{ env.POETRY_VERSION }} | ||
- name: Install dependencies | ||
run: poetry install | ||
- name: Run Black | ||
run: poetry run black . --check --diff --color | ||
- name: "Set up GCloud SDK" | ||
uses: google-github-actions/setup-gcloud@master | ||
with: | ||
project_id: ${{ secrets.GCP_PROJECT_ID }} | ||
service_account_key: ${{ secrets.GCP_SA_KEY }} | ||
export_default_credentials: true | ||
- name: Configure GCR | ||
run: gcloud auth configure-docker | ||
- name: Run MyPy checks | ||
continue-on-error: true | ||
run: poetry run mypy . --show-error-context --pretty |
Oops, something went wrong.