Skip to content

golang: update api

golang: update api #1

name: Golangci
on:
push:
branches:
- main
paths:
- '.github/workflows/pr-golang-check.yaml'
- 'service/eventlog-server/**.go'
- 'service/measurement-server/**.go'
- 'sdk/golang/cima/measurement/**.go'
- 'sdk/golang/cima/quote/**.go'
- 'sdk/golang/cima/eventlog/**.go'
pull_request:
paths:
- '.github/workflows/pr-golang-check.yaml'
- 'service/eventlog-server/**.go'
- 'service/measurement-server/**.go'
- 'sdk/golang/cima/measurement/**.go'
- 'sdk/golang/cima/quote/**.go'
- 'sdk/golang/cima/eventlog/**.go'
workflow_dispatch:
permissions:
contents: read
jobs:
golangci-lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.20'
cache: false
- name: get changed file
id: changed-files
uses: tj-actions/changed-files@v41
with:
separator: ","
- name: golangci-lint-for-eventlog-server
if: contains(steps.changed-files.outputs.all_changed_files, 'service/eventlog-server')
uses: golangci/golangci-lint-action@v3
with:
version: v1.53
working-directory: './service/eventlog-server'
- name: golangci-lint-for-measurement-server
if: contains(steps.changed-files.outputs.all_changed_files, 'service/measurement-server')
uses: golangci/golangci-lint-action@v3
with:
version: v1.53
working-directory: './service/measurement-server'
golangci-unit-test:
needs: golangci-lint
runs-on: [self-hosted, tdvm-ut]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.20'
cache: false
- name: get changed file
id: changed-files
uses: tj-actions/changed-files@v41
with:
separator: ","
- name: golang-unit-test-for-eventlog-server
if: contains(steps.changed-files.outputs.all_changed_files, 'service/eventlog-server')
run: |
cd service/eventlog-server
make test
- name: golangci-unit-test-for-measurement-server
if: contains(steps.changed-files.outputs.all_changed_files, 'service/measurement-server')
run: |
cd service/measurement-server
make test