From 72e52253317d39eb5a2c79029ebddc5c920286c0 Mon Sep 17 00:00:00 2001 From: Emily Rager Date: Tue, 22 Oct 2024 15:20:51 +0200 Subject: [PATCH] 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