|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + schedule: |
| 8 | + # Mondays, after the catalog's weekly runs: catches a breaking feed change. |
| 9 | + - cron: "17 9 * * 1" |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + godot: |
| 17 | + name: Godot ${{ matrix.version }} |
| 18 | + runs-on: ubuntu-24.04 |
| 19 | + timeout-minutes: 15 |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + include: |
| 24 | + # The minimum supported version and the latest stable. The SHA-512s |
| 25 | + # are the official ones from each release's SHA512-SUMS.txt, pinned |
| 26 | + # here so a swapped download fails instead of running. |
| 27 | + - version: 4.3-stable |
| 28 | + sha512: fd52bb4ba8acc30ca5accd1c566d470ad7282f891ccc0995dfafabcf92bcf76280ce182bf9d80ebd885f3ed2165d01e1fc3f2928436b15498dfbd98656c2a45a |
| 29 | + - version: 4.7.2-stable |
| 30 | + sha512: 9aa00f7a605200940bce3027a567b782f49bd8e940dd06ae9e987bd65aee1b1467edd56ed84fcdcbdd44354bf613bdbb4e5d2913e925850368e150c59ed54c65 |
| 31 | + env: |
| 32 | + GODOT_VERSION: ${{ matrix.version }} |
| 33 | + GODOT_SHA512: ${{ matrix.sha512 }} |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 36 | + with: |
| 37 | + persist-credentials: false |
| 38 | + |
| 39 | + - name: Install Godot |
| 40 | + run: | |
| 41 | + zip="Godot_v${GODOT_VERSION}_linux.x86_64.zip" |
| 42 | + curl -fsSL --retry 3 -o "$RUNNER_TEMP/godot.zip" "https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}/${zip}" |
| 43 | + echo "${GODOT_SHA512} $RUNNER_TEMP/godot.zip" | sha512sum -c - |
| 44 | + unzip -q "$RUNNER_TEMP/godot.zip" -d "$RUNNER_TEMP/godot" |
| 45 | + mv "$RUNNER_TEMP/godot/Godot_v${GODOT_VERSION}_linux.x86_64" "$RUNNER_TEMP/godot/godot" |
| 46 | + echo "$RUNNER_TEMP/godot" >> "$GITHUB_PATH" |
| 47 | +
|
| 48 | + - name: Import the project |
| 49 | + run: godot --headless --editor --quit --path . || true |
| 50 | + |
| 51 | + # Godot can exit 0 after a script error, so every step also reads the log. |
| 52 | + - name: Unit tests |
| 53 | + run: | |
| 54 | + godot --headless --path . --script tests/run_tests.gd 2>&1 | tee "$RUNNER_TEMP/tests.log" |
| 55 | + status=${PIPESTATUS[0]} |
| 56 | + if grep -qE "SCRIPT ERROR|Parse Error|Failed to load script" "$RUNNER_TEMP/tests.log"; then echo "::error::script error in tests"; exit 1; fi |
| 57 | + grep -q "^tests ok:" "$RUNNER_TEMP/tests.log" || { echo "::error::tests did not report ok"; exit 1; } |
| 58 | + exit "$status" |
| 59 | +
|
| 60 | + - name: Editor smoke test (plugin loads and unloads) |
| 61 | + run: | |
| 62 | + godot --headless --editor --quit-after 300 --verbose --path . > "$RUNNER_TEMP/editor.log" 2>&1 || true |
| 63 | + grep -E "free_game_dev_assets|SCRIPT ERROR|Parse Error" "$RUNNER_TEMP/editor.log" || true |
| 64 | + if grep -qE "SCRIPT ERROR|Parse Error|Failed to load script" "$RUNNER_TEMP/editor.log"; then echo "::error::script error in the editor"; exit 1; fi |
| 65 | + grep -q "free_game_dev_assets: dock added" "$RUNNER_TEMP/editor.log" || { echo "::error::dock was not added"; exit 1; } |
| 66 | + grep -q "free_game_dev_assets: dock removed" "$RUNNER_TEMP/editor.log" || { echo "::error::dock was not removed on exit"; exit 1; } |
| 67 | +
|
| 68 | + - name: Live feed contract |
| 69 | + run: | |
| 70 | + curl -fsSL --retry 3 --compressed -o "$RUNNER_TEMP/plugin-feed.json" https://tmhsdigital.github.io/Free-Game-Dev-Assets/plugin-feed.json |
| 71 | + godot --headless --path . --script tests/check_feed_file.gd -- "$RUNNER_TEMP/plugin-feed.json" 2>&1 | tee "$RUNNER_TEMP/feed.log" |
| 72 | + status=${PIPESTATUS[0]} |
| 73 | + grep -q "^feed ok:" "$RUNNER_TEMP/feed.log" || { echo "::error::live feed check failed"; exit 1; } |
| 74 | + exit "$status" |
0 commit comments