Skip to content

Commit

Permalink
chore: prepare for packaging tree-sitter parser releases
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Jul 18, 2024
1 parent 1a8216a commit 186f7bd
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 91 deletions.
37 changes: 17 additions & 20 deletions .github/workflows/build-linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,26 +87,23 @@ jobs:
run: |
luarocks --verbose --local --lua-version=5.1 install tree-sitter-norg-meta
luarocks --verbose pack tree-sitter-norg-meta
# - name: Install `luarocks-build-treesitter-parser` Package
# run: |
# luarocks --verbose --local --lua-version=5.1 install luarocks-build-treesitter-parser
# - 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 tree-sitter parsers
# run: |
# # Filter out parsers that need their sources generated
# # We might want to consider adding those too
# langs=$(jq -r '.parsers[] | select((.install_info.requires_generate_from_grammar // false) == false) | .lang' nurr/tree-sitter-parsers.json)
# for lang in $langs; do
# rm "tree-sitter-$lang-scm-1.linux-x86_64.rock" || true
# luarocks --local --lua-version=5.1 install "tree-sitter-$lang" \
# && luarocks pack "tree-sitter-$lang" || echo "Failed to pack tree-sitter-$lang"
# done
- 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 tree-sitter parsers
run: |
# Filter out parsers that need their sources generated
# We might want to consider adding those too
langs=$(jq -r '.parsers[] | select((.install_info.requires_generate_from_grammar // false) == false) | .lang' nurr/tree-sitter-parsers.json)
for lang in $langs; do
luarocks --local --lua-version=5.1 install "tree-sitter-$lang" \
&& luarocks pack "tree-sitter-$lang" \
|| echo "tree-sitter-$lang has not been packaged yet"
done
- name: Regenerate Manifests and HTML
run: luarocks-admin make-manifest --lua-version=5.1 .
- name: commit-linux-x86_64
Expand Down
49 changes: 23 additions & 26 deletions .github/workflows/build-macosx-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ jobs:
luaVersion: "5.1"
- name: Install Luarocks
uses: hishamhm/gh-actions-luarocks@master

- name: Configure architecture
run: |
mkdir -p /Users/runner/.luarocks
luarocks --verbose --local config arch macosx-aarch64
- uses: rhysd/action-setup-vim@v1
with:
neovim: true
Expand All @@ -50,8 +56,6 @@ jobs:
- name: Print environment
run: |
printenv
- name: "[HACK: luarocks/#1630] backup x86_64 packages"
run: for f in *.macosx-x86_64.rock; do mv "$f" "$f.bak"; done
- name: Install `LuaFileSystem` Package
run: |
luarocks --verbose --local --lua-version=5.1 install luafilesystem
Expand Down Expand Up @@ -94,30 +98,23 @@ jobs:
run: |
luarocks --verbose --local --lua-version=5.1 install tree-sitter-norg-meta
luarocks --verbose pack tree-sitter-norg-meta
# - name: Install `luarocks-build-treesitter-parser` Package
# run: |
# luarocks --verbose --local --lua-version=5.1 install luarocks-build-treesitter-parser
# - 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 tree-sitter parsers
# run: |
# # Filter out parsers that need their sources generated
# # We might want to consider adding those too
# langs=$(jq -r '.parsers[] | select((.install_info.requires_generate_from_grammar // false) == false) | .lang' nurr/tree-sitter-parsers.json)
# for lang in $langs; do
# rm "tree-sitter-$lang-scm-1.macosx-aarch64.rock" || true
# luarocks --local --lua-version=5.1 install "tree-sitter-$lang" \
# && luarocks pack "tree-sitter-$lang" || echo "Failed to pack tree-sitter-$lang"
# done
- name: "[HACK: luarocks/#1630] work around"
run: for f in *.macosx-x86_64.rock; do mv "$f" "$(echo "$f" | sed s/x86_64/aarch64/)"; done
- name: "[HACK: luarocks/#1630] restore x86_64 backups"
run: for f in *.macosx-x86_64.rock.bak; do mv "$f" "$(echo "$f" | sed s/\.bak$//)"; done
- 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 tree-sitter parsers
run: |
# Filter out parsers that need their sources generated
# We might want to consider adding those too
langs=$(jq -r '.parsers[] | select((.install_info.requires_generate_from_grammar // false) == false) | .lang' nurr/tree-sitter-parsers.json)
for lang in $langs; do
rm "tree-sitter-$lang-scm-1.macosx-aarch64.rock" || true
luarocks --local --lua-version=5.1 install "tree-sitter-$lang" \
&& luarocks pack "tree-sitter-$lang" || echo "Failed to pack tree-sitter-$lang"
done
- name: Regenerate Manifests and HTML
run: luarocks-admin make-manifest --lua-version=5.1 .
- name: commit-macosx-aarch64
Expand Down
41 changes: 21 additions & 20 deletions .github/workflows/build-macosx-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ jobs:
luaVersion: "5.1"
- name: Install Luarocks
uses: hishamhm/gh-actions-luarocks@master
- name: Configure architecture
run: |
mkdir -p /Users/runner/.luarocks
luarocks --verbose --local config arch macosx-x86_64
- uses: rhysd/action-setup-vim@v1
with:
neovim: true
Expand Down Expand Up @@ -91,26 +95,23 @@ jobs:
run: |
luarocks --verbose --local --lua-version=5.1 install tree-sitter-norg-meta
luarocks --verbose pack tree-sitter-norg-meta
# - name: Install `luarocks-build-treesitter-parser` Package
# run: |
# luarocks --verbose --local --lua-version=5.1 install luarocks-build-treesitter-parser
# - 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 tree-sitter parsers
# run: |
# # Filter out parsers that need their sources generated
# # We might want to consider adding those too
# langs=$(jq -r '.parsers[] | select((.install_info.requires_generate_from_grammar // false) == false) | .lang' nurr/tree-sitter-parsers.json)
# for lang in $langs; do
# rm "tree-sitter-$lang-scm-1.macosx-x86_64.rock" || true
# luarocks --local --lua-version=5.1 install "tree-sitter-$lang" \
# && luarocks pack "tree-sitter-$lang" || echo "Failed to pack tree-sitter-$lang"
# done
- 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 tree-sitter parsers
run: |
# Filter out parsers that need their sources generated
# We might want to consider adding those too
langs=$(jq -r '.parsers[] | select((.install_info.requires_generate_from_grammar // false) == false) | .lang' nurr/tree-sitter-parsers.json)
for lang in $langs; do
rm "tree-sitter-$lang-scm-1.macosx-aarch64.rock" || true
luarocks --local --lua-version=5.1 install "tree-sitter-$lang" \
&& luarocks pack "tree-sitter-$lang" || echo "Failed to pack tree-sitter-$lang"
done
- name: Regenerate Manifests and HTML
run: luarocks-admin make-manifest --lua-version=5.1 .
- name: commit-macosx-x86_64
Expand Down
41 changes: 16 additions & 25 deletions .github/workflows/build-win32-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,31 +101,22 @@ jobs:
luarocks --verbose --local --lua-version=5.1 install tree-sitter-norg-meta
luarocks --verbose pack tree-sitter-norg-meta
if: always()

# - name: Install `luarocks-build-treesitter-parser` Package
# run: |
# luarocks --verbose --local --lua-version=5.1 install luarocks-build-treesitter-parser
# if: always()
# - name: Get tree-sitter-parsers.json
# uses: actions/checkout@v4
# with:
# repository: nvim-neorocks/nurr
# sparse-checkout: |
# tree-sitter-parsers.json
# path: nurr
# if: always()
# - name: Install tree-sitter parsers
# shell: bash
# run: |
# # Filter out parsers that need their sources generated
# # We might want to consider adding those too
# langs=$(jq -r '.parsers[] | select((.install_info.requires_generate_from_grammar // false) == false) | .lang' nurr/tree-sitter-parsers.json | tr -d '\r')
# for lang in $langs; do
# rm "tree-sitter-$lang-scm-1.win32-x86_64.rock" || true
# luarocks --local --lua-version=5.1 install "tree-sitter-$lang" \
# && luarocks pack "tree-sitter-$lang" || echo "Failed to pack tree-sitter-$lang"
# done
# if: always()
- name: Get tree-sitter-parsers.json
uses: actions/checkout@v4
with:
repository: nvim-neorocks/nurr
sparse-checkout: |
tree-sitter-parsers.json
path: nurr
if: always()
- name: Install tree-sitter parsers
run: |
$langs = (jq -r '.parsers[] | .lang' nurr/tree-sitter-parsers.json).Replace("`r","")
foreach ($lang in $langs) {
luarocks --local --lua-version=5.1 install "tree-sitter-$lang"
luarocks pack "tree-sitter-$lang"
}
if: always()
- name: Regenerate Manifests and HTML
run: luarocks-admin make-manifest --lua-version=5.1 .
if: always()
Expand Down

0 comments on commit 186f7bd

Please sign in to comment.