From a03e7ddd1f2db059106dc260584f8e0bb2585099 Mon Sep 17 00:00:00 2001 From: ailepet Date: Tue, 26 Nov 2024 10:33:51 +0100 Subject: [PATCH] feat: add Montpellier project + fix Colombes preprod CI file --- .../colombes_models_run_preproduction.yml | 2 +- .github/workflows/montpellier_models_run.yml | 44 ++++++++++++++++++ .../montpellier_models_run_preproduction.yml | 46 +++++++++++++++++++ projects/montpellier/.gitignore | 4 ++ projects/montpellier/README.md | 15 ++++++ projects/montpellier/analyses/.gitkeep | 0 projects/montpellier/config.yml | 3 ++ projects/montpellier/dbt_project.yml | 34 ++++++++++++++ projects/montpellier/macros/.gitkeep | 0 projects/montpellier/packages.yml | 4 ++ projects/montpellier/profiles.yml | 31 +++++++++++++ projects/montpellier/requirements.txt | 2 + projects/montpellier/seeds/.gitkeep | 0 projects/montpellier/snapshots/.gitkeep | 0 projects/montpellier/tests/.gitkeep | 0 15 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/montpellier_models_run.yml create mode 100644 .github/workflows/montpellier_models_run_preproduction.yml create mode 100644 projects/montpellier/.gitignore create mode 100644 projects/montpellier/README.md create mode 100644 projects/montpellier/analyses/.gitkeep create mode 100644 projects/montpellier/config.yml create mode 100644 projects/montpellier/dbt_project.yml create mode 100644 projects/montpellier/macros/.gitkeep create mode 100644 projects/montpellier/packages.yml create mode 100644 projects/montpellier/profiles.yml create mode 100644 projects/montpellier/requirements.txt create mode 100644 projects/montpellier/seeds/.gitkeep create mode 100644 projects/montpellier/snapshots/.gitkeep create mode 100644 projects/montpellier/tests/.gitkeep diff --git a/.github/workflows/colombes_models_run_preproduction.yml b/.github/workflows/colombes_models_run_preproduction.yml index 8407463b..b7a1c259 100644 --- a/.github/workflows/colombes_models_run_preproduction.yml +++ b/.github/workflows/colombes_models_run_preproduction.yml @@ -15,7 +15,7 @@ env: jobs: - COLOMBES_models_run: + colombes_models_run: name: colombes_models_run_preproduction runs-on: ubuntu-latest defaults: diff --git a/.github/workflows/montpellier_models_run.yml b/.github/workflows/montpellier_models_run.yml new file mode 100644 index 00000000..d5106592 --- /dev/null +++ b/.github/workflows/montpellier_models_run.yml @@ -0,0 +1,44 @@ +name: montpellier_models_run + +on: + workflow_dispatch: + +env: + DBNAME: ${{ secrets.MONTPELLIER_DBNAME_PROD }} + HOST: ${{ secrets.HOST }} + PASSWORD: ${{ secrets.PASSWORD }} + PORT: ${{ secrets.PORT }} + TARGET_SCHEMA: ${{ secrets.SCHEMA_PROD }} + USER: ${{ secrets.USER }} + PARTICIPATION_HOST_NAME: ${{ secrets.MONTPELLIER_PARTICIPATION_HOST_NAME }} + WORKING_DIRECTORY: ./projects/montpellier + + +jobs: + montpellier_models_run: + name: montpellier_models_run + runs-on: ubuntu-latest + defaults: + run: + working-directory: ${{ env.WORKING_DIRECTORY }} + + steps: + - name: Check out + uses: actions/checkout@master + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.12.x" + cache: 'pip' + + - name: Install dependencies + run: | + pip install -r requirements.txt + dbt deps --target prod + + - name: Run dbt models + run: dbt run --target prod + + - name: Test dbt models + run: dbt test --target prod \ No newline at end of file diff --git a/.github/workflows/montpellier_models_run_preproduction.yml b/.github/workflows/montpellier_models_run_preproduction.yml new file mode 100644 index 00000000..127b8144 --- /dev/null +++ b/.github/workflows/montpellier_models_run_preproduction.yml @@ -0,0 +1,46 @@ +name: montpellier_models_run_preproduction + +on: + workflow_dispatch: + +env: + DBNAME: ${{ secrets.MONTPELLIER_DBNAME_PROD }} + HOST_PREPROD: ${{ secrets.HOST_PREPROD }} + PASSWORD_PREPROD: ${{ secrets.PASSWORD_PREPROD }} + PORT_PREPROD: ${{ secrets.PORT_PREPROD }} + TARGET_SCHEMA: ${{ secrets.SCHEMA_PROD }} + USER_PREPROD: ${{ secrets.USER_PREPROD }} + PARTICIPATION_HOST_NAME: ${{ secrets.MONTPELLIER_PARTICIPATION_HOST_NAME }} + WORKING_DIRECTORY: ./projects/montpellier + + +jobs: + montpellier_models_run: + name: montpellier_models_run_preproduction + runs-on: ubuntu-latest + defaults: + run: + working-directory: ${{ env.WORKING_DIRECTORY }} + + steps: + - name: Check out + uses: actions/checkout@master + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.12.x" + cache: 'pip' + + - name: Install dependencies + run: | + pip install -r requirements.txt + dbt deps --target preprod + + - name: Run dbt models + run: dbt run --target preprod + + - name: Test dbt models + run: dbt test --target preprod + + diff --git a/projects/montpellier/.gitignore b/projects/montpellier/.gitignore new file mode 100644 index 00000000..49f147cb --- /dev/null +++ b/projects/montpellier/.gitignore @@ -0,0 +1,4 @@ + +target/ +dbt_packages/ +logs/ diff --git a/projects/montpellier/README.md b/projects/montpellier/README.md new file mode 100644 index 00000000..7874ac84 --- /dev/null +++ b/projects/montpellier/README.md @@ -0,0 +1,15 @@ +Welcome to your new dbt project! + +### Using the starter project + +Try running the following commands: +- dbt run +- dbt test + + +### Resources: +- Learn more about dbt [in the docs](https://docs.getdbt.com/docs/introduction) +- Check out [Discourse](https://discourse.getdbt.com/) for commonly asked questions and answers +- Join the [chat](https://community.getdbt.com/) on Slack for live discussions and support +- Find [dbt events](https://events.getdbt.com) near you +- Check out [the blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices diff --git a/projects/montpellier/analyses/.gitkeep b/projects/montpellier/analyses/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/projects/montpellier/config.yml b/projects/montpellier/config.yml new file mode 100644 index 00000000..a6cc60f2 --- /dev/null +++ b/projects/montpellier/config.yml @@ -0,0 +1,3 @@ +db_name_dev: MONTPELLIER_DBNAME_DEV +db_name_prod: MONTPELLIER_DBNAME_PROD +participation_host_name: MONTPELLIER_PARTICIPATION_HOST_NAME \ No newline at end of file diff --git a/projects/montpellier/dbt_project.yml b/projects/montpellier/dbt_project.yml new file mode 100644 index 00000000..f541a690 --- /dev/null +++ b/projects/montpellier/dbt_project.yml @@ -0,0 +1,34 @@ + +# Name your project! Project names should contain only lowercase characters +# and underscores. A good package name should reflect your organization's +# name or the intended use of these models +name: 'montpellier' +version: '1.0.0' + +# This setting configures which "profile" dbt uses for this project. +profile: 'montpellier' + +# These configurations specify where dbt should look for different types of files. +# The `model-paths` config, for example, states that models in this project can be +# found in the "models/" directory. You probably won't need to change these! +model-paths: ["models"] +analysis-paths: ["analyses"] +test-paths: ["tests"] +seed-paths: ["seeds"] +macro-paths: ["macros"] +snapshot-paths: ["snapshots"] + +clean-targets: # directories to be removed by `dbt clean` + - "target" + - "dbt_packages" + + +# Configuring models +# Full documentation: https://docs.getdbt.com/docs/configuring-models + +# In this example config, we tell dbt to build all models in the example/ +# directory as views. These settings can be overridden in the individual model +# files using the `{{ config(...) }}` macro. +models: + montpellier: + +materialized: table diff --git a/projects/montpellier/macros/.gitkeep b/projects/montpellier/macros/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/projects/montpellier/packages.yml b/projects/montpellier/packages.yml new file mode 100644 index 00000000..f46b0908 --- /dev/null +++ b/projects/montpellier/packages.yml @@ -0,0 +1,4 @@ +packages: + - local: ../demo + - package: dbt-labs/dbt_utils + version: 1.2.0 \ No newline at end of file diff --git a/projects/montpellier/profiles.yml b/projects/montpellier/profiles.yml new file mode 100644 index 00000000..c879b502 --- /dev/null +++ b/projects/montpellier/profiles.yml @@ -0,0 +1,31 @@ +montpellier: + target: preprod + outputs: + dev: + dbname: "{{ env_var('DBNAME') }}" + host: "{{ env_var('HOST') }}" + pass: "{{ env_var('PASSWORD') }}" + port: "{{ env_var('PORT') | as_number }}" + schema: "{{ env_var('TARGET_SCHEMA') }}" + threads: 2 + type: postgres + user: "{{ env_var('USER') }}" + preprod: + dbname: "{{ env_var('DBNAME') }}" + host: "{{ env_var('HOST_PREPROD') }}" + pass: "{{ env_var('PASSWORD_PREPROD') }}" + port: "{{ env_var('PORT_PREPROD') | as_number }}" + schema: "{{ env_var('TARGET_SCHEMA') }}" + threads: 2 + type: postgres + user: "{{ env_var('USER_PREPROD') }}" + prod: + dbname: "{{ env_var('DBNAME') }}" + host: "{{ env_var('HOST') }}" + pass: "{{ env_var('PASSWORD') }}" + port: "{{ env_var('PORT') | as_number }}" + schema: "{{ env_var('TARGET_SCHEMA') }}" + threads: 2 + type: postgres + user: "{{ env_var('USER') }}" + diff --git a/projects/montpellier/requirements.txt b/projects/montpellier/requirements.txt new file mode 100644 index 00000000..576228e4 --- /dev/null +++ b/projects/montpellier/requirements.txt @@ -0,0 +1,2 @@ +dbt-postgres==1.8.2 +dbt-core==1.8.2 \ No newline at end of file diff --git a/projects/montpellier/seeds/.gitkeep b/projects/montpellier/seeds/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/projects/montpellier/snapshots/.gitkeep b/projects/montpellier/snapshots/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/projects/montpellier/tests/.gitkeep b/projects/montpellier/tests/.gitkeep new file mode 100644 index 00000000..e69de29b