mirror of
https://github.com/fumiama/gozel.git
synced 2026-06-05 00:10:24 +08:00
146 lines
3.3 KiB
YAML
146 lines
3.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
gofmt:
|
|
name: Check gofmt
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Run gofmt
|
|
run: gofmt -w .
|
|
|
|
- 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 gofmt"
|
|
title: "chore: run gofmt"
|
|
body: |
|
|
Automated PR created by CI.
|
|
|
|
`gofmt -w .` detected formatting differences and applied fixes.
|
|
branch: auto/gofmt
|
|
delete-branch: true
|
|
|
|
go-generate:
|
|
name: Check go generate
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Download SYCL Linux
|
|
run: |
|
|
wget https://github.com/intel/llvm/releases/download/v6.3.0/sycl_linux.tar.gz
|
|
tar -xzf sycl_linux.tar.gz
|
|
|
|
- name: Add SYCL bin to PATH
|
|
run: |
|
|
echo "${{ github.workspace }}/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
|
|
|
|
build:
|
|
name: Build
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest]
|
|
go-version: ["stable"]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- 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
|
|
|
|
test:
|
|
name: Test
|
|
needs: build
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest]
|
|
go-version: ["stable"]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- name: Run tests
|
|
run: go test -v -count=1 ./...
|
|
|
|
vet:
|
|
name: Vet
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
|
|
- name: Run go vet
|
|
run: go vet ./...
|