Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version all the files, update CI tests and vscode settings #77

Merged
merged 15 commits into from
Jun 29, 2023
Merged
48 changes: 11 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ jobs:
- name: validate all schema files
run: find ./schemas -name "*.json" | xargs -n 1 -I {} npx ajv-cli compile -s {} --strict=false
test-against-sample-dbt-files:
strategy:
matrix:
dbt-version: ["1.5", "1.6"]
dbt-file-name: ["dbt_project", "packages", "selectors", "dbt_yml_files", "dependencies"]
exclude:
- dbt-version: "1.5"
dbt-file-name: "dependencies"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -25,44 +32,11 @@ jobs:
node-version: 16
- name: install avj
run: npm install --no-save ajv-cli@5.0.0
- name: Validate dbt_project.yml sample files for dbt version 1.5
- name: Validate dbt_project.yml sample files for dbt version ${{ matrix.dbt-version }}
run: |
npx ajv-cli test -s schemas/dbt_project-1.5.json -d tests/1.5/valid/dbt_project.yml --valid
npx ajv-cli test -s schemas/dbt_project-1.5.json -d tests/1.5/invalid/dbt_project.yml --invalid
- name: Validate resource yml sample files for dbt version 1.5
run: |
npx ajv-cli test -s schemas/dbt_yml_files-1.5.json -d tests/1.5/valid/schema.yml --valid
npx ajv-cli test -s schemas/dbt_yml_files-1.5.json -d tests/1.5/invalid/schema.yml --invalid
- name: Validate packages.yml sample files for dbt version 1.5
run: |
npx ajv-cli test -s schemas/packages-1.5.json -d tests/1.5/valid/packages.yml --valid
npx ajv-cli test -s schemas/packages-1.5.json -d tests/1.5/invalid/packages.yml --invalid
- name: Validate selectors.yml sample files for dbt version 1.5
run: |
npx ajv-cli test -s schemas/selectors-1.5.json -d tests/1.5/valid/selectors.yml --valid
npx ajv-cli test -s schemas/selectors-1.5.json -d tests/1.5/invalid/selectors.yml --invalid

- name: Validate dbt_project.yml sample files for dbt version 1.6
run: |
npx ajv-cli test -s schemas/dbt_project-1.6.json -d tests/1.6/valid/dbt_project.yml --valid
npx ajv-cli test -s schemas/dbt_project-1.6.json -d tests/1.6/invalid/dbt_project.yml --invalid
- name: Validate resource yml sample files for dbt version 1.6
run: |
npx ajv-cli test -s schemas/dbt_yml_files-1.6.json -d tests/1.6/valid/schema.yml --valid
npx ajv-cli test -s schemas/dbt_yml_files-1.6.json -d tests/1.6/invalid/schema.yml --invalid
- name: Validate packages.yml sample files for dbt version 1.6
run: |
npx ajv-cli test -s schemas/packages-1.6.json -d tests/1.6/valid/packages.yml --valid
npx ajv-cli test -s schemas/packages-1.6.json -d tests/1.6/invalid/packages.yml --invalid
- name: Validate selectors.yml sample files for dbt version 1.6
run: |
npx ajv-cli test -s schemas/selectors-1.6.json -d tests/1.6/valid/selectors.yml --valid
npx ajv-cli test -s schemas/selectors-1.6.json -d tests/1.6/invalid/selectors.yml --invalid

- name: Validate dependencies.yml sample files for dbt version 1.6
run: |
npx ajv-cli test -s schemas/dependencies-1.6.json -d tests/1.6/valid/dependencies.yml --valid
npx ajv-cli test -s schemas/dependencies-1.6.json -d tests/1.6/invalid/dependencies.yml --invalid
npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/${{ matrix.dbt-file-name }}-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/valid/${{ matrix.dbt-file-name }}.yml --valid
npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/${{ matrix.dbt-file-name }}-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/invalid/${{ matrix.dbt-file-name }}.yml --invalid

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:chefs-kiss:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shreks-kick:


validate_plusless_properties:
runs-on: ubuntu-latest
Expand Down
18 changes: 9 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"yaml.schemas": {
"./schemas/dbt_yml_files-1.5.json": [
"./schemas/1.5/dbt_yml_files-1.5.json": [
"/tests/1.5/**/*.yml",
"!profiles.yml",
"!dbt_project.yml",
Expand All @@ -9,17 +9,17 @@
"!profile_template.yml",
"!/.github/**/*.yml"
],
"./schemas/dbt_project-1.5.json": [
"./schemas/1.5/dbt_project-1.5.json": [
"/tests/1.5/**/dbt_project.yml"
],
"./schemas/selectors-1.5.json": [
"./schemas/1.5/selectors-1.5.json": [
"/tests/1.5/**/selectors.yml"
],
"./schemas/packages-1.5.json": [
"./schemas/1.5/packages-1.5.json": [
"/tests/1.5/**/packages.yml"

],
"./schemas/dbt_yml_files-1.6.json": [
"./schemas/1.6/dbt_yml_files-1.6.json": [
"/tests/1.6/**/*.yml",
"!profiles.yml",
"!dbt_project.yml",
Expand All @@ -29,16 +29,16 @@
"!profile_template.yml",
"!/.github/**/*.yml"
],
"./schemas/dbt_project-1.6.json": [
"./schemas/1.6/dbt_project-1.6.json": [
"/tests/1.6/**/dbt_project.yml"
],
"./schemas/selectors-1.6.json": [
"./schemas/1.6/selectors-1.6.json": [
"/tests/1.6/**/selectors.yml"
],
"./schemas/packages-1.6.json": [
"./schemas/1.6/packages-1.6.json": [
"/tests/1.6/**/packages.yml"
],
"./schemas/dependencies-1.6.json": [
"./schemas/1.6/dependencies-1.6.json": [
"/tests/1.6/**/dependencies.yml"
]

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions tests/validate_plusless_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from jsondiff import diff

PROJECT_SCHEMA_FILES = [
"./schemas/dbt_project.json",
"./schemas/dbt_project-1.5.json",
"./schemas/dbt_project-1.6.json"
"./schemas/default/dbt_project.json",
"./schemas/1.5/dbt_project-1.5.json",
"./schemas/1.6/dbt_project-1.6.json"
]

def check_equivalency(key, node_type, node_properties):
Expand Down