Skip to content

Commit

Permalink
add g3proxy coverage test CI
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq-b committed Nov 13, 2024
1 parent 49807f2 commit 5b58a33
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 2 deletions.
55 changes: 54 additions & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools
- name: Install dependencies
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install capnproto libc-ares-dev libssl-dev liblua5.4-dev
Expand All @@ -55,3 +55,56 @@ jobs:
name: Lib Coverage
token: ${{ secrets.CODECOV_TOKEN }}
verbose: false
g3proxy-test:
name: g3proxy test
runs-on: ubuntu-latest
services:
ftp-server:
image: ghcr.io/garethflowers/ftp-server:edge
env:
FTP_USER: ftpuser
FTP_PASS: ftppass
ports:
- '20-21:20-21/tcp'
- '40000-40009:40000-40009/tcp'
volumes:
- /tmp/ftp:/home/user
httpbin:
image: ghcr.io/psf/httpbin:0.10.2
ports:
- 80:8080
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install capnproto libc-ares-dev libssl-dev liblua5.4-dev
- name: Install test libs
run: |
sudo apt-get install python3-requests python3-pycurl python3-dnspython python3-socks
- name: Install binutils
run: |
cargo install cargo-binutils
- name: Run dnsmasq
run: |
sudo dnsmasq --local-service -C ${{ github.workspace }}/scripts/coverage/g3proxy/dnsmasq.conf
- name: run unit test
run: |
./scripts/coverage/g3proxy.sh
- name: Upload coverage data
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
disable_search: true
file: output.lcov
flags: g3proxy
name: g3proxy Coverage
token: ${{ secrets.CODECOV_TOKEN }}
verbose: false
12 changes: 11 additions & 1 deletion scripts/coverage/g3proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,20 @@ cargo profdata -- merge -o "${PROF_DATA_FILE}" ${profraw_files}

# report to console

IGNORE_FLAGS="--ignore-filename-regex=.cargo --ignore-filename-regex=rustc --ignore-filename-regex=target/debug/build --ignore-filename-regex=g3bench --ignore-filename-regex=g3fcgen --ignore-filename-regex=g3tiles --ignore-filename-regex=g3keymess --ignore-filename-regex=g3iploc"
IGNORE_FLAGS="--ignore-filename-regex=.cargo \
--ignore-filename-regex=rustc \
--ignore-filename-regex=target/debug/build \
--ignore-filename-regex=g3bench \
--ignore-filename-regex=g3mkcert \
--ignore-filename-regex=g3fcgen \
--ignore-filename-regex=g3tiles \
--ignore-filename-regex=g3keymess \
--ignore-filename-regex=g3iploc"

echo "==== Coverage for libs ===="
cargo cov -- report --use-color --instr-profile="${PROF_DATA_FILE}" ${IGNORE_FLAGS} --ignore-filename-regex="g3proxy" ${all_binaries} ${all_objects}

echo "==== Coverage for all ===="
cargo cov -- report --use-color --instr-profile="${PROF_DATA_FILE}" ${IGNORE_FLAGS} ${all_binaries} ${all_objects}

cargo cov -- export --format=lcov --instr-profile="${PROF_DATA_FILE}" ${IGNORE_FLAGS} ${all_binaries} ${all_objects} > output.lcov
5 changes: 5 additions & 0 deletions scripts/coverage/g3proxy/dnsmasq.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
listen-address=127.0.0.1
bind-interfaces

address=/httpbin.local/127.0.0.1
address=/g3proxy.local/127.0.0.1

0 comments on commit 5b58a33

Please sign in to comment.