add TCP/UDP ports check in github actions #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
tests: | |
name: Integration Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Build and run chat server in Docker | |
run: | | |
docker build -t chat-server . | |
docker run -d --name chat-server -p 8081:8081 -p 3478-3495:3478-3495/udp chat-server | |
sleep 5 | |
docker logs chat-server > sfu.log | |
- name: Check TCP Port 8081 | |
run: nc -zv 127.0.0.1 8081 || echo "TCP port 8081 is not accessible" | |
- name: Check UDP Port 3478 | |
run: nc -zv 127.0.0.1 -u 3478 || echo "UDP port 3478 is not accessible" | |
- name: Check UDP Port 3495 | |
run: nc -zv 127.0.0.1 -u 3495 || echo "UDP port 3495 is not accessible" | |
- name: Run integration tests | |
run: cargo test --release --no-fail-fast -- --show-output > test.log 2>&1 || true | |
- name: Shutdown chat server | |
run: docker stop chat-server && docker rm chat-server | |
- name: Upload logs as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: logs | |
path: | | |
sfu.log | |
test.log | |
- name: Parse test results | |
run: ./scripts/parse_test_results.sh test.log |