Skip to content

Commit

Permalink
chore: code format check
Browse files Browse the repository at this point in the history
  • Loading branch information
luohoufu committed Jan 14, 2025
1 parent 324a3ba commit 5a5c7d2
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 23 deletions.
84 changes: 77 additions & 7 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,103 @@ defaults:

env:
GO_VERSION: 1.23.4
PNAME: loadgen
PNAME: agent

jobs:
format_check:
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
uses: actions/checkout@v4
with:
path: ${{ env.PNAME }}

- name: Checkout framework repository
uses: actions/checkout@v4
with:
repository: infinilabs/framework
path: framework

- name: Checkout framework-vendor
uses: actions/checkout@v4
with:
ref: main
repository: infinilabs/framework-vendor
path: vendor

- name: Set up go toolchain
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
check-latest: false
cache: true

- name: Check go toolchain
run: go version

- name: Run make format
shell: bash
run: |
echo Home path is $HOME
export WORKBASE=$HOME/go/src/infini.sh
export WORK=$WORKBASE/$PNAME
# for test workspace
mkdir -p $HOME/go/src/
ln -s $GITHUB_WORKSPACE $WORKBASE
# check work folder
ls -lrt $WORKBASE/
ls -alrt $WORK
# for unit test
cd $WORK
echo Formating code at $PWD ...
make format
if [ $? -ne 0 ]; then
echo "make format failed, please check make output"
exit 1
fi
- name: Check for changes after format
id: check-changes
shell: bash
run: |
export WORKBASE=$HOME/go/src/infini.sh
export WORK=$WORKBASE/$PNAME
# for foramt check
cd $WORK
if [[ $(git status --porcelain | grep -c " M .*\.go$") -gt 0 ]]; then
echo "go format detected formatting changes"
echo "changes=true" >> $GITHUB_OUTPUT
else
echo "go format no changes found"
echo "changes=false" >> $GITHUB_OUTPUT
fi
- name: Fail workflow if changes after format
if: steps.check-changes.outputs.changes == 'true'
run: exit 1

unit_test:
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
uses: actions/checkout@v4
with:
fetch-depth: 0
path: ${{ env.PNAME }}

- name: Checkout framework repository
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: infinilabs/framework
path: framework

- name: Checkout framework-vendor
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
repository: infinilabs/framework-vendor
path: vendor

Expand Down Expand Up @@ -74,21 +147,18 @@ jobs:
- name: Checkout current repository
uses: actions/checkout@v4
with:
fetch-depth: 0
path: ${{ env.PNAME }}

- name: Checkout framework repository
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: infinilabs/framework
path: framework

- name: Checkout framework-vendor
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
repository: infinilabs/framework-vendor
path: vendor

Expand Down
60 changes: 54 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,57 @@
*.iml
*.idea/**/*
*.idea
.idea/*
.gradle/**/*
.gradle/*
out/**/*
out/*
build/**/*
build/*
gen/*
*/bin/*
*.class
*.iws
*.ipr
*/.idea/**
*/.idea/**/**
*/.gradle/**
*/out/**
*/build/**
*/*.iml
*/gen/*
*/bin/**
*/*.class
*.iws
*.ipr
*/R.java
gen/
classes/
bin/
*.log
*/*/proguard_logs/**
/private_test
*.exe
/log
/out
/data
/bloomfilter.bin
/bin
/src/github.com
/pkg
/pkg/*
/cluster
.DS_Store
log
data
bin
*.swp
/bin-run/
/leveldb
/dist
vendor
.git
trash
*.so
.public
generated_*.go
testing
.idea
config/generated.go
config/generat*.go
config/*.tpl
config/*.yml
Empty file added config/.gitkeep
Empty file.
10 changes: 0 additions & 10 deletions config/generated.go

This file was deleted.

0 comments on commit 5a5c7d2

Please sign in to comment.