Skip to content

Commit

Permalink
ci: add gen-rockspec.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Mar 14, 2024
1 parent 73e3405 commit bcd6700
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/gen-rockspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Generate rockspec

on:
push:
schedule:
# Runs every 24 hours, after the rocks-binaries job
- cron: "0/45 */24 * * *"
workflow_dispatch:

# Prevent concurrent auto-commits
concurrency:
group: auto-commit
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Install C/C++ Compiler
uses: rlalik/setup-cpp-compiler@master
with:
compiler: clang-latest
- name: Install Lua
uses: leso-kn/gh-actions-lua@master
with:
luaVersion: "5.1"
- name: Install Luarocks
uses: hishamhm/gh-actions-luarocks@master
- name: Get tree-sitter-parsers.json
uses: actions/checkout@v4
with:
repository: nvim-neorocks/nurr
sparse-checkout: |
tree-sitter-parsers.json
path: nurr
- name: Install Neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: nightly
- name: Generate rockspec
run: |
mv nurr/tree-sitter-parsers.json .
./gen-rockspec.lua
- name: commit-linux-x86_64
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: generate rockspec"
file_pattern: "*.rockspec"
4 changes: 3 additions & 1 deletion gen-rockspec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ local parsers_tbl = vim.iter(vim.json.decode(content).parsers)
local sc = vim.system({
"luarocks",
"--lua-version=5.1",
"--only_server='https://nvim-neorocks.github.io/rocks-binaries/'",
"--only-server='https://nvim-neorocks.github.io/rocks-binaries/'",
"search",
"--porcelain",
rock_name,
}):wait()
if sc.code ~= 0 or not sc.stdout then
print(sc.stdout or "")
print(sc.stderr or "")
error("Failed to search rocks-binaries")
end
for line in sc.stdout:gmatch("[^\r\n]+") do
Expand Down

0 comments on commit bcd6700

Please sign in to comment.