1
0
mirror of https://github.com/fumiama/gozel.git synced 2026-06-05 08:20:24 +08:00
Files
gozel/.github/workflows/ci.yml
源文雨 99d6587871 fix: ci
2026-03-26 00:42:18 +08:00

99 lines
2.3 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: write
pull-requests: write
jobs:
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 ./...
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.11
go-generate:
name: Run all Generates & PR
runs-on: ubuntu-latest
needs: [vet_build_test]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Download SYCL Linux
run: |
wget -q -O /tmp/sycl_linux.tar.gz https://github.com/intel/llvm/releases/download/v6.3.0/sycl_linux.tar.gz
mkdir -p /tmp/sycl_linux
tar -xzf /tmp/sycl_linux.tar.gz -C /tmp/sycl_linux
- name: Add SYCL bin to PATH
run: |
ls -hl /tmp/sycl_linux
echo "/tmp/sycl_linux/bin" >> $GITHUB_PATH
- name: Run go generate
run: go generate ./...
- name: Check for changes
id: diff
run: |
if [ -n "$(git diff --name-only)" ]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- 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 go generate"
title: "chore: run go generate"
body: |
Automated PR created by CI.
`go generate .` detected generated file differences and applied updates.
branch: auto/go-generate
delete-branch: true