Skip to content

Commit

Permalink
fix gh ci
Browse files Browse the repository at this point in the history
  • Loading branch information
woodgear committed Nov 15, 2024
1 parent 4322cad commit a28946a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
build-alb:
name: Build alb
runs-on: ubuntu-22.04
outputs:
go-coverage: ${{ steps.go-coverage.outputs.coverage }}
lua-coverage: ${{ steps.go-coverage.outputs.coverage }}
strategy:
matrix:
platform:
Expand Down Expand Up @@ -105,6 +108,11 @@ jobs:
run: |
set -x
./scripts/run-like-github-actions.sh test-alb-nginx
echo "in gh ci"
cat ./luacov.summary
line_cov=$(cat ./luacov.summary |grep Total|awk '{print $4}'|awk -F% '{print $1}')
echo "lua coverage is $line_cov%"
echo "LUA_COVERAGE=$luacov" >> $GITHUB_OUT
release-alb:
name: Release alb
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -170,4 +178,17 @@ jobs:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_CLI_EXPERIMENTAL: enabled
run: |
./scripts/run-like-github-actions.sh release-alb
./scripts/run-like-github-actions.sh release-alb
update-coverage:
name: update coverage
runs-on: ubuntu-22.04
needs: [build-alb, release-alb]
env:
GO_COVERAGE: ${{ needs.build-alb.outputs.go-coverage }}
LUA_COVERAGE: ${{ needs.build-alb.outputs.lua-coverage }}
steps:
- name: debug
run: |
env
echo "GO_COVERAGE=$GO_COVERAGE"
echo "LUA_COVERAGE=$LUA_COVERAGE"
1 change: 1 addition & 0 deletions scripts/run-like-ci-nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ fi
platform=${MATRIX_PLATFORM:-linux/amd64}
echo "platform $platform"
docker run --user root --network=host --platform $platform -v $PWD:/acp-alb-test -t $image sh -c 'cd /acp-alb-test ;/acp-alb-test/scripts/nginx-test.sh'
# docker run --user root --network=host --platform $platform -v $PWD:/acp-alb-test -it $image sh
2 changes: 2 additions & 0 deletions scripts/run-like-github-actions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ function alb-gh-test-alb-nginx() (
local image=$(docker images | grep theseedoaa/alb | head -1 | awk '{printf "%s:%s",$1,$2}')
echo "test nginx $image"
./scripts/run-like-ci-nginx.sh $image
ls
cat ./luacov.summary
)

function alb-gh-build-alb() (
Expand Down
3 changes: 1 addition & 2 deletions template/actions/alb-nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ function alb-test-all-in-ci-nginx() {
echo "check" $end_check
echo "test" $end_test
pwd
tree
ls ./template/
luacov-console $PWD/template/nginx/lua/
luacov-console $PWD/template/nginx/lua/ -s
luacov-console $PWD/template/nginx/lua/ -s > ./luacov.summary
}

function test-nginx-local() {
Expand Down
2 changes: 2 additions & 0 deletions template/t/AlaudaLib.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ sub tgl_log(@msgs) {
warn "[tgl_log] @msgs\n";
}

tgl_log("lua cov $LUACOV");

sub gen_lua_test($block) {
my $lua_test_mode = "false";
my $lua_test_full = '';
Expand Down

0 comments on commit a28946a

Please sign in to comment.