Skip to content

feat: add code callouts #2191

feat: add code callouts

feat: add code callouts #2191

Workflow file for this run

# This workflow will build the project with Gradle and release its build.
name: Gradle test
on:
workflow_call:
pull_request:
jobs:
unit-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: iamgio/quarkdown/.github/actions/setup-environment@main
if: matrix.os == 'ubuntu-latest'
with:
full-checkout: ${{ inputs.full-checkout }}
- name: Checkout Repository (Windows)
if: matrix.os == 'windows-latest'
uses: actions/checkout@v4
- name: Set up JDK 17 (Windows)
if: matrix.os == 'windows-latest'
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle (Windows)
if: matrix.os == 'windows-latest'
uses: gradle/actions/setup-gradle@v3
- name: Run tests
uses: burrunan/gradle-cache-action@v3
with:
job-id: unit-test-${{ matrix.os }}
arguments: ${{ matrix.os == 'ubuntu-latest' && 'ktlintCheck test' || 'test' }}
e2e-build:
runs-on: ubuntu-latest
steps:
- uses: iamgio/quarkdown/.github/actions/setup-environment@main
with:
full-checkout: ${{ inputs.full-checkout }}
- name: Build CLI
id: build
uses: burrunan/gradle-cache-action@v3
with:
job-id: e2e-build
arguments: installDist
# Building the wiki to ensure it compiles
- name: Build wiki
run: |
cd docs
${{ github.workspace }}/build/install/quarkdown/bin/quarkdown c main.qd --strict --allow all --clean
- name: Upload CLI artifact
uses: actions/upload-artifact@v4
with:
name: quarkdown-e2e-cli
path: build/install/quarkdown
retention-days: 1
e2e-test:
runs-on: ubuntu-latest
needs: e2e-build
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: iamgio/quarkdown/.github/actions/setup-environment@main
with:
full-checkout: ${{ inputs.full-checkout }}
- name: Download CLI artifact
uses: actions/download-artifact@v4
with:
name: quarkdown-e2e-cli
path: build/install/quarkdown
- name: Make CLI executable
run: chmod +x build/install/quarkdown/bin/quarkdown
- name: Run E2E tests (shard ${{ matrix.shard }}/4)
uses: burrunan/gradle-cache-action@v3
env:
QUARKDOWN_CLI_PATH: ${{ github.workspace }}/build/install/quarkdown/bin/quarkdown
with:
job-id: e2e-test
arguments: :quarkdown-html:e2eTest -Pshard=${{ matrix.shard }} -PtotalShards=4
bundled-runtime-test:
runs-on: ubuntu-latest
needs: e2e-build
steps:
- name: Download CLI artifact
uses: actions/download-artifact@v4
with:
name: quarkdown-e2e-cli
path: build/install/quarkdown
- name: Make CLI and bundled runtime executable
run: |
chmod +x build/install/quarkdown/bin/quarkdown
chmod +x build/install/quarkdown/runtime/bin/java
- name: Run quarkdown create + live preview
run: |
QUARKDOWN=build/install/quarkdown/bin/quarkdown
$QUARKDOWN create smoke \
--name smoke --authors CI --type plain \
--description "ci smoke test" --lang en
test -f smoke/main.qd
LOG=preview.log
$QUARKDOWN c smoke/main.qd -p -w --browser none > "$LOG" 2>&1 &
PID=$!
PORT_OPEN=false
for _ in $(seq 1 60); do
if (exec 3<>/dev/tcp/127.0.0.1/8089) 2>/dev/null; then
exec 3<&- 3>&-
PORT_OPEN=true
break
fi
sleep 0.5
done
if [ "$PORT_OPEN" != "true" ]; then
echo "ERROR: preview server did not start listening on port 8089 within 30s"
cat "$LOG"
kill "$PID" 2>/dev/null
wait "$PID" 2>/dev/null || true
exit 1
fi
printf '\nRe-compiled paragraph.\n' >> smoke/main.qd
sleep 8
if ! kill -0 "$PID" 2>/dev/null; then
echo "ERROR: live preview process exited before timeout"
cat "$LOG"
wait "$PID"
exit 1
fi
kill "$PID"
wait "$PID" 2>/dev/null || true
echo "----- live preview output -----"
cat "$LOG"
echo "-------------------------------"
if grep -q "Exception in thread" "$LOG"; then
echo "ERROR: uncaught exception detected in live preview output"
exit 1
fi
COUNT=$(grep -c "Success" "$LOG" || true)
if [ "$COUNT" -lt 2 ]; then
echo "ERROR: expected at least 2 'Success' entries (initial compile + watch re-compile), got $COUNT"
exit 1
fi
echo "OK: live preview ran for 10s, observed $COUNT 'Success' entries"