|
24 | 24 | - develop |
25 | 25 |
|
26 | 26 | jobs: |
27 | | - unit-test: |
28 | | - name: Go Test |
29 | | - runs-on: ubuntu-latest |
30 | | - if: github.repository == 'apache/dubbo-admin' |
31 | | - steps: |
32 | | - - uses: actions/checkout@v4 |
33 | | - - name: Set up Go 1.x |
34 | | - uses: actions/setup-go@v5 |
35 | | - with: |
36 | | - go-version-file: go.mod |
37 | | - - name: Download dependencies |
38 | | - run: | |
39 | | - go mod download |
40 | | - - name: Go Test |
41 | | - run: | |
42 | | - go test ./... -gcflags=-l -coverprofile=coverage.txt -covermode=atomic |
43 | | - - name: "Upload test result" |
44 | | - if: always() |
45 | | - uses: actions/upload-artifact@v4 |
46 | | - with: |
47 | | - name: test-coverage |
48 | | - path: "**/coverage.txt" |
49 | | - - name: Coverage |
50 | | - run: bash <(curl -s https://codecov.io/bash) |
51 | | - |
52 | 27 | license-check: |
53 | | - name: License Check - Go |
| 28 | + name: License Check |
54 | 29 | runs-on: ubuntu-latest |
55 | 30 | if: github.repository == 'apache/dubbo-admin' |
56 | 31 | steps: |
57 | 32 | - uses: actions/checkout@v4 |
58 | | - - name: Set up Go 1.x |
59 | | - uses: actions/setup-go@v5 |
60 | | - with: |
61 | | - go-version-file: go.mod |
62 | | - |
63 | 33 | - name: Check License Header |
64 | 34 | uses: apache/skywalking-eyes/header@main |
| 35 | + env: |
| 36 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 37 | + with: |
| 38 | + config: .licenserc.yaml |
| 39 | + mode: check |
65 | 40 |
|
66 | | - go-fmt: |
67 | | - name: Go fmt |
68 | | - runs-on: ubuntu-latest |
| 41 | + CI: |
| 42 | + name: CI (${{ matrix.os }} - Go ${{ matrix.go_version }}) |
| 43 | + runs-on: ${{ matrix.os }} |
| 44 | + strategy: |
| 45 | + # If you want to matrix build , you can append the following list. |
| 46 | + matrix: |
| 47 | + go_version: |
| 48 | + - "1.24" |
| 49 | + - "1.23" |
| 50 | + os: |
| 51 | + - ubuntu-latest |
69 | 52 | if: github.repository == 'apache/dubbo-admin' |
70 | 53 | steps: |
71 | 54 | - uses: actions/checkout@v4 |
72 | | - - name: Set up Go 1.x |
| 55 | + - name: Setup Go ${{ matrix.go_version }} |
73 | 56 | uses: actions/setup-go@v5 |
74 | 57 | with: |
75 | 58 | go-version-file: go.mod |
76 | | - - name: Download dependencies |
77 | | - run: | |
78 | | - go mod download |
79 | | - - name: Go Fmt |
80 | | - run: | |
81 | | - go fmt ./... && git status && [[ -z `git status -s` ]] |
82 | | - # diff -u <(echo -n) <(gofmt -d -s .) |
| 59 | + - name: Cache dependencies |
| 60 | + # ref: https://github.com/actions/cache/blob/main/examples.md#go---module |
| 61 | + uses: actions/cache@v4 |
| 62 | + with: |
| 63 | + # Cache, works only on Linux |
| 64 | + path: | |
| 65 | + ~/.cache/go-build |
| 66 | + ~/go/pkg/mod |
| 67 | + # Cache key |
| 68 | + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 69 | + # An ordered list of keys to use for restoring the cache if no cache hit occurred for key |
| 70 | + restore-keys: | |
| 71 | + ${{ runner.os }}-go- |
| 72 | + - name: Check Code Format |
| 73 | + run: make fmt && git status && [[ -z `git status -s` ]] |
| 74 | + - name: Run Unit Test |
| 75 | + run: make test |
| 76 | + # TODO(marsevilspirit): add lint |
| 77 | + - name: Upload test result |
| 78 | + if: always() |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: test-coverage |
| 82 | + path: "**/coverage.txt" |
| 83 | + - name: Coverage |
| 84 | + # TODO(marsevilspirit): fix coverage |
| 85 | + run: bash <(curl -s https://codecov.io/bash) |
0 commit comments