Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: attempt to test added plugins #34

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
76 changes: 62 additions & 14 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,79 @@ on:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
# computes what plugins to test against
prepare:
runs-on: ubuntu-latest
outputs:
plugins: ${{ steps.json.outputs.plugins }}
test: "TEST OUTPUT"
# plugins:
# [
# {
# "name": "startup-nvim/startup.nvim",
# "shorthand": "startup.nvim",
# "license": "GPL-2.0",
# "summary": "A highly configurable neovim startup screen",
# "dependencies": ["telescope.nvim", "plenary.nvim"]
# }
# ]
steps:
- uses: actions/checkout@v4
- name: build matrix of plugins to test
id: json
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#multiline-strings
# https://www.jitsejan.com/use-github-actions-with-json-file-as-matrix
run: |
cat <<EOF > "plugins-hardcoded.json"
[ {
"name": "startup-nvim/startup.nvim",
"shorthand": "startup.nvim",
"license": "GPL-2.0",
"summary": "A highly configurable neovim startup screen",
"dependencies": ["telescope.nvim", "plenary.nvim"]
}]
EOF

echo "BASE REF: ${{github.base_ref}}"
ls -l
echo "Fetching base_ref / all"
git branch -a
git fetch --all
git diff origin/${{github.base_ref}} -- plugins.json
echo "[" > ./plugins-new.json
git diff --diff-filter=AM --unified=0 origin/${{github.base_ref}} -- plugins.json | sed -n 's/^+[^+]/&/p' | sed 's/^+//' >> ./plugins-new.json
echo "]" >> ./plugins-new.json

echo "cat plugins-new.json"
cat plugins-new.json

echo "cat plugins.json"
cat plugins-hardcoded.json
echo "plugins=$(jq -c . < ./plugins-new.json)" >> $GITHUB_OUTPUT

test-generated-matrix:
runs-on: ubuntu-latest
needs: [ prepare ]
steps:
- name: test generated matrix
run: |
echo "Hello world"
echo '${{ toJSON(needs.prepare.outputs) }}'
echo ${{ needs.prepare.outputs.plugins }}

test-pr:
runs-on: ubuntu-latest
needs: [ prepare ]
strategy:
matrix:
plugin: [
{
"name": "startup-nvim/startup.nvim",
"shorthand": "startup.nvim",
"license": "GPL-2.0",
"summary": "A highly configurable neovim startup screen",
"dependencies": ["telescope.nvim", "plenary.nvim"]
}
]

plugin: ${{ fromJSON(needs.prepare.outputs.plugins) }}
steps:
- name: Install Lua
if: ${{ env.RELEASE_VERSION != '' }}
uses: leso-kn/gh-actions-lua@master
with:
luaVersion: "5.1"

- name: test concat
run: |
echo ${{ join (matrix.deps, '\n')}}

- name: Checkout plugin repository
uses: actions/checkout@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: rlalik/setup-cpp-compiler@master
with:
compiler: clang-latest

- name: Checkout plugin repository
uses: actions/checkout@v4
with:
Expand All @@ -51,7 +51,7 @@ jobs:

- name: Get resources
uses: actions/checkout@v4
with:
with:
sparse-checkout: |
resources
path: nurr
Expand Down
7 changes: 7 additions & 0 deletions plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@
"summary": "Super fast git decorations implemented purely in Lua",
"license": "MIT"
},
{
"name": "leath-dub/snipe.nvim",
"shorthand": "snipe.nvim",
"dependencies": [],
"summary": "Efficient targetted menu built for fast buffer navigation",
"license": "UNKNOWN"
},
{
"name": "nacro90/numb.nvim",
"shorthand": "numb.nvim",
Expand Down