explicit restore and save points for ci caches as welll as a max size… #16
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: ["master", "_master/add_ci"] | |
| pull_request: | |
| branches: ["master"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| # | |
| # Linux | |
| # | |
| linux-prepare: | |
| name: Prepare Linux Container | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/build-linux-container | |
| linux-test: | |
| name: Linux Test (${{ matrix.compiler }}-release) | |
| needs: linux-prepare | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| compiler: [gcc] | |
| steps: | |
| - name: Free Disk Space | |
| run: | | |
| sudo rm -rf /usr/local/lib/android | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Linux Env | |
| uses: ./.github/actions/setup-linux | |
| with: | |
| compiler: ${{ matrix.compiler }} | |
| # Vcpkg cache | |
| - name: Restore vcpkg cache | |
| id: restore-vcpkg | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: vcpkg_installed | |
| key: vcpkg-installed-linux-${{ matrix.compiler }}-${{ hashFiles('vcpkg.json') }} | |
| restore-keys: | | |
| vcpkg-installed-linux-${{ matrix.compiler }}- | |
| - name: Configure | |
| uses: ./.github/actions/run-linux | |
| with: | |
| run: | | |
| cp ci/CMakeUserPresets.json CMakeUserPresets.json | |
| cmake --preset ci_${{ matrix.compiler }}_af_cpu | |
| - name: Save vcpkg cache | |
| if: steps.restore-vcpkg.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: vcpkg_installed | |
| key: ${{ steps.restore-vcpkg.outputs.cache-primary-key }} | |
| - name: Restore BuildCache cache | |
| id: restore-buildcache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: .buildcache | |
| key: buildcache-linux-${{ matrix.compiler }}-${{ github.run_id }} | |
| restore-keys: | | |
| buildcache-linux-${{ matrix.compiler }}- | |
| - name: Build | |
| uses: ./.github/actions/run-linux | |
| with: | |
| run: cmake --build --preset linux_${{ matrix.compiler }}_af_cpu_ci_build_test | |
| - name: Save BuildCache cache | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: .buildcache | |
| key: ${{ steps.restore-buildcache.outputs.cache-primary-key }} | |
| - name: Test | |
| uses: ./.github/actions/run-linux | |
| with: | |
| run: ctest --test-dir out/build/ci_${{ matrix.compiler }}_af_cpu -C Release --output-on-failure | |
| - name: Fix permissions | |
| if: always() | |
| run: sudo chown -R $(id -u):$(id -g) out/build | |
| # | |
| # Windows | |
| # | |
| windows-test: | |
| name: Windows Test (${{ matrix.compiler }}) | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| compiler: [msvc] | |
| # clang on windows skipped for simplicity unless requested, cth had it. | |
| # Keeping msvc only to save CI time/complexity initially. | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # Install Core Dependencies (Legacy/Manual Integration) | |
| # Using ArrayFire as standard backend config | |
| - uses: ./.github/actions/install_core_deps | |
| with: | |
| backend: ArrayFire | |
| distributed_backend: Stub | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| cache: "pip" | |
| cache-dependency-path: ".github/requirements.txt" | |
| - name: Install CMake & Ninja | |
| shell: pwsh | |
| run: | | |
| pip install --upgrade -r .github/requirements.txt | |
| - name: Setup Windows Env | |
| uses: ./.github/actions/setup-windows | |
| with: | |
| compiler: ${{ matrix.compiler }} | |
| # Vcpkg cache | |
| - name: Restore vcpkg cache | |
| id: restore-vcpkg-win | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: vcpkg_installed | |
| key: vcpkg-installed-windows-${{ matrix.compiler }}-${{ hashFiles('vcpkg-configuration.json') }} | |
| restore-keys: | | |
| vcpkg-installed-windows-${{ matrix.compiler }}-${{ hashFiles('vcpkg.json') }} | |
| vcpkg-installed-windows-${{ matrix.compiler }}- | |
| - name: Save vcpkg cache | |
| if: steps.restore-vcpkg-win.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: vcpkg_installed | |
| key: ${{ steps.restore-vcpkg-win.outputs.cache-primary-key }} | |
| # BuildCache cache | |
| - name: Restore BuildCache cache | |
| id: restore-buildcache-win | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: .buildcache | |
| key: buildcache-windows-${{ matrix.compiler }}-${{ github.run_id }} | |
| restore-keys: | | |
| buildcache-windows-${{ matrix.compiler }}- | |
| - name: Save BuildCache cache | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: .buildcache | |
| key: ${{ steps.restore-buildcache-win.outputs.cache-primary-key }} | |
| - name: Configure | |
| shell: pwsh | |
| run: | | |
| Copy-Item ci/CMakeUserPresets.json CMakeUserPresets.json | |
| cmake --preset ci_msvc_af_cpu | |
| - name: Build | |
| shell: pwsh | |
| run: | | |
| cmake --build --preset win_msvc_af_cpu_ci_build_test | |
| - name: Test | |
| shell: pwsh | |
| run: | | |
| ctest --test-dir out/build/ci_msvc_af_cpu -C Release --output-on-failure |