ci: debug #11
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: E2E Tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
concurrency: | |
group: e2e-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
e2e: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-20.04 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Cache must be per OS and kernel version | |
- name: Set up Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.cache/docker | |
key: cache-${{ runner.os }}-$(uname -r) | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set BASE_IMAGE | |
run: | | |
echo "BASE_IMAGE=$(echo ${{ matrix.os }} | sed s/-/:/)" >> $GITHUB_ENV | |
- name: Build Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
file: docker/Dockerfile | |
tags: tls-traffic-analyzer:latest | |
push: false | |
load: true | |
build-args: BASE_IMAGE=${{ env.BASE_IMAGE }} | |
cache-from: type=local,src=.cache/docker | |
cache-to: type=local,dest=.cache/docker | |
- name: Start container | |
run: | | |
docker run \ | |
--privileged \ | |
-it --rm \ | |
-v $(pwd)/dumps:/dumps \ | |
--network host \ | |
--pid host \ | |
tls-traffic-analyzer:latest \ | |
-i $(ip -4 route | awk '/default/{print $5}') -o /dumps --chown-traffic-dumps $UID --commands curl --verbose | |
- name: Sleep and show logs | |
run: sleep 5 && docker logs $(docker ps -q) | |
- name: Run curl to www.google.com | |
run: curl -v -o /dev/null https://www.google.com | |
- name: Sleep and show logs | |
run: sleep 5 && docker logs $(docker ps -q) | |
- name: Save container logs | |
run: docker logs $(docker ps -q) > dumps/container.log | |
- name: List dumps directory | |
run: | | |
ls -lh dumps/ | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dumps-${{ github.run_id }} | |
path: dumps/ | |
retention-days: 5 | |
- name: Ensure at least one pcap file exists | |
run: | | |
if [ -z "$(find dumps -name '*.pcap' -print -quit)" ]; then | |
echo "No pcap files found" | |
exit 1 | |
fi | |
- name: Print stats.json | |
run: | | |
cat dumps/stats.json | jq | |
- name: Print pcap file | |
run: | | |
for file in dumps/*.pcap; do | |
echo "Dump file: $file" | |
docker exec $(docker ps -q) tshark -r /dumps/$file -V | |
done | |
- name: Stop container | |
run: | | |
docker stop $(docker ps -q) |