mirror of
https://github.com/fumiama/gozel.git
synced 2026-06-05 00:10:24 +08:00
optimize: ci
This commit is contained in:
82
.github/workflows/ci.yml
vendored
82
.github/workflows/ci.yml
vendored
@@ -11,9 +11,13 @@ permissions:
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
gofmt:
|
||||
name: Check gofmt
|
||||
runs-on: ubuntu-latest
|
||||
vet_build_test:
|
||||
name: Vet & Build & Test
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -21,33 +25,30 @@ jobs:
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Run gofmt
|
||||
run: gofmt -w .
|
||||
|
||||
- name: Check for changes
|
||||
id: diff
|
||||
- name: Find and remove all .cpp files
|
||||
run: |
|
||||
if [ -n "$(git diff --name-only)" ]; then
|
||||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
find . -name "*.cpp" -type f -delete
|
||||
shell: bash
|
||||
|
||||
- name: Create Pull Request
|
||||
if: steps.diff.outputs.changed == 'true'
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: "chore: run gofmt"
|
||||
title: "chore: run gofmt"
|
||||
body: |
|
||||
Automated PR created by CI.
|
||||
- name: Run go vet
|
||||
run: go vet ./...
|
||||
|
||||
`gofmt -w .` detected formatting differences and applied fixes.
|
||||
branch: auto/gofmt
|
||||
delete-branch: true
|
||||
- name: Build all packages
|
||||
run: go build ./...
|
||||
|
||||
- name: Build cmd/gen
|
||||
run: go build ./cmd/gen
|
||||
|
||||
- name: Build cmd/func2kernel
|
||||
run: go build ./cmd/func2kernel
|
||||
|
||||
- name: Run tests
|
||||
run: go test -v -count=1 ./...
|
||||
|
||||
go-generate:
|
||||
name: Check go generate
|
||||
name: Run all Generates & PR
|
||||
runs-on: ubuntu-latest
|
||||
needs: [vet_build_test]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -90,36 +91,3 @@ jobs:
|
||||
branch: auto/go-generate
|
||||
delete-branch: true
|
||||
|
||||
vet_build_test:
|
||||
name: Vet & Build & Test
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Find and remove all .cpp files
|
||||
run: |
|
||||
find . -name "*.cpp" -type f -delete
|
||||
shell: bash
|
||||
|
||||
- name: Run go vet
|
||||
run: go vet ./...
|
||||
|
||||
- name: Build all packages
|
||||
run: go build ./...
|
||||
|
||||
- name: Build cmd/gen
|
||||
run: go build ./cmd/gen
|
||||
|
||||
- name: Build cmd/func2kernel
|
||||
run: go build ./cmd/func2kernel
|
||||
|
||||
- name: Run tests
|
||||
run: go test -v -count=1 ./...
|
||||
|
||||
Reference in New Issue
Block a user