From c04df2010b07925faec83ee83a76b90edebcc836 Mon Sep 17 00:00:00 2001 From: FantasyRL <1845983502@qq.com> Date: Wed, 17 Apr 2024 23:08:30 +0800 Subject: [PATCH 1/2] workflow --- .github/workflows/codeql.yml | 6 ++---- .github/workflows/golangci.yaml | 12 ------------ .github/workflows/golangci.yml | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 16 deletions(-) delete mode 100644 .github/workflows/golangci.yaml create mode 100644 .github/workflows/golangci.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 87e228c..423b299 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -14,12 +14,10 @@ name: "CodeQL" on: push: branches: - - "main" - - "not_main" + - main pull_request: branches: - - "main" - - "not_main" + - main schedule: - cron: '42 14 * * 1' diff --git a/.github/workflows/golangci.yaml b/.github/workflows/golangci.yaml deleted file mode 100644 index a8fae1e..0000000 --- a/.github/workflows/golangci.yaml +++ /dev/null @@ -1,12 +0,0 @@ -name: security check -on: - push: - branches: - - not_main -jobs: - golangci: - name: golangci - runs-on: ubuntu-22.04 - steps: - - name: check code by golangci - run: golangci-lint run diff --git a/.github/workflows/golangci.yml b/.github/workflows/golangci.yml new file mode 100644 index 0000000..913dea4 --- /dev/null +++ b/.github/workflows/golangci.yml @@ -0,0 +1,26 @@ +name: golangci +on: + push: + branches: + - main + pull_request: + +env: + GO_VERSION: '1.22' + +jobs: + golangci-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + - name: lint + uses: golangci/golangci-lint-action@v4.0.0 + with: + version: latest + skip-build-cache: true + skip-pkg-cache: true + run: golangci-lint run \ No newline at end of file From 88b891b36120462bd869aef63efd50d28d48fbfb Mon Sep 17 00:00:00 2001 From: FantasyRL <1845983502@qq.com> Date: Wed, 17 Apr 2024 23:13:09 +0800 Subject: [PATCH 2/2] workflow --- .github/workflows/golangci.yml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/golangci.yml b/.github/workflows/golangci.yml index 913dea4..70612a7 100644 --- a/.github/workflows/golangci.yml +++ b/.github/workflows/golangci.yml @@ -23,4 +23,29 @@ jobs: version: latest skip-build-cache: true skip-pkg-cache: true - run: golangci-lint run \ No newline at end of file + tests-on-unix: + needs: golangci-lint # run after golangci-lint action to not produce duplicated errors + runs-on: ubuntu-latest + strategy: + matrix: + golang: + - '1.21' + - '1.22' + steps: + - uses: actions/checkout@v4 + - name: Install Go + uses: actions/setup-go@v5 + with: + # https://github.com/actions/setup-go#supported-version-syntax + # ex: + # - 1.18beta1 -> 1.18.0-beta.1 + # - 1.18rc1 -> 1.18.0-rc.1 + go-version: ${{ matrix.golang }} + - uses: actions/cache@v4 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ matrix.golang }}-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go-${{ matrix.golang }}- + - name: Run tests + run: make test \ No newline at end of file