name: Preview build on: workflow_call: jobs: preview: name: Build preview runs-on: ubuntu-latest container: # If you change this version, change the numbers in the cache step, # .github/workflows/ci-emscripten.yml (2x) and os/emscripten/Dockerfile too. image: emscripten/emsdk:6.0.1 steps: - name: Checkout uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} - name: Name branch run: | git config --global --add safe.directory ${GITHUB_WORKSPACE} git checkout -b pr${{ github.event.pull_request.number }} - name: Setup cache uses: actions/cache@v5 with: path: /emsdk/upstream/emscripten/cache # If you change this version, change the numbers in the image configuration step, # .github/workflows/ci-emscripten.yml (2x) and os/emscripten/Dockerfile too. key: 6.0.1-${{ runner.os }} - name: Add liblzma support run: | cp ${GITHUB_WORKSPACE}/os/emscripten/ports/liblzma.py /emsdk/upstream/emscripten/tools/ports/contrib/ - name: Build (host tools) run: | mkdir build-host cd build-host echo "::group::CMake" cmake .. -DOPTION_TOOLS_ONLY=ON echo "::endgroup::" echo "::group::Build" echo "Running on $(nproc) cores" make -j$(nproc) tools echo "::endgroup::" - name: Install GCC problem matcher uses: ammaraskar/gcc-problem-matcher@master - name: Build run: | mkdir build cd build echo "::group::CMake" emcmake cmake .. \ -DHOST_BINARY_DIR=../build-host \ -DCMAKE_BUILD_TYPE=Release \ # EOF echo "::endgroup::" echo "::group::Build" echo "Running on $(nproc) cores" cmake --build . -j $(nproc) --target openttd echo "::endgroup::" - name: Prepare preview run: | mkdir public cp build/openttd.data public/ cp build/openttd.html public/ cp build/openttd.js public/ cp build/openttd.wasm public/ mkdir pr echo ${{ github.event.pull_request.number }} > ./pr/number - name: Upload artifacts uses: actions/upload-artifact@v7 with: name: pr${{ github.event.pull_request.number }} path: | public pr retention-days: 1