From c09b64bfc38e123346785d1cff8326953cf40cf4 Mon Sep 17 00:00:00 2001 From: Emily Rager Date: Tue, 22 Oct 2024 14:34:20 +0200 Subject: [PATCH 1/4] Add "lint mixins" workflow --- .github/workflows/lint-mixins.yml | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/lint-mixins.yml diff --git a/.github/workflows/lint-mixins.yml b/.github/workflows/lint-mixins.yml new file mode 100644 index 000000000..6723d619f --- /dev/null +++ b/.github/workflows/lint-mixins.yml @@ -0,0 +1,44 @@ +--- +name: "Lint Mixins" + +permissions: + contents: read + +on: + # To conserve resources we only run tests against main in PRs + pull_request: + branches: + - main + +jobs: + check-for-changed-mixins: + name: Check for changed mixins + runs-on: ubuntu-latest + outputs: + changed-mixins: ${{ steps.changed-mixins.outputs.all_changed_files }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: 1.18 + + - name: Install CI dependencies + run: make install-ci-deps + + - name: Get changed mixins + id: changed-mixins + uses: tj-actions/changed-files@v44 + with: + dir_names: true + dir_names_exclude_current_dir: true + dir_names_max_depth: 1 + files: **-mixin/ + matrix: true + + - name: List all changed mixins: + run: echo '${{ steps.changed-mixins.outputs.all_changed_files }}' From 72e52253317d39eb5a2c79029ebddc5c920286c0 Mon Sep 17 00:00:00 2001 From: Emily Rager Date: Tue, 22 Oct 2024 15:20:51 +0200 Subject: [PATCH 2/4] Add workflow for linting mixins individually --- .github/workflows/lint-mixins.yml | 49 +++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint-mixins.yml b/.github/workflows/lint-mixins.yml index 6723d619f..febd76384 100644 --- a/.github/workflows/lint-mixins.yml +++ b/.github/workflows/lint-mixins.yml @@ -1,5 +1,5 @@ --- -name: "Lint Mixins" +name: Mixin permissions: contents: read @@ -8,11 +8,11 @@ on: # To conserve resources we only run tests against main in PRs pull_request: branches: - - main + - master jobs: check-for-changed-mixins: - name: Check for changed mixins + name: Check for changes runs-on: ubuntu-latest outputs: changed-mixins: ${{ steps.changed-mixins.outputs.all_changed_files }} @@ -37,8 +37,47 @@ jobs: dir_names: true dir_names_exclude_current_dir: true dir_names_max_depth: 1 - files: **-mixin/ + files: | + **-mixin/ matrix: true - - name: List all changed mixins: + - name: List all changed mixins run: echo '${{ steps.changed-mixins.outputs.all_changed_files }}' + + lint-mixin: + name: Run Mixtool + runs-on: ubuntu-latest + permissions: + issues: write + contents: write + pull-requests: write + repository-projects: write + timeout-minutes: 15 + needs: [check-for-changed-mixins] + strategy: + matrix: + mixin: ${{ fromJSON(needs.check-for-changed-mixins.outputs.changed-mixins) }} + fail-fast: false + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: 1.18 + + - name: Install CI dependencies + run: make install-ci-deps + + - name: Install Mixin dependencies + working-directory: ./${{ matrix.mixin }} + run: jb install + + - name: Lint Mixin + working-directory: ./${{ matrix.mixin }} + run: mixtool lint mixin.libsonnet + + \ No newline at end of file From a11777eb31f9e202d5f3e73f895afcf6f9ac04f7 Mon Sep 17 00:00:00 2001 From: Emily Rager Date: Tue, 22 Oct 2024 15:28:23 +0200 Subject: [PATCH 3/4] Remove trailing whitespace --- .github/workflows/lint-mixins.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/lint-mixins.yml b/.github/workflows/lint-mixins.yml index febd76384..c9a62b026 100644 --- a/.github/workflows/lint-mixins.yml +++ b/.github/workflows/lint-mixins.yml @@ -79,5 +79,3 @@ jobs: - name: Lint Mixin working-directory: ./${{ matrix.mixin }} run: mixtool lint mixin.libsonnet - - \ No newline at end of file From cdda7c98b8d476f0642793f177937059bfe4f3e1 Mon Sep 17 00:00:00 2001 From: Emily Rager Date: Tue, 22 Oct 2024 15:57:06 +0200 Subject: [PATCH 4/4] Add observability libs to lint path --- .github/workflows/lint-mixins.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint-mixins.yml b/.github/workflows/lint-mixins.yml index c9a62b026..ae6ad24f7 100644 --- a/.github/workflows/lint-mixins.yml +++ b/.github/workflows/lint-mixins.yml @@ -39,6 +39,7 @@ jobs: dir_names_max_depth: 1 files: | **-mixin/ + **-observ-lib/ matrix: true - name: List all changed mixins