|
| 1 | +name: main |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + types: [opened, synchronize] |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: github.head_ref |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + lint: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + name: lint |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v3 |
| 19 | + |
| 20 | + - uses: JohnnyMorganz/stylua-action@v2 |
| 21 | + with: |
| 22 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 23 | + version: latest |
| 24 | + args: --check . |
| 25 | + |
| 26 | + documentation: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + name: documentation |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v3 |
| 31 | + with: |
| 32 | + fetch-depth: 2 |
| 33 | + |
| 34 | + - name: setup neovim |
| 35 | + uses: rhysd/action-setup-vim@v1 |
| 36 | + with: |
| 37 | + neovim: true |
| 38 | + version: v0.8.3 |
| 39 | + |
| 40 | + - name: generate documentation |
| 41 | + run: make documentation-ci |
| 42 | + |
| 43 | + - name: check docs diff |
| 44 | + run: exit $(git status --porcelain doc | wc -l | tr -d " ") |
| 45 | + |
| 46 | + tests: |
| 47 | + needs: |
| 48 | + - lint |
| 49 | + - documentation |
| 50 | + runs-on: ubuntu-latest |
| 51 | + timeout-minutes: 2 |
| 52 | + strategy: |
| 53 | + matrix: |
| 54 | + neovim_version: ["v0.7.2", "v0.8.3", "v0.9.1", "nightly"] |
| 55 | + |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v3 |
| 58 | + |
| 59 | + - run: date +%F > todays-date |
| 60 | + |
| 61 | + - name: restore cache for today's nightly. |
| 62 | + uses: actions/cache@v3 |
| 63 | + with: |
| 64 | + path: _neovim |
| 65 | + key: ${{ runner.os }}-x64-${{ hashFiles('todays-date') }} |
| 66 | + |
| 67 | + - name: setup neovim |
| 68 | + uses: rhysd/action-setup-vim@v1 |
| 69 | + with: |
| 70 | + neovim: true |
| 71 | + version: ${{ matrix.neovim_version }} |
| 72 | + |
| 73 | + - name: run tests |
| 74 | + run: make test-ci |
| 75 | + |
| 76 | + release: |
| 77 | + name: release |
| 78 | + if: ${{ github.ref == 'refs/heads/main' }} |
| 79 | + needs: |
| 80 | + - tests |
| 81 | + runs-on: ubuntu-latest |
| 82 | + steps: |
| 83 | + - uses: actions/checkout@v3 |
| 84 | + |
| 85 | + - uses: google-github-actions/release-please-action@v3 |
| 86 | + id: release |
| 87 | + with: |
| 88 | + release-type: simple |
| 89 | + package-name: commit-msg-sg.nvim |
| 90 | + |
| 91 | + - name: tag stable versions |
| 92 | + if: ${{ steps.release.outputs.release_created }} |
| 93 | + run: | |
| 94 | + git config user.name github-actions[bot] |
| 95 | + git config user.email github-actions[bot]@users.noreply.github.com |
| 96 | + git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git" |
| 97 | + git tag -d stable || true |
| 98 | + git push origin :stable || true |
| 99 | + git tag -a stable -m "Last Stable Release" |
| 100 | + git push origin stable |
0 commit comments