CI #147
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: CI | |
on: | |
schedule: | |
- cron: "00 19 * * *" # run ci periodically at 3 am | |
pull_request: | |
branches: [ main ] | |
jobs: | |
format: | |
name: Format | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
- name: Format code | |
# replace with iamnotaturtle/[email protected] when the pr #5(https://github.com/iamnotaturtle/auto-gofmt/pull/6) merge | |
uses: Phoenix500526/[email protected] | |
with: | |
# This part is also where you can pass other options, for example: | |
only_changed: True | |
lint: | |
name: Lint Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.54.2 | |
test: | |
name: Xline Operator Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version-file: go.mod | |
- name: Build and test | |
run: make test | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: cover.out | |
fail_ci_if_error: true | |
verbose: true | |
commit: | |
name: Commit Message Validation | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name != 'schedule' }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- run: git show-ref | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions-rs/[email protected] | |
with: | |
crate: git-cz | |
version: latest | |
- name: Validate commit messages | |
run: git-cz check ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | |
spell-check: | |
name: Spell Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Actions Repository | |
uses: actions/checkout@v2 | |
- name: Check Spelling | |
uses: crate-ci/typos@master |