Skip to content

Add mascot to README (#12) #19

Add mascot to README (#12)

Add mascot to README (#12) #19

Workflow file for this run

name: Connect Smoke Tests
on:
push:
branches: [main]
pull_request:
schedule:
- cron: "0 6 * * *" # daily at 6am UTC
permissions:
contents: read
checks: write
jobs:
connect-smoke:
name: Smoke test against Connect ${{ matrix.connect-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
connect-version: ${{ github.event_name == 'schedule' && fromJSON('["2024.08.0", "release", "preview"]') || fromJSON('["2024.08.0", "release"]') }}
steps:
- uses: actions/checkout@v4
# Start Connect in Docker
- name: Start Connect
id: connect
uses: posit-dev/with-connect@main
with:
version: ${{ matrix.connect-version }}
license: ${{ secrets.CONNECT_LICENSE }}
# Resolve the actual Connect version for unambiguous job records
- name: Resolve Connect version
id: version
run: |
RESPONSE=$(curl -sf \
-H "Authorization: Key ${{ steps.connect.outputs.CONNECT_API_KEY }}" \
"${{ steps.connect.outputs.CONNECT_SERVER }}/__api__/server_settings")
VERSION=$(echo "${RESPONSE}" | jq -r '.version')
if [ -z "${VERSION}" ] || [ "${VERSION}" = "null" ]; then
echo "ERROR: Could not resolve Connect version from server_settings"
echo "Response body: ${RESPONSE}"
exit 1
fi
echo "Resolved Connect version: ${VERSION}"
echo "resolved=${VERSION}" >> "$GITHUB_OUTPUT"
# Rename the check run so the job title shows the resolved version
- name: Update job title with resolved version
uses: actions/github-script@v7
with:
script: |
const resolvedVersion = '${{ steps.version.outputs.resolved }}';
const { data: { jobs } } = await github.rest.actions.listJobsForWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId,
});
const currentJob = jobs.find(
j => j.status === 'in_progress' && j.name.includes('${{ matrix.connect-version }}')
);
if (currentJob) {
await github.rest.checks.update({
owner: context.repo.owner,
repo: context.repo.repo,
check_run_id: currentJob.id,
name: `Smoke test against Connect ${resolvedVersion}`,
});
}
# Set up Python and install VIP
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install dependencies
run: uv sync
- name: Install Playwright browsers
run: uv run playwright install chromium
# Generate vip.toml from with-connect outputs
- name: Configure VIP for CI Connect
run: |
cat > vip.toml << EOF
[general]
deployment_name = "CI Connect"
[connect]
enabled = true
url = "${{ steps.connect.outputs.CONNECT_SERVER }}"
api_key = "${{ steps.connect.outputs.CONNECT_API_KEY }}"
version = "${{ steps.version.outputs.resolved }}"
[auth]
provider = "password"
EOF
# Run the subset of tests that work against Docker Connect
- name: Run Connect smoke tests
run: |
uv run pytest \
tests/prerequisites/test_components.py \
tests/connect/test_auth.py \
-v -k "reachable or api" \
--vip-config=vip.toml \
--junitxml=smoke-results.xml
env:
VIP_CONNECT_API_KEY: ${{ steps.connect.outputs.CONNECT_API_KEY }}
# Upload test results for debugging failures
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: connect-smoke-results-${{ steps.version.outputs.resolved }}
path: smoke-results.xml
# Write a rich job summary with test details and emoji
- name: Write workflow summary
if: always()
run: |
RESOLVED="${{ steps.version.outputs.resolved }}"
CONNECT_URL="${{ steps.connect.outputs.CONNECT_SERVER }}"
REQUESTED="${{ matrix.connect-version }}"
RUN_DATE=$(date -u '+%Y-%m-%d %H:%M UTC')
{
echo "## 🧪 Connect Smoke Tests — v${RESOLVED}"
echo ""
echo "| | |"
echo "|---|---|"
echo "| 🏷️ **Requested version** | \`${REQUESTED}\` |"
echo "| ✅ **Resolved version** | \`${RESOLVED}\` |"
echo "| 🌐 **Connect URL** | \`${CONNECT_URL}\` |"
echo "| 📅 **Run date** | ${RUN_DATE} |"
echo ""
} >> "$GITHUB_STEP_SUMMARY"
if [ -f smoke-results.xml ]; then
TESTS=$(grep -oP '(?<=tests=")[^"]+' smoke-results.xml | head -1 || echo 0)
FAILURES=$(grep -oP '(?<=failures=")[^"]+' smoke-results.xml | head -1 || echo 0)
ERRORS=$(grep -oP '(?<=errors=")[^"]+' smoke-results.xml | head -1 || echo 0)
SKIPPED=$(grep -oP '(?<=skipped=")[^"]+' smoke-results.xml | head -1 || echo 0)
TESTS=${TESTS:-0}; FAILURES=${FAILURES:-0}; ERRORS=${ERRORS:-0}; SKIPPED=${SKIPPED:-0}
PASSED=$(( TESTS - FAILURES - ERRORS - SKIPPED ))
{
echo "### 📊 Test Results"
echo ""
echo "| Result | Count |"
echo "|--------|-------|"
echo "| ✅ Passed | ${PASSED} |"
echo "| ❌ Failed | ${FAILURES:-0} |"
echo "| ⚠️ Errors | ${ERRORS:-0} |"
echo "| ⏭️ Skipped | ${SKIPPED:-0} |"
echo "| 📝 **Total** | **${TESTS:-0}** |"
echo ""
if [ "${FAILURES:-0}" = "0" ] && [ "${ERRORS:-0}" = "0" ]; then
echo "🎉 **All tests passed!**"
else
echo "💥 **Some tests failed — check the logs for details.**"
fi
} >> "$GITHUB_STEP_SUMMARY"
else
echo "> ⚠️ Test results file not found — tests may have been skipped." >> "$GITHUB_STEP_SUMMARY"
fi
# Stop Connect
- name: Stop Connect
if: always()
uses: posit-dev/with-connect@main
with:
stop: ${{ steps.connect.outputs.CONTAINER_ID }}