name: Ubuntu 24.04 CI (archive build, no git)

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  archive-build:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v6
      - name: Recover the project as an archive (no .git)
        run: |
          git archive --format=tar.gz --prefix=simdutf-archive/ -o ${{ runner.temp }}/simdutf-archive.tar.gz HEAD &&
          tar -xzf ${{ runner.temp }}/simdutf-archive.tar.gz -C ${{ runner.temp }} &&
          test ! -e ${{ runner.temp }}/simdutf-archive/.git
      - name: Build and test from the archive
        run: |
          cd ${{ runner.temp }}/simdutf-archive &&
          mkdir build &&
          cd build &&
          cmake -DCMAKE_CXX_FLAGS=-Werror -DSIMDUTF_ALWAYS_INCLUDE_FALLBACK=ON -DCMAKE_BUILD_TYPE=Release ..   -DSIMDUTF_BENCHMARKS=OFF -DSIMDUTF_FAST_TESTS=ON -DSIMDUTF_TOOL_TESTS=ON &&
          cmake --build .   &&
          ctest -j --output-on-failure
