Skip to content

Commit 6604526

Browse files
authored
Merge pull request #63 from tinybirdco/force-fmt
add fmt step
2 parents 2877be2 + e4f9e25 commit 6604526

File tree

2 files changed

+52
-6
lines changed

2 files changed

+52
-6
lines changed

.github/workflows/ci.yml

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,54 @@ on:
1616
required: true
1717

1818
jobs:
19+
check:
20+
name: Datafiles checks
21+
runs-on: ubuntu-latest
22+
if: ${{ github.event.action != 'closed' }}
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Install Tinybird CLI
30+
run: |
31+
if [ -f "${{ inputs.data_project_dir }}/requirements.txt" ]; then
32+
pip install -r ${{ inputs.data_project_dir }}/requirements.txt
33+
else
34+
pip install tinybird-cli
35+
fi
36+
37+
- name: Get changed files
38+
id: files
39+
uses: tj-actions/changed-files@v42
40+
with:
41+
files: |
42+
**/*.{datasource,incl,pipe}
43+
44+
- name: Check all the files
45+
if: ${{ steps.files.outputs.any_changed == 'true' }}
46+
shell: bash
47+
run: |
48+
for file in ${{ steps.files.outputs.all_changed_files }}; do
49+
if [[ $file != *.incl ]]; then
50+
tb check "$file"
51+
fi
52+
done
53+
54+
- name: Check formatting
55+
if: ${{ steps.files.outputs.any_changed == 'true' }}
56+
shell: bash
57+
run: |
58+
for file in ${{ steps.files.outputs.all_changed_files }}; do
59+
tb fmt --diff "$file"
60+
done
61+
1962
deploy:
2063
name: Deploy to CI Branch
2164
runs-on: ubuntu-latest
65+
needs:
66+
- check
2267
defaults:
2368
run:
2469
working-directory: ${{ inputs.data_project_dir }}
@@ -49,7 +94,6 @@ jobs:
4994
grep -v '^#' .tinyenv >> $GITHUB_ENV
5095
echo >> $GITHUB_ENV # Ensures new line at the end of the file
5196
52-
5397
- name: Install Tinybird CLI
5498
run: |
5599
if [ -f "requirements.txt" ]; then
@@ -61,9 +105,6 @@ jobs:
61105
- name: Tinybird version
62106
run: tb --version
63107

64-
- name: Check all the data files syntax
65-
run: tb check
66-
67108
- name: Check auth
68109
run: tb --host ${{ secrets.tb_host }} --token ${{ secrets.tb_admin_token }} auth info
69110

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
Next Release (v3.0.0)
2-
=====================
1+
v3.1.0
2+
========
3+
4+
- Add new `check` job in GitHub Actions. It checks syntax and forces format Datafiles so there are no mismatches in the project when working from the UI and git.
5+
6+
v3.0.0
7+
========
38

49
- Add `CI_FLAGS` and `CD_FLAGS` env vars to `tb deploy`, they can be defined per Data Project and PR via `.tinyenv`
510
- Update rollback job to include the `--yes` flag to `tb release rollback`

0 commit comments

Comments
 (0)