|
| 1 | +name: Nightly build |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run at 00:00 UTC every day |
| 6 | + - cron: '0 0 * * *' |
| 7 | + workflow_dispatch: |
| 8 | + # Allow manual trigger from Actions tab |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + tag-and-build: |
| 15 | + name: Tag nightly and build (${{ matrix.os }}) |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + include: |
| 22 | + - os: ubuntu-latest |
| 23 | + artifact: basic-linux |
| 24 | + archive: basic-linux.tar.gz |
| 25 | + outdir: linux |
| 26 | + bin: basic |
| 27 | + build_gfx: true |
| 28 | + - os: macos-latest |
| 29 | + artifact: basic-macos |
| 30 | + archive: basic-macos.tar.gz |
| 31 | + outdir: mac |
| 32 | + bin: basic |
| 33 | + build_gfx: true |
| 34 | + - os: windows-latest |
| 35 | + artifact: basic-windows |
| 36 | + archive: basic-windows.zip |
| 37 | + outdir: windows |
| 38 | + bin: basic.exe |
| 39 | + build_gfx: true |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Checkout main |
| 43 | + uses: actions/checkout@v4 |
| 44 | + with: |
| 45 | + ref: main |
| 46 | + fetch-depth: 0 |
| 47 | + |
| 48 | + - name: Update nightly tag |
| 49 | + if: runner.os == 'Linux' |
| 50 | + run: | |
| 51 | + git config user.name "github-actions[bot]" |
| 52 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 53 | + git tag -f nightly |
| 54 | + git push -f origin nightly |
| 55 | +
|
| 56 | + - name: Install raylib (Linux) |
| 57 | + if: runner.os == 'Linux' && matrix.build_gfx |
| 58 | + run: | |
| 59 | + set -e |
| 60 | + sudo apt-get update |
| 61 | + if sudo apt-get install -y libraylib-dev; then |
| 62 | + echo "Installed libraylib-dev from apt" |
| 63 | + else |
| 64 | + echo "libraylib-dev not available; building raylib from source" |
| 65 | + sudo apt-get install -y build-essential cmake git pkg-config \ |
| 66 | + libasound2-dev libx11-dev libxrandr-dev libxi-dev \ |
| 67 | + libxinerama-dev libxcursor-dev libgl1-mesa-dev libglu1-mesa-dev |
| 68 | + git clone --depth 1 https://github.com/raysan5/raylib.git /tmp/raylib |
| 69 | + cmake -S /tmp/raylib -B /tmp/raylib/build -DBUILD_SHARED_LIBS=ON |
| 70 | + cmake --build /tmp/raylib/build --config Release |
| 71 | + sudo cmake --install /tmp/raylib/build |
| 72 | + echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/raylib.conf |
| 73 | + sudo ldconfig |
| 74 | + fi |
| 75 | +
|
| 76 | + - name: Install raylib (macOS) |
| 77 | + if: runner.os == 'macOS' && matrix.build_gfx |
| 78 | + run: | |
| 79 | + set -e |
| 80 | + export HOMEBREW_NO_AUTO_UPDATE=1 |
| 81 | + brew install raylib |
| 82 | +
|
| 83 | + - name: Build (Unix) |
| 84 | + if: runner.os != 'Windows' |
| 85 | + run: | |
| 86 | + make |
| 87 | + if [ "${{ matrix.build_gfx }}" = "true" ]; then |
| 88 | + make basic-gfx |
| 89 | + fi |
| 90 | +
|
| 91 | + - name: Run tests (Unix) |
| 92 | + if: runner.os != 'Windows' |
| 93 | + run: | |
| 94 | + set -e |
| 95 | + for t in tests/*.bas; do |
| 96 | + case "$(basename "$t")" in |
| 97 | + codes-replaced.bas|locate.bas) |
| 98 | + echo "Skipping interactive test $t" |
| 99 | + continue |
| 100 | + ;; |
| 101 | + meta_include_dup_line.bas|meta_include_dup_label.bas|meta_include_circular_a.bas|meta_include_circular_b.bas) |
| 102 | + echo "Skipping expected-fail meta test $t" |
| 103 | + continue |
| 104 | + ;; |
| 105 | + esac |
| 106 | + echo "Running $t" |
| 107 | + ./basic -petscii "$t" >/dev/null |
| 108 | + done |
| 109 | +
|
| 110 | + - name: Setup MSYS2 (Windows, for raylib) |
| 111 | + if: runner.os == 'Windows' && matrix.build_gfx |
| 112 | + uses: msys2/setup-msys2@v2 |
| 113 | + with: |
| 114 | + msystem: MINGW64 |
| 115 | + update: true |
| 116 | + install: >- |
| 117 | + mingw-w64-x86_64-gcc |
| 118 | + mingw-w64-x86_64-make |
| 119 | + mingw-w64-x86_64-pkg-config |
| 120 | + mingw-w64-x86_64-raylib |
| 121 | +
|
| 122 | + - name: Build (Windows) |
| 123 | + if: runner.os == 'Windows' |
| 124 | + shell: msys2 {0} |
| 125 | + run: | |
| 126 | + set -e |
| 127 | + mingw32-make |
| 128 | + if [ "${{ matrix.build_gfx }}" = "true" ]; then |
| 129 | + mingw32-make basic-gfx |
| 130 | + fi |
| 131 | +
|
| 132 | + - name: Run tests (Windows) |
| 133 | + if: runner.os == 'Windows' |
| 134 | + shell: msys2 {0} |
| 135 | + run: | |
| 136 | + set -e |
| 137 | + for t in tests/*.bas; do |
| 138 | + case "$(basename "$t")" in |
| 139 | + codes-replaced.bas|locate.bas) |
| 140 | + echo "Skipping interactive test $t" |
| 141 | + continue |
| 142 | + ;; |
| 143 | + meta_include_dup_line.bas|meta_include_dup_label.bas|meta_include_circular_a.bas|meta_include_circular_b.bas) |
| 144 | + echo "Skipping expected-fail meta test $t" |
| 145 | + continue |
| 146 | + ;; |
| 147 | + esac |
| 148 | + echo "Running $t" |
| 149 | + ./basic.exe -petscii "$t" >/dev/null |
| 150 | + done |
| 151 | +
|
| 152 | + - name: Package artifact (Unix) |
| 153 | + if: runner.os != 'Windows' |
| 154 | + run: | |
| 155 | + mkdir -p out/${{ matrix.outdir }} |
| 156 | + cp ${{ matrix.bin }} out/${{ matrix.outdir }}/basic |
| 157 | + if [ "${{ matrix.build_gfx }}" = "true" ] && [ -f basic-gfx ]; then |
| 158 | + cp basic-gfx out/${{ matrix.outdir }}/basic-gfx |
| 159 | + fi |
| 160 | + cp -r examples out/${{ matrix.outdir }}/ |
| 161 | + cd out |
| 162 | + tar czf ${{ matrix.archive }} ${{ matrix.outdir }} |
| 163 | +
|
| 164 | + - name: Package artifact (Windows) |
| 165 | + if: runner.os == 'Windows' |
| 166 | + shell: bash |
| 167 | + run: | |
| 168 | + mkdir -p out/${{ matrix.outdir }} |
| 169 | + cp ${{ matrix.bin }} out/${{ matrix.outdir }}/basic.exe |
| 170 | + if [ "${{ matrix.build_gfx }}" = "true" ] && [ -f basic-gfx.exe ]; then |
| 171 | + cp basic-gfx.exe out/${{ matrix.outdir }}/basic-gfx.exe |
| 172 | + fi |
| 173 | + cp -r examples out/${{ matrix.outdir }}/ |
| 174 | + cd out |
| 175 | + powershell -Command "Compress-Archive -Path '${{ matrix.outdir }}' -DestinationPath '${{ matrix.archive }}'" |
| 176 | +
|
| 177 | + - name: Upload build artifact |
| 178 | + uses: actions/upload-artifact@v4 |
| 179 | + with: |
| 180 | + name: ${{ matrix.artifact }} |
| 181 | + path: out/${{ matrix.archive }} |
| 182 | + |
| 183 | + release: |
| 184 | + name: Publish nightly release |
| 185 | + needs: tag-and-build |
| 186 | + runs-on: ubuntu-latest |
| 187 | + |
| 188 | + steps: |
| 189 | + - name: Download artifacts |
| 190 | + uses: actions/download-artifact@v4 |
| 191 | + with: |
| 192 | + path: dist |
| 193 | + |
| 194 | + - name: Delete existing nightly release |
| 195 | + run: | |
| 196 | + gh release delete nightly --yes 2>/dev/null || true |
| 197 | + env: |
| 198 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 199 | + |
| 200 | + - name: Create nightly release |
| 201 | + uses: softprops/action-gh-release@v1 |
| 202 | + with: |
| 203 | + tag_name: nightly |
| 204 | + name: Nightly |
| 205 | + body: | |
| 206 | + Bleeding-edge build from `main`. Updated automatically every night. |
| 207 | + **Use stable [releases](https://github.com/${{ github.repository }}/releases) for production.** |
| 208 | + draft: false |
| 209 | + files: dist/**/* |
| 210 | + env: |
| 211 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments