From c50e08c9dd8bab4d89a7d9c7d9515fa6d08429f2 Mon Sep 17 00:00:00 2001 From: Amisha Singla Date: Thu, 25 Jul 2024 18:16:54 -0500 Subject: [PATCH] move all dev workflow to deploy workflow --- .github/workflows/ci-cd-dev.yml | 95 --------------------------------- .github/workflows/deploy.yml | 20 +++++++ 2 files changed, 20 insertions(+), 95 deletions(-) delete mode 100644 .github/workflows/ci-cd-dev.yml diff --git a/.github/workflows/ci-cd-dev.yml b/.github/workflows/ci-cd-dev.yml deleted file mode 100644 index c592d0aa..00000000 --- a/.github/workflows/ci-cd-dev.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: CI-CD-DEV - -on: - pull_request: - types: - - opened - - reopened - - synchronize - - closed - branches: - - master - -jobs: - pre-commit: - runs-on: ubuntu-latest - if: >- - github.event.pull_request.merged == false && - github.event.pull_request.state == 'open' - - steps: - - uses: actions/checkout@v3 - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.8 - - - id: file_changes - uses: trilom/file-changes-action@v1.2.4 - with: - output: " " - - - uses: pre-commit/action@v3.0.0 - env: - extra_args: --color=always --files ${{ steps.file_changes.outputs.files}} - - tests: - runs-on: ubuntu-latest - needs: [pre-commit] - - steps: - - uses: actions/checkout@v3 - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.8 - - - name: Install dependencies - run: | - cat airflow_variables_dev.json | sed -e s/\\/home\\/airflow\\/gcs\\/dags\\/// > airflow_variables_ci.json - python -m pip install --upgrade pip - pip install -r requirements-ci.txt - - - name: Init Airflow SQLite database - run: airflow db init - - - name: Import Airflow variables - run: airflow variables import airflow_variables_ci.json - - - name: Authenticate to test-hubble GCP - uses: google-github-actions/auth@v1 - with: - credentials_json: "${{ secrets.CREDS_TEST_HUBBLE }}" - - - id: "get-credentials" - uses: "google-github-actions/get-gke-credentials@v2" - with: - cluster_name: "us-central1-test-hubble-43c3e190-gke" - location: "us-central1" - - - name: Pytest - run: pytest dags/ - - promote-to-prod: - runs-on: ubuntu-latest - # deploy only occurs when pr is merged - if: github.event.pull_request.merged == true - permissions: - pull-requests: write - - steps: - - uses: actions/checkout@v3 - - - name: Create pull request - run: > - gh pr create - --base release - --head master - --title "[PRODUCTION] Update production Airflow environment" - --body "This PR was auto-generated by GitHub Actions. - - After merged and closed, this PR will trigger an action that updates DAGs, libs and schemas files from prod Airflow." - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ca8e567a..7df35645 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -20,6 +20,26 @@ jobs: - name: Display Environment Name run: echo "Hello ${{ inputs.envName }}" + pre-commit: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + + - id: file_changes + uses: trilom/file-changes-action@v1.2.4 + with: + output: " " + + - uses: pre-commit/action@v3.0.0 + env: + extra_args: --color=always --files ${{ steps.file_changes.outputs.files}} + tests: runs-on: ubuntu-latest