name: testcompile
on: [push, pull_request]

jobs:
  test_compile:
    runs-on: ubuntu-24.04
    steps:
    - name: Check out project
      uses: actions/checkout@v5
      with:
        submodules: recursive
    - name: Set up dependencies
      run: |
        sudo apt update && sudo apt install -y ninja-build cmake ccache clang curl
        wget http://archive.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2_amd64.deb && sudo dpkg -i libtinfo5_6.3-2_amd64.deb && rm -f libtinfo5_6.3-2_amd64.deb
    - name: Set up python
      uses: actions/setup-python@v5
      with:
        python-version: '3.13'
        cache: 'pip'
    - name: Set up python package dependencies
      run: pip install toml
    - name: Set up cache for toolchain
      uses: actions/cache@v4
      with:
        key: tools_libs
        path: |
          toolchain/bin
          toolchain/include
          toolchain/cache-version-url.txt
    - name: Run simplified setup
      run: tools/setup.py --project
    - name: Create testing source files
      run: bash ./.github/scripts/test-compile-create.sh
    - name: Build project
      run: tools/build.py
