summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/automation_remove_question_label_on_comment.yml16
-rw-r--r--.github/workflows/automation_request_review.yml27
-rw-r--r--.github/workflows/install_nvim.sh12
-rw-r--r--.github/workflows/tests.yml122
4 files changed, 177 insertions, 0 deletions
diff --git a/.github/workflows/automation_remove_question_label_on_comment.yml b/.github/workflows/automation_remove_question_label_on_comment.yml
new file mode 100644
index 0000000..f99bba8
--- /dev/null
+++ b/.github/workflows/automation_remove_question_label_on_comment.yml
@@ -0,0 +1,16 @@
+name: Remove Question Label on Issue Comment
+
+on: [issue_comment]
+
+jobs:
+ # Remove the "question" label when a new comment is added.
+ # This lets me ask a question, tag the issue with "question", and filter out all "question"-tagged
+ # issues in my "needs triage" filter.
+ remove_question:
+ runs-on: ubuntu-latest
+ if: github.event.sender.login != 'stevearc'
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions-ecosystem/action-remove-labels@v1
+ with:
+ labels: question
diff --git a/.github/workflows/automation_request_review.yml b/.github/workflows/automation_request_review.yml
new file mode 100644
index 0000000..c31f582
--- /dev/null
+++ b/.github/workflows/automation_request_review.yml
@@ -0,0 +1,27 @@
+name: Request Review
+permissions:
+ pull-requests: write
+on:
+ pull_request_target:
+ types: [opened, reopened, ready_for_review, synchronize]
+ branches-ignore:
+ - "release-please--**"
+
+jobs:
+ # Request review automatically when PRs are opened
+ request_review:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Request Review
+ uses: actions/github-script@v7
+ if: github.actor != 'stevearc'
+ with:
+ github-token: ${{secrets.GITHUB_TOKEN}}
+ script: |
+ const pr = context.payload.pull_request;
+ github.rest.pulls.requestReviewers({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ pull_number: pr.number,
+ reviewers: ['stevearc']
+ });
diff --git a/.github/workflows/install_nvim.sh b/.github/workflows/install_nvim.sh
new file mode 100644
index 0000000..4c0203c
--- /dev/null
+++ b/.github/workflows/install_nvim.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+set -e
+PLUGINS="$HOME/.local/share/nvim/site/pack/plugins/start"
+mkdir -p "$PLUGINS"
+
+wget "https://github.com/neovim/neovim/releases/download/${NVIM_TAG-stable}/nvim.appimage"
+chmod +x nvim.appimage
+./nvim.appimage --appimage-extract >/dev/null
+rm -f nvim.appimage
+mkdir -p ~/.local/share/nvim
+mv squashfs-root ~/.local/share/nvim/appimage
+sudo ln -s "$HOME/.local/share/nvim/appimage/AppRun" /usr/bin/nvim
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..a053f5d
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,122 @@
+name: Run tests
+
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+ branches:
+ - master
+
+jobs:
+ luacheck:
+ name: Luacheck
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Prepare
+ run: |
+ sudo apt-get update
+ sudo add-apt-repository universe
+ sudo apt install luarocks -y
+ sudo luarocks install luacheck
+
+ - name: Run Luacheck
+ run: luacheck lua tests
+
+ typecheck:
+ name: typecheck
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v4
+ - uses: stevearc/nvim-typecheck-action@v2
+ with:
+ path: lua
+
+ stylua:
+ name: StyLua
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v4
+ - name: Stylua
+ uses: JohnnyMorganz/stylua-action@v4
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ version: v0.20.0
+ args: --check lua tests
+
+ run_tests:
+ strategy:
+ matrix:
+ include:
+ - nvim_tag: v0.10.1
+
+ name: Run tests
+ runs-on: ubuntu-22.04
+ env:
+ NVIM_TAG: ${{ matrix.nvim_tag }}
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install Neovim and dependencies
+ run: |
+ bash ./.github/workflows/install_nvim.sh
+
+ - name: Run tests
+ run: |
+ bash ./run_tests.sh
+
+ update_docs:
+ name: Update docs
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Install Neovim and dependencies
+ run: |
+ bash ./.github/workflows/install_nvim.sh
+
+ - name: Update docs
+ run: |
+ python -m pip install pyparsing==3.0.9
+ make doc
+ - name: Commit changes
+ if: ${{ github.ref == 'refs/heads/master' }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ COMMIT_MSG: |
+ [docgen] Update docs
+ skip-checks: true
+ run: |
+ git config user.email "actions@github"
+ git config user.name "Github Actions"
+ git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
+ git add README.md doc
+ # Only commit and push if we have changes
+ git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin HEAD:${GITHUB_REF})
+
+ release:
+ name: release
+
+ if: ${{ github.ref == 'refs/heads/master' }}
+ needs:
+ - luacheck
+ - stylua
+ - typecheck
+ - run_tests
+ - update_docs
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: googleapis/release-please-action@v4
+ id: release
+ with:
+ release-type: simple
+ - uses: actions/checkout@v4
+ - uses: rickstaa/action-create-tag@v1
+ if: ${{ steps.release.outputs.release_created }}
+ with:
+ tag: stable
+ message: "Current stable release: ${{ steps.release.outputs.tag_name }}"
+ tag_exists_error: false
+ force_push_tag: true