From 186f7bda27dd8166858b1d8c9e1b26e90d0c77f9 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Thu, 18 Jul 2024 20:48:01 +0200 Subject: [PATCH] chore: prepare for packaging tree-sitter parser releases --- .github/workflows/build-linux-x86_64.yml | 37 ++++++++-------- .github/workflows/build-macosx-aarch64.yml | 49 ++++++++++------------ .github/workflows/build-macosx-x86_64.yml | 41 +++++++++--------- .github/workflows/build-win32-x86_64.yml | 41 +++++++----------- 4 files changed, 77 insertions(+), 91 deletions(-) diff --git a/.github/workflows/build-linux-x86_64.yml b/.github/workflows/build-linux-x86_64.yml index 0bb770a49..b925c4c73 100644 --- a/.github/workflows/build-linux-x86_64.yml +++ b/.github/workflows/build-linux-x86_64.yml @@ -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 diff --git a/.github/workflows/build-macosx-aarch64.yml b/.github/workflows/build-macosx-aarch64.yml index 8efa53f7f..3e40d69c2 100644 --- a/.github/workflows/build-macosx-aarch64.yml +++ b/.github/workflows/build-macosx-aarch64.yml @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/build-macosx-x86_64.yml b/.github/workflows/build-macosx-x86_64.yml index 88ac5daf3..f786f494d 100644 --- a/.github/workflows/build-macosx-x86_64.yml +++ b/.github/workflows/build-macosx-x86_64.yml @@ -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 @@ -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 diff --git a/.github/workflows/build-win32-x86_64.yml b/.github/workflows/build-win32-x86_64.yml index eed241253..b3ec4587e 100644 --- a/.github/workflows/build-win32-x86_64.yml +++ b/.github/workflows/build-win32-x86_64.yml @@ -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()