|
| 1 | +name: Build |
| 2 | +run-name: Build the game and save artifact |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: [ "main" ] |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + |
| 12 | + - name: install elan |
| 13 | + run: | |
| 14 | + set -o pipefail |
| 15 | + curl -sSfL https://github.com/leanprover/elan/releases/download/v3.0.0/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz |
| 16 | + ./elan-init -y --default-toolchain none |
| 17 | + echo "$HOME/.elan/bin" >> $GITHUB_PATH |
| 18 | +
|
| 19 | + - uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: print lean and lake versions |
| 22 | + run: | |
| 23 | + lean --version |
| 24 | + lake --version |
| 25 | +
|
| 26 | + # Note: this would also happen in the lake post-update-hook |
| 27 | + - name: get mathlib cache |
| 28 | + continue-on-error: true |
| 29 | + run: | |
| 30 | + lake exe cache clean |
| 31 | + # We've been seeing many failures at this step recently because of network errors. |
| 32 | + # As a band-aid, we try twice. |
| 33 | + # The 'sleep 1' is small pause to let the network recover. |
| 34 | + lake exe cache get || (sleep 1; lake exe cache get) |
| 35 | +
|
| 36 | + - name: create timestamp file |
| 37 | + run: touch tmp_timestamp |
| 38 | + |
| 39 | + # Note: this would also happen in the lake post-update-hook |
| 40 | + - name: build gameserver executable |
| 41 | + run: env LEAN_ABORT_ON_PANIC=1 lake build gameserver |
| 42 | + |
| 43 | + - name: building game |
| 44 | + run: env LEAN_ABORT_ON_PANIC=1 lake build |
| 45 | + |
| 46 | + - name: delete unused mathlib cache |
| 47 | + continue-on-error: true |
| 48 | + run: find . -type d \( -name "*/.git" \) -delete -print && find ./.lake/ -type f \( -name "*.c" -o -name "*.hash" -o -name "*.trace" \) -delete -print && find ./.lake/ -type f \( -name "*.olean" \) \! -neweraa ./tmp_timestamp -delete -print |
| 49 | + |
| 50 | + - name: delete timestamp file |
| 51 | + run: rm ./tmp_timestamp |
| 52 | + |
| 53 | + - name: compress built game |
| 54 | + #run: tar -czvf ../game.tar.gz . |
| 55 | + run: zip game.zip * .lake/ .i18n/ -r |
| 56 | + |
| 57 | + - name: upload compressed game folder |
| 58 | + uses: actions/upload-artifact@v4 |
| 59 | + with: |
| 60 | + name: build-for-server-import |
| 61 | + path: | |
| 62 | + game.zip |
| 63 | +
|
| 64 | + - name: What next? |
| 65 | + run: echo "To export the game to the Game Server, open https://adam.math.hhu.de/import/trigger/${GITHUB_REPOSITORY,,} \n Afterwards, you can play the game at https://adam.math.hhu.de/#/g/${GITHUB_REPOSITORY,,}" |
0 commit comments