Add per-mixin workflow for linting #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Mixin | |
permissions: | |
contents: read | |
on: | |
# To conserve resources we only run tests against main in PRs | |
pull_request: | |
branches: | |
- master | |
jobs: | |
check-for-changed-mixins: | |
name: Check for changes | |
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 }}' | |
lint-mixin: | |
name: Lint Mixin | |
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 | |