|
1 | | -# We want to run CI processes that can run independent of databricks as branch rules so that we dont # deploy at cost code that we already should know needs changing |
2 | | -# such as linting, and unit test for python, maybe dab? verify |
3 | | -# we run these on all pull request because if there is a hot fix it may not have passed through |
4 | | -# staging for example |
5 | | -# qqqq check this is up to date |
6 | 1 | name: CI - Pull Request Checks |
7 | 2 |
|
8 | | -# Run CI on all pull requests |
| 3 | +# Run CI on all pull requests just incase of hot fixes |
9 | 4 | on: |
10 | 5 | pull_request: |
11 | 6 | branches: |
12 | 7 | - '**' # all branches |
| 8 | + workflow_dispatch: |
13 | 9 |
|
14 | 10 | jobs: |
15 | | - ci_checks: |
16 | | - name: "Linting, Unit Tests, DAB Verify" |
| 11 | + lint: |
| 12 | + name: "Linting" |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout code |
| 16 | + uses: actions/checkout@v3 |
| 17 | + |
| 18 | + - name: Commit lint placeholder |
| 19 | + # TODO: Implement commitlint with config from TELBlazor reference |
| 20 | + run: | |
| 21 | + echo "WARNING: Commit lint step is currently a placeholder." |
| 22 | + echo "Reference project: TELBlazor" |
| 23 | + # exit 0 <-- Change to 0 if you don't want to block the rest of the pipe yet |
| 24 | + |
| 25 | + pytest: |
17 | 26 | runs-on: ubuntu-latest |
18 | 27 |
|
19 | 28 | steps: |
20 | | - # Checkout code |
21 | | - - name: Checkout repository |
| 29 | + - name: Check out repository |
22 | 30 | uses: actions/checkout@v4 |
23 | 31 |
|
24 | | - # Set up Python |
25 | | - - name: Setup Python |
| 32 | + - name: Set up Python |
26 | 33 | uses: actions/setup-python@v5 |
27 | 34 | with: |
28 | | - python-version: "3.x" |
29 | | - |
30 | | - # Install dependencies used for linting and unit tests |
31 | | - - name: Install dependencies |
32 | | - run: pip install -r requirements-dev.txt |
33 | | - |
34 | | - # Run python unit tests |
35 | | - - name: Run Unit Tests |
36 | | - run: pytest tests/unit |
37 | | - |
38 | | - # Run python lint |
39 | | - # qqqq on example used flake8 instead |
40 | | - # pyproject.toml will need configuring |
41 | | - - name: Run Linting |
42 | | - run: pylint src |
43 | | - |
44 | | - # qqqq to do run commit lint step and put in commit lint config |
45 | | - # see TELBlazor |
46 | | - - name: Commit lint |
47 | | - run: | |
48 | | - echo "Commit lint not implemented" |
49 | | - exit 1 |
50 | | - |
51 | | - # qqqq to do run version generation step and put in commit lint config |
52 | | - # see TELBlazor |
53 | | - - name: Version Generation Test Run |
54 | | - run: | |
55 | | - echo "Version test run not implemented" |
56 | | - exit 1 |
| 35 | + python-version: "3.10" |
| 36 | + |
| 37 | + - name: Upgrade pip |
| 38 | + run: python -m pip install --upgrade pip |
| 39 | + |
| 40 | + - name: Install project + test deps |
| 41 | + run: | |
| 42 | + pip install -r requirements-dev.txt |
| 43 | + pip install -e . |
| 44 | + - name: Run pytest againt unit tests (exclude Databricks tests) |
| 45 | + run: | |
| 46 | + pytest tests/unit-tests -m "not databricks" -v |
| 47 | + |
| 48 | + dab-validate: |
| 49 | + name: "Early warning of dab issues" |
| 50 | + runs-on: ubuntu-latest |
| 51 | + # Just dev we are not deploying so dont need access to more important service principle |
| 52 | + # !!!! TODO !!!!! Should be dev but git needs the service principle putting into its environment |
| 53 | + environment: staging |
| 54 | + env: |
| 55 | + DATABRICKS_HOST: ${{ vars.DBX_HOST }} |
| 56 | + DATABRICKS_CLIENT_ID: ${{ vars.DBX_SP_ID }} |
| 57 | + DATABRICKS_CLIENT_SECRET: ${{ secrets.DBX_SP_SECRET }} |
| 58 | + |
| 59 | + steps: |
| 60 | + - name: Checkout code |
| 61 | + uses: actions/checkout@v4 |
| 62 | + |
| 63 | + - name: Set up Databricks CLI |
| 64 | + uses: databricks/setup-cli@main |
| 65 | + |
| 66 | + - name: Validate Bundle |
| 67 | + # Am i forced to have a target its after databrickcfg but shouldnt be |
| 68 | + run: databricks bundle validate -t staging |
0 commit comments