Merge pull request #90 from NASA-IMPACT/feature/agnostic-default-disc… #392
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
name: CI/CD | |
on: | |
push: | |
pull_request: | |
types: [ opened, reopened, edited, synchronize ] | |
jobs: | |
gitflow-enforcer: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check branch | |
run: | | |
if [[ $GITHUB_BASE_REF == "main" ]]; then | |
if [[ $GITHUB_HEAD_REF != "dev" && $GITHUB_HEAD_REF != "revert-"* ]]; then | |
echo "ERROR: You can only merge to 'main' from 'dev' or a 'revert-*' branch" | |
exit 1 | |
fi | |
elif [[ $GITHUB_BASE_REF == "production" ]]; then | |
if [[ $GITHUB_HEAD_REF != "main" && $GITHUB_HEAD_REF != "revert-"* ]]; then | |
echo "ERROR: You can only merge to 'production' from 'main' or a 'revert-*' branch" | |
exit 1 | |
fi | |
fi | |
run-linters: | |
name: Run linters | |
runs-on: ubuntu-latest | |
needs: gitflow-enforcer | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install Python dependencies | |
run: pip install black flake8 | |
- name: Run linters | |
uses: wearerequired/lint-action@v2 | |
with: | |
continue_on_error: false | |
black: true | |
flake8: true | |
flake8_args: "--ignore E1,E2,E3,E5,W1,W2,W3,W5" # black already handles formatting, this prevents conflicts | |
deploy-to-dev: | |
needs: run-linters | |
if: github.ref_name == 'dev' | |
concurrency: development | |
uses: "./.github/workflows/deploy.yml" | |
with: | |
environment: development | |
env-file: ".env_dev" | |
stage: "dev" | |
role-session-name: "veda-data-airflow-github-development-deployment" | |
aws-region: "us-west-2" | |
secrets: inherit | |
deploy-to-staging: | |
needs: run-linters | |
if: github.ref_name == 'main' | |
concurrency: staging | |
uses: "./.github/workflows/deploy.yml" | |
with: | |
environment: staging | |
env-file: ".env_staging" | |
stage: "staging" | |
role-session-name: "veda-data-airflow-github-staging-deployment" | |
aws-region: "us-west-2" | |
secrets: inherit | |
deploy-to-production: | |
needs: run-linters | |
if: github.ref_name == 'production' | |
concurrency: production | |
uses: "./.github/workflows/deploy.yml" | |
with: | |
environment: production | |
env-file: ".env_prod" | |
stage: "production" | |
role-session-name: "veda-data-airflow-github-production-deployment" | |
aws-region: "us-west-2" | |
secrets: inherit |