Skip to content

Commit 866f8a7

Browse files
authored
Add per-mixin workflow for linting (#1348)
* Add "lint mixins" workflow * Add workflow for linting mixins individually * Remove trailing whitespace * Add observability libs to lint path
1 parent d76b703 commit 866f8a7

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/lint-mixins.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
name: Mixin
3+
4+
permissions:
5+
contents: read
6+
7+
on:
8+
# To conserve resources we only run tests against main in PRs
9+
pull_request:
10+
branches:
11+
- master
12+
13+
jobs:
14+
check-for-changed-mixins:
15+
name: Check for changes
16+
runs-on: ubuntu-latest
17+
outputs:
18+
changed-mixins: ${{ steps.changed-mixins.outputs.all_changed_files }}
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Setup Go
26+
uses: actions/setup-go@v5
27+
with:
28+
go-version: 1.18
29+
30+
- name: Install CI dependencies
31+
run: make install-ci-deps
32+
33+
- name: Get changed mixins
34+
id: changed-mixins
35+
uses: tj-actions/changed-files@v44
36+
with:
37+
dir_names: true
38+
dir_names_exclude_current_dir: true
39+
dir_names_max_depth: 1
40+
files: |
41+
**-mixin/
42+
**-observ-lib/
43+
matrix: true
44+
45+
- name: List all changed mixins
46+
run: echo '${{ steps.changed-mixins.outputs.all_changed_files }}'
47+
48+
lint-mixin:
49+
name: Run Mixtool
50+
runs-on: ubuntu-latest
51+
permissions:
52+
issues: write
53+
contents: write
54+
pull-requests: write
55+
repository-projects: write
56+
timeout-minutes: 15
57+
needs: [check-for-changed-mixins]
58+
strategy:
59+
matrix:
60+
mixin: ${{ fromJSON(needs.check-for-changed-mixins.outputs.changed-mixins) }}
61+
fail-fast: false
62+
steps:
63+
- name: Checkout
64+
uses: actions/checkout@v4
65+
with:
66+
fetch-depth: 0
67+
68+
- name: Setup Go
69+
uses: actions/setup-go@v5
70+
with:
71+
go-version: 1.18
72+
73+
- name: Install CI dependencies
74+
run: make install-ci-deps
75+
76+
- name: Install Mixin dependencies
77+
working-directory: ./${{ matrix.mixin }}
78+
run: jb install
79+
80+
- name: Lint Mixin
81+
working-directory: ./${{ matrix.mixin }}
82+
run: mixtool lint mixin.libsonnet

0 commit comments

Comments
 (0)