Add comprehensive API testing with JSON parsing
All checks were successful
Build libostree Backport / Build libostree Backport (push) Successful in 9m58s

This commit is contained in:
robojerk 2025-07-21 16:35:18 +00:00
parent 41cdbc8808
commit 1c73808c67

View file

@ -31,10 +31,10 @@ jobs:
cp -r /tmp/libostree-dev/* .
cp -r /tmp/libostree-dev/.* . 2>/dev/null || true
- name: Install curl for early testing
- name: Install curl and jq for early testing
run: |
apt-get update -y
apt-get install -y curl
apt-get install -y curl jq
- name: Debug - Check automatic token (safe)
run: |
@ -53,33 +53,71 @@ jobs:
run: |
echo "=== Testing Forgejo API endpoints with automatic token ==="
# Test 1: Check if the Debian Package Registry endpoint exists
echo "Testing Debian Package Registry endpoint..."
curl -v -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/repos/robojerk/libostree-dev/packages/debian" 2>&1
# Test 1: Check Forgejo version and capabilities
echo "Testing Forgejo version..."
curl -s -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/version" | jq . 2>/dev/null || echo "Version endpoint failed"
echo ""
echo "=== Testing Generic Package Registry endpoint ==="
echo "=== Testing user info ==="
# Test 2: Check if the Generic Package Registry endpoint exists
curl -v -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/packages/robojerk/generic" 2>&1
# Test 2: Check user info
echo "Testing user info..."
curl -s -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/user" | jq . 2>/dev/null || echo "User endpoint failed"
echo ""
echo "=== Testing repository packages endpoint ==="
echo "=== Testing repository info ==="
# Test 3: Check repository packages endpoint
curl -v -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/repos/robojerk/libostree-dev/packages" 2>&1
# Test 3: Check repository info
echo "Testing repository info..."
curl -s -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/repos/robojerk/libostree-dev" | jq . 2>/dev/null || echo "Repository endpoint failed"
echo ""
echo "=== Testing package registry endpoints ==="
# Test 4: Check if package registry is enabled
echo "Testing package registry availability..."
curl -s -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/user/packages" | jq . 2>/dev/null || echo "User packages endpoint failed"
echo ""
echo "=== Testing repository packages ==="
# Test 5: Check repository packages
echo "Testing repository packages..."
curl -s -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/repos/robojerk/libostree-dev/packages" | jq . 2>/dev/null || echo "Repository packages endpoint failed"
echo ""
echo "=== Testing package registry types ==="
# Test 6: Check available package types
echo "Testing Debian package registry..."
curl -s -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/packages/robojerk/debian" | jq . 2>/dev/null || echo "Debian packages endpoint failed"
echo "Testing Generic package registry..."
curl -s -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/packages/robojerk/generic" | jq . 2>/dev/null || echo "Generic packages endpoint failed"
- name: Test package upload with wget.deb
- name: Test package upload with steam.deb
run: |
echo "=== Testing package upload with wget.deb ==="
echo "=== Testing package upload with steam.deb ==="
# Check if steam.deb exists
if [ ! -f "steam.deb" ]; then
echo "❌ steam.deb not found, skipping upload test"
echo "Available files:"
ls -la *.deb 2>/dev/null || echo "No .deb files found"
exit 0
fi
# Test Debian Package Registry upload
echo "Testing Debian Package Registry upload..."
response=$(curl -s -w "%{http_code}" -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
--upload-file "wget_1.21.4-1ubuntu4.1_amd64.deb" \
--upload-file "steam.deb" \
"https://git.raines.xyz/api/packages/robojerk/debian/pool/noble/main/upload")
http_code=$(echo "$response" | tail -c 4)
@ -94,8 +132,8 @@ jobs:
echo ""
echo "Testing Generic Package Registry upload..."
response=$(curl -s -w "%{http_code}" -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
--upload-file "wget_1.21.4-1ubuntu4.1_amd64.deb" \
"https://git.raines.xyz/api/packages/robojerk/generic/wget/1.21.4-1ubuntu4.1/wget_1.21.4-1ubuntu4.1_amd64.deb")
--upload-file "steam.deb" \
"https://git.raines.xyz/api/packages/robojerk/generic/steam/1.0.0.83/steam.deb")
http_code=$(echo "$response" | tail -c 4)
echo "Generic Package Registry HTTP Response Code: $http_code"