github/workflows: update test workflow #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
release: | |
types: | |
- published | |
- created | |
- edited | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-22.04 # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md | |
- macos-13 # https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md | |
- macos-14 # https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md | |
- windows-2022 # https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md | |
go-version: | |
- 1.20.x | |
- 1.21.x | |
- 1.22.x | |
neovim-version: | |
- v0.9.1 | |
- nightly | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set flag environment variable | |
run: | | |
echo "OS=$(echo ${{ runner.os }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
echo "GO_VERSION=$(echo ${{ matrix.go-version }} | cut -d. -f-2)" >> $GITHUB_ENV | |
echo "NVIM_VERSION=$(if [ ${{ matrix.neovim-version }} != 'nightly' ]; then echo 'stable'; else echo 'nightly'; fi)" >> $GITHUB_ENV | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
check-latest: true | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install neovim binary | |
uses: rhysd/action-setup-vim@v1 | |
with: | |
neovim: true | |
version: ${{ matrix.neovim-version }} | |
- name: go vet | |
run: | | |
go vet ./... | |
- name: Test and take a coverage | |
run: | | |
go test -v -race -count=1 -covermode=atomic -coverpkg=./... -coverprofile=coverage.out ./... | |
- uses: codecov/codecov-action@v4 | |
with: | |
file: coverage.out | |
flags: ${{ env.OS }}-${{ env.GO_VERSION }}-${{ env.NVIM_VERSION }} | |
env_vars: OS,GO_VERSION,NVIM_VERSION |