name: quality on: workflow_call: pull_request: branches: [main] push: branches: [main] jobs: changes: runs-on: ubuntu-latest outputs: lua: ${{ steps.changes.outputs.lua }} markdown: ${{ steps.changes.outputs.markdown }} steps: - uses: actions/checkout@v4 - uses: dorny/paths-filter@v3 id: changes with: filters: | lua: - 'lua/**' - 'plugin/**' - '*.lua' - '.luarc.json' - '*.toml' - 'vim.yaml' markdown: - '*.md' lua-format: name: Lua Format Check runs-on: ubuntu-latest needs: changes if: ${{ needs.changes.outputs.lua == 'true' }} steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v31 - run: nix develop --command stylua --check . lua-lint: name: Lua Lint Check runs-on: ubuntu-latest needs: changes if: ${{ needs.changes.outputs.lua == 'true' }} steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v31 - run: nix develop --command selene --display-style quiet . lua-typecheck: name: Lua Type Check runs-on: ubuntu-latest needs: changes if: ${{ needs.changes.outputs.lua == 'true' }} steps: - uses: actions/checkout@v4 - name: Run Lua LS Type Check uses: mrcjkb/lua-typecheck-action@v0 with: checklevel: Warning directories: lua configpath: .luarc.json markdown-format: name: Markdown Format Check runs-on: ubuntu-latest needs: changes if: ${{ needs.changes.outputs.markdown == 'true' }} steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v31 - run: nix develop --command prettier --check . mapping-sync: name: Mapping Sync Check runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Check mapping against upstream run: | curl -sL https://raw.githubusercontent.com/ya2s/nonicons/main/src/template/nonicon.json \ | jq -r 'to_entries[] | "\(.key | sub("-16$"; "")) \(.value)"' \ | sort > /tmp/upstream.txt grep -oP "^\s*\['\K[^']+(?='\]\s*=\s*\d)" lua/nonicons/mapping.lua \ | while read -r key; do val=$(grep -oP "^\s*\['${key}'\]\s*=\s*\K\d+" lua/nonicons/mapping.lua) echo "$key $val" done | sort > /tmp/local.txt if ! diff -u /tmp/local.txt /tmp/upstream.txt; then echo '' echo '::warning::mapping.lua is out of sync with ya2s/nonicons upstream' exit 1 fi