From d132a7a673d43b2da73f75e09fbe7fb49c431514 Mon Sep 17 00:00:00 2001 From: William Boman Date: Sat, 9 Jul 2022 01:00:34 +0200 Subject: chore(workflow): modularize scripts and remove mason-lspconfig from CI checks (#36) --- .github/workflows/autogenerate.yml | 42 +++++++++++++++++++++ .github/workflows/check-generated-code-state.yml | 29 +++++++++++++++ .github/workflows/metadata-diff.yml | 30 --------------- .github/workflows/run-autogen.yml | 47 ------------------------ .github/workflows/stylua.yml | 1 + 5 files changed, 72 insertions(+), 77 deletions(-) create mode 100644 .github/workflows/autogenerate.yml create mode 100644 .github/workflows/check-generated-code-state.yml delete mode 100644 .github/workflows/metadata-diff.yml delete mode 100644 .github/workflows/run-autogen.yml (limited to '.github') diff --git a/.github/workflows/autogenerate.yml b/.github/workflows/autogenerate.yml new file mode 100644 index 00000000..3c596ca0 --- /dev/null +++ b/.github/workflows/autogenerate.yml @@ -0,0 +1,42 @@ +name: Autogenerate code + +on: + workflow_dispatch: + schedule: + - cron: "0 10 * * *" + +jobs: + run-autogen-script: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: rhysd/action-setup-vim@v1 + with: + neovim: true + version: v0.7.0 + + - name: make autogenerate + run: make autogenerate + + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v4 + with: + token: ${{ secrets.PAT }} + author: "William Botman " + committer: "William Botman " + add-paths: lua/mason-lspconfig lua/mason-schemas + commit-message: "chore: update generated code" + branch: chore/autogenerate + branch-suffix: short-commit-hash + delete-branch: true + labels: automerge + title: "chore: update generated code" + + - name: Enable Pull Request Automerge + if: steps.cpr.outputs.pull-request-operation == 'created' + uses: peter-evans/enable-pull-request-automerge@v2 + with: + token: ${{ secrets.PAT }} + pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} + merge-method: squash diff --git a/.github/workflows/check-generated-code-state.yml b/.github/workflows/check-generated-code-state.yml new file mode 100644 index 00000000..e79e14fb --- /dev/null +++ b/.github/workflows/check-generated-code-state.yml @@ -0,0 +1,29 @@ +name: Check generated code state + +on: + push: + branches: + - "alpha" + pull_request: + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: rhysd/action-setup-vim@v1 + with: + neovim: true + version: v0.7.0 + + - name: make generate + run: make generate + + - name: Ensure there are no diffs + run: | + git update-index -q --refresh + git diff + git diff-index --exit-code --quiet HEAD -- || { + echo '::error::Generated code is not up to date, run "make generate".'; + exit 1; + } diff --git a/.github/workflows/metadata-diff.yml b/.github/workflows/metadata-diff.yml deleted file mode 100644 index ddc129ac..00000000 --- a/.github/workflows/metadata-diff.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Metadata diff checker - -on: - push: - branches: - - "main" - pull_request: - -jobs: - metadata-diff-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: rhysd/action-setup-vim@v1 - with: - neovim: true - version: v0.7.0 - - - name: Clone dependencies - run: | - mkdir -p ~/.local/share/nvim/site/pack/packer/start - git clone --depth 1 https://github.com/neovim/nvim-lspconfig ~/.local/share/nvim/site/pack/packer/start/nvim-lspconfig - - - name: Run autogen_metadata.sh script - run: ./scripts/autogen_metadata.sh - - - name: Ensure there are no diffs - run: | - git update-index --refresh - git diff-index --quiet HEAD -- diff --git a/.github/workflows/run-autogen.yml b/.github/workflows/run-autogen.yml deleted file mode 100644 index 1a97114f..00000000 --- a/.github/workflows/run-autogen.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Run autogen script - -on: - workflow_dispatch: - schedule: - - cron: "15 13 * * *" - -jobs: - run-autogen-script: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: rhysd/action-setup-vim@v1 - with: - neovim: true - version: v0.7.0 - - - name: Clone dependencies - run: | - mkdir -p ~/.local/share/nvim/site/pack/packer/start - git clone --depth 1 https://github.com/neovim/nvim-lspconfig ~/.local/share/nvim/site/pack/packer/start/nvim-lspconfig - - - name: Run autogen_metadata.sh script - run: ./scripts/autogen_metadata.sh - - - name: Create Pull Request - id: cpr - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.PAT }} - author: "William Botman " - committer: "William Botman " - add-paths: lua/mason/_generated - commit-message: run autogen_metadata.lua - branch: chore/autogen_metadata - branch-suffix: short-commit-hash - delete-branch: true - labels: automerge - title: run autogen_metadata.lua - - - name: Enable Pull Request Automerge - if: steps.cpr.outputs.pull-request-operation == 'created' - uses: peter-evans/enable-pull-request-automerge@v2 - with: - token: ${{ secrets.PAT }} - pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} - merge-method: squash diff --git a/.github/workflows/stylua.yml b/.github/workflows/stylua.yml index 1532fc6f..877795de 100644 --- a/.github/workflows/stylua.yml +++ b/.github/workflows/stylua.yml @@ -3,6 +3,7 @@ name: Stylua check on: push: branches: + - "alpha" pull_request: jobs: -- cgit v1.2.3-70-g09d2