mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 20:37:12 +01:00
c14e827cc5
### Describe Your Changes This PR is aimed to change the currently in place configuration of running Go related jobs for code changes that don't contain actual Go files ([example 1](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/6517/checks) - 2m32s , [example 2](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/6543/checks) - 4m11s). In order to do that the `build` workflow was extracted from Go related workflow (now it doesn't require lint as a `need` step -- let me know if it's something we want to keep). It will run upon the same triggers as before the change. The `main` workflow now will be triggered by `**.go` pattern only and contains lint/test steps that are relevant for Go file changes. I expect this PR + https://github.com/VictoriaMetrics/VictoriaMetrics/pull/6540 to improve CI minutes usage. ### Checklist The following checks are **mandatory**: - [x] My change adheres [VictoriaMetrics contributing guidelines](https://docs.victoriametrics.com/contributing/). --------- Signed-off-by: Arkadii Yakovets <ark@victoriametrics.com>
94 lines
2.0 KiB
YAML
94 lines
2.0 KiB
YAML
name: main
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- cluster
|
|
- master
|
|
paths:
|
|
- '**.go'
|
|
pull_request:
|
|
branches:
|
|
- cluster
|
|
- master
|
|
paths:
|
|
- '**.go'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
cancel-in-progress: true
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
|
|
jobs:
|
|
lint:
|
|
name: lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Code checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
id: go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
cache: false
|
|
go-version: stable
|
|
|
|
- name: Cache Go artifacts
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cache/go-build
|
|
~/go/bin
|
|
~/go/pkg/mod
|
|
key: go-artifacts-${{ runner.os }}-check-all-${{ steps.go.outputs.go-version }}-${{ hashFiles('go.sum', 'Makefile', 'app/**/Makefile') }}
|
|
restore-keys: go-artifacts-${{ runner.os }}-check-all-
|
|
|
|
- name: Run check-all
|
|
run: |
|
|
make check-all
|
|
git diff --exit-code
|
|
|
|
test:
|
|
name: test
|
|
needs: lint
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
scenario:
|
|
- 'test-full'
|
|
- 'test-full-386'
|
|
- 'test-pure'
|
|
|
|
steps:
|
|
- name: Code checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
id: go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
cache: false
|
|
go-version: stable
|
|
|
|
- name: Cache Go artifacts
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cache/go-build
|
|
~/go/bin
|
|
~/go/pkg/mod
|
|
key: go-artifacts-${{ runner.os }}-${{ matrix.scenario }}-${{ steps.go.outputs.go-version }}-${{ hashFiles('go.sum', 'Makefile', 'app/**/Makefile') }}
|
|
restore-keys: go-artifacts-${{ runner.os }}-${{ matrix.scenario }}-
|
|
|
|
- name: Run tests
|
|
run: make ${{ matrix.scenario}}
|
|
|
|
- name: Publish coverage
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
file: ./coverage.txt
|