Merge pull request #107 from headlamp-k8s/publish-flux-plugin #425
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: Headlamp plugin linting, type checking, and testing | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
HEADLAMP_PLUGIN_VERSION: latest | |
jobs: | |
# Get list of folders containing headlamp plugins | |
# We need a separate step to be able to pass the list to the matrix of the build job | |
find_plugin_dirs: | |
runs-on: ubuntu-latest | |
outputs: | |
dirs: ${{ steps.dirs.outputs.dirs }} | |
steps: | |
- uses: actions/checkout@v2 | |
- id: dirs | |
run: echo "dirs=$(grep -m1 -lR @kinvolk/headlamp-plugin ./*/package.json | xargs -n1 dirname | jq --raw-input --slurp --compact-output 'split("\n")[:-1]')" >> ${GITHUB_OUTPUT} | |
build: | |
needs: find_plugin_dirs | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./ | |
strategy: | |
matrix: | |
node-version: [18.x] | |
dir: ${{ fromJson(needs.find_plugin_dirs.outputs.dirs) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: | | |
echo "Checking ${{ matrix.dir }} plugin" | |
npx @kinvolk/headlamp-plugin@$HEADLAMP_PLUGIN_VERSION format --check ${{ matrix.dir }} | |
npx @kinvolk/headlamp-plugin@$HEADLAMP_PLUGIN_VERSION lint ${{ matrix.dir }} | |
npx @kinvolk/headlamp-plugin@$HEADLAMP_PLUGIN_VERSION build ${{ matrix.dir }} | |
npx @kinvolk/headlamp-plugin@$HEADLAMP_PLUGIN_VERSION test ${{ matrix.dir }} | |
npx @kinvolk/headlamp-plugin@$HEADLAMP_PLUGIN_VERSION tsc ${{ matrix.dir }} |