ci: restructure workflows to quality/test/luarocks pattern
Problem: CI used a single tests.yml for linting, typechecking, and testing. No conditional path filtering, no markdown format check, and a stale mirror_upstream_prs.yml and duplicate luarocks.yml existed. Solution: replace tests.yml with quality.yaml (stylua, selene, lua-typecheck, prettier with dorny/paths-filter) and test.yaml (nvim-busted, stable+nightly matrix). Update luarocks.yaml to reference quality.yaml. Delete mirror_upstream_prs.yml and duplicate luarocks.yml. Fix automation workflow sender check.
This commit is contained in:
parent
600cbaad37
commit
26eedd05de
7 changed files with 114 additions and 168 deletions
|
|
@ -8,7 +8,7 @@ jobs:
|
||||||
# issues in my "needs triage" filter.
|
# issues in my "needs triage" filter.
|
||||||
remove_question:
|
remove_question:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event.sender.login != 'stevearc'
|
if: github.event.sender.login != 'barrettruth'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions-ecosystem/action-remove-labels@v1
|
- uses: actions-ecosystem/action-remove-labels@v1
|
||||||
|
|
|
||||||
2
.github/workflows/luarocks.yaml
vendored
2
.github/workflows/luarocks.yaml
vendored
|
|
@ -7,7 +7,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
quality:
|
quality:
|
||||||
uses: ./.github/workflows/tests.yml
|
uses: ./.github/workflows/quality.yaml
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
needs: quality
|
needs: quality
|
||||||
|
|
|
||||||
21
.github/workflows/luarocks.yml
vendored
21
.github/workflows/luarocks.yml
vendored
|
|
@ -1,21 +0,0 @@
|
||||||
name: luarocks
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
tests:
|
|
||||||
uses: ./.github/workflows/tests.yml
|
|
||||||
|
|
||||||
publish:
|
|
||||||
needs: tests
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: nvim-neorocks/luarocks-tag-release@v7
|
|
||||||
env:
|
|
||||||
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
|
|
||||||
85
.github/workflows/mirror_upstream_prs.yml
vendored
85
.github/workflows/mirror_upstream_prs.yml
vendored
|
|
@ -1,85 +0,0 @@
|
||||||
name: Mirror Upstream PRs
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: "0 8 * * *"
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
issues: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
mirror:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Mirror new upstream PRs
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
script: |
|
|
||||||
const upstream = { owner: 'stevearc', repo: 'oil.nvim' };
|
|
||||||
const fork = { owner: 'barrettruth', repo: 'oil.nvim' };
|
|
||||||
|
|
||||||
const since = new Date();
|
|
||||||
since.setDate(since.getDate() - 1);
|
|
||||||
const sinceISO = since.toISOString();
|
|
||||||
|
|
||||||
const { data: prs } = await github.rest.pulls.list({
|
|
||||||
...upstream,
|
|
||||||
state: 'open',
|
|
||||||
sort: 'created',
|
|
||||||
direction: 'desc',
|
|
||||||
per_page: 30,
|
|
||||||
});
|
|
||||||
|
|
||||||
const recentPRs = prs.filter(pr => {
|
|
||||||
if (new Date(pr.created_at) < since) return false;
|
|
||||||
if (pr.user.login === 'dependabot[bot]') return false;
|
|
||||||
if (pr.user.login === 'dependabot-preview[bot]') return false;
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (recentPRs.length === 0) {
|
|
||||||
console.log('No new upstream PRs in the last 24 hours.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { data: existingIssues } = await github.rest.issues.listForRepo({
|
|
||||||
...fork,
|
|
||||||
state: 'all',
|
|
||||||
labels: 'upstream/pr',
|
|
||||||
per_page: 100,
|
|
||||||
});
|
|
||||||
|
|
||||||
const mirroredNumbers = new Set();
|
|
||||||
for (const issue of existingIssues) {
|
|
||||||
const match = issue.title.match(/^upstream#(\d+)/);
|
|
||||||
if (match) mirroredNumbers.add(parseInt(match[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const pr of recentPRs) {
|
|
||||||
if (mirroredNumbers.has(pr.number)) {
|
|
||||||
console.log(`Skipping PR #${pr.number} — already mirrored.`);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const labels = pr.labels.map(l => l.name).join(', ') || 'none';
|
|
||||||
|
|
||||||
await github.rest.issues.create({
|
|
||||||
...fork,
|
|
||||||
title: `upstream#${pr.number}: ${pr.title}`,
|
|
||||||
body: [
|
|
||||||
`Mirrored from [stevearc/oil.nvim#${pr.number}](${pr.html_url}).`,
|
|
||||||
'',
|
|
||||||
`**Author:** @${pr.user.login}`,
|
|
||||||
`**Labels:** ${labels}`,
|
|
||||||
`**Created:** ${pr.created_at}`,
|
|
||||||
'',
|
|
||||||
'---',
|
|
||||||
'',
|
|
||||||
pr.body || '*No description provided.*',
|
|
||||||
].join('\n'),
|
|
||||||
labels: ['upstream/pr'],
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(`Created issue for upstream PR #${pr.number}: ${pr.title}`);
|
|
||||||
}
|
|
||||||
90
.github/workflows/quality.yaml
vendored
Normal file
90
.github/workflows/quality.yaml
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
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/**'
|
||||||
|
- 'spec/**'
|
||||||
|
- '*.lua'
|
||||||
|
- '.luarc.json'
|
||||||
|
- '*.toml'
|
||||||
|
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: JohnnyMorganz/stylua-action@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
version: 2.1.0
|
||||||
|
args: --check lua spec
|
||||||
|
|
||||||
|
lua-lint:
|
||||||
|
name: Lua Lint Check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: changes
|
||||||
|
if: ${{ needs.changes.outputs.lua == 'true' }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Lint with Selene
|
||||||
|
uses: NTBBloodbath/selene-action@v1.0.0
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
args: --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
|
||||||
|
- name: Setup pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 8
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
- name: Install prettier
|
||||||
|
run: pnpm add -g prettier@3.1.0
|
||||||
|
- name: Check markdown formatting with prettier
|
||||||
|
run: prettier --check .
|
||||||
22
.github/workflows/test.yaml
vendored
Normal file
22
.github/workflows/test.yaml
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
name: test
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
nvim: [stable, nightly]
|
||||||
|
name: Test (Neovim ${{ matrix.nvim }})
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: nvim-neorocks/nvim-busted-action@v1
|
||||||
|
with:
|
||||||
|
nvim_version: ${{ matrix.nvim }}
|
||||||
60
.github/workflows/tests.yml
vendored
60
.github/workflows/tests.yml
vendored
|
|
@ -1,60 +0,0 @@
|
||||||
name: Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
selene:
|
|
||||||
name: Selene
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: NTBBloodbath/selene-action@v1.0.0
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
args: --display-style quiet .
|
|
||||||
|
|
||||||
stylua:
|
|
||||||
name: StyLua
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Stylua
|
|
||||||
uses: JohnnyMorganz/stylua-action@v4
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
version: v2.1.0
|
|
||||||
args: --check lua spec
|
|
||||||
|
|
||||||
typecheck:
|
|
||||||
name: typecheck
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: mrcjkb/lua-typecheck-action@v0
|
|
||||||
with:
|
|
||||||
checklevel: Warning
|
|
||||||
directories: lua
|
|
||||||
configpath: .luarc.json
|
|
||||||
|
|
||||||
run_tests:
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
nvim_version:
|
|
||||||
- stable
|
|
||||||
- nightly
|
|
||||||
|
|
||||||
name: Run tests
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: nvim-neorocks/nvim-busted-action@v1
|
|
||||||
with:
|
|
||||||
nvim_version: ${{ matrix.nvim_version }}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue