Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: code format check #14

Merged
merged 6 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 73 additions & 7 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,96 @@ env:
PNAME: loadgen

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 formatting code
cd $WORK
echo Formating code at $PWD ...
make format

- 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 +143,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 Expand Up @@ -118,7 +184,7 @@ jobs:
ls -lrt $WORKBASE/
ls -alrt $WORK

# for unit test
# for code lint
cd $WORK
echo Linting code at $PWD ...
make lint
51 changes: 45 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,48 @@
*.iml
*.idea
.idea
out/*
build/*
gen/*
*/bin/*
*.class
*.iws
*.ipr
*/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/*.tpl
config/*.yml
Empty file added config/.gitkeep
Empty file.
10 changes: 0 additions & 10 deletions config/generated.go

This file was deleted.

Loading