Pipeline w/ redis for cleaning #47
Workflow file for this run
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
on: [pull_request, workflow_call] | |
name: PR - Build, Unit Test, Integration test | |
jobs: | |
build: | |
uses: ./.github/workflows/build.yml | |
test-qbit: | |
name: Test with actual qbittorrent | |
needs: build | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
qbit-svc: | |
image: ghcr.io/ckcr4lyf/qbit-svc:master | |
ports: | |
- 8888:8080 | |
volumes: | |
- /qbit-svc/downloads:/downloads | |
- /qbit-svc/watch:/watch | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: kiryuu | |
- name: Run kiryuu (in background) | |
run: | | |
chmod +x kiryuu | |
./kiryuu --redis-host 127.0.0.1:6379 & | |
- name: chmod the qbit seeder volumes | |
run: sudo chmod -R 777 /qbit-svc | |
- name: Start tcpdump on shared docker interface | |
run: | | |
IF_NAME="$(ifconfig | grep -B1 "172.18.0.1" | head -n1 | awk '{print $1}' | cut -d ':' -f1)" | |
sudo tcpdump -nnSX port 6969 -i $IF_NAME &>tcpdump_host.log & | |
sudo tcpdump -i $IF_NAME &>tcpdump_host.pcap & | |
- name: Download imdl (thanks @casey) | |
run: | | |
mkdir /tmp/imdl | |
wget -O imdl.tar.gz https://github.com/casey/intermodal/releases/download/v0.1.12/imdl-v0.1.12-x86_64-unknown-linux-musl.tar.gz | |
tar xvzf imdl.tar.gz -C /tmp/imdl | |
- name: Make dummy hello torrent (announce to kiryuu IP) | |
id: make_torrent | |
run: | | |
echo "hello" > hello.txt | |
echo "OG_SHA=$(sha256sum hello.txt | awk '{print $1}')" >> $GITHUB_OUTPUT | |
/tmp/imdl/imdl torrent create -a http://172.17.0.1:6969/announce hello.txt | |
- name: Move text file to seeder qbit instance | |
run: mv hello.txt /qbit-svc/downloads/ | |
- name: Copy torrent to watch dir | |
run: cp hello.txt.torrent /qbit-svc/watch/ | |
- name: Healthcheck on kiryuu | |
run: | | |
if [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://127.0.0.1:6969/healthz)" != "200" ]] | |
then exit 1 | |
else exit 0 | |
fi | |
- name: Run qbit leecher | |
id: docker_qbit | |
uses: docker://ghcr.io/ckcr4lyf/qbit-leecher:master | |
with: | |
torrent_name: hello.txt.torrent | |
file_name: hello.txt | |
- name: Kill Kiryuu | |
run: kill -9 `lsof -i:6969 -t` | |
- name: Upload tcpdump logs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tcpdump_logs | |
path: | | |
./tcpdump.log | |
./tcpdump.pcap | |
./tcpdump_host.log | |
./tcpdump_host.pcap | |
- name: Compare hashes | |
env: | |
OG_SHA: ${{ steps.make_torrent.outputs.og_sha }} | |
NEW_SHA: ${{ steps.docker_qbit.outputs.sha }} | |
run: | | |
if [[ $OG_SHA != $NEW_SHA ]] | |
then | |
echo "Fail, OG_SHA=$OG_SHA, but NEW_SHA=$NEW_SHA" | |
exit 1 | |
else | |
echo "Success, OG_SHA=$OG_SHA and NEW_SHA=$NEW_SHA" | |
fi | |
test-gauge: | |
name: Run tests with gauge | |
needs: build | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: kiryuu | |
- name: Run kiryuu (in background) | |
run: | | |
chmod +x kiryuu | |
./kiryuu --redis-host 127.0.0.1:6379 & | |
- name: Execute Gauge | |
uses: docker://ghcr.io/ckcr4lyf/kiryuu-gauge:master | |
env: | |
KIRYUU_HOST: http://172.17.0.1:6969 | |
REDIS_HOST: redis://172.17.0.1:6379 | |
ANNOUNCE_IP_PORT: AC120003115C #172.18.0.3:4444 <- This is the IP kiryuu will see the announce come from, so what we need to hardcode in redis via Gauge |