diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be49de2..eb9b06a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,10 +7,6 @@ on: env: TOIT_VERSION: v2.0.0-alpha.100 - # Will be set in the 'Setup constants' step - TOIT_URL: - # Will be set in the 'Setup constants' step - DOWNLOAD_DIR: jobs: build: @@ -23,72 +19,9 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup constants - shell: bash - run: | - export DOWNLOAD_DIR="${{ github.workspace }}/downloads" - echo "DOWNLOAD_DIR=$DOWNLOAD_DIR" >> $GITHUB_ENV - if [[ "$RUNNER_OS" = "Linux" ]]; then - TOIT_FILE=toit-linux.tar.gz - echo "TOIT_EXEC=$DOWNLOAD_DIR/toit/bin/toit.run" >> $GITHUB_ENV - echo "TPKG_EXEC=$DOWNLOAD_DIR/toit/bin/toit.pkg" >> $GITHUB_ENV - elif [[ "$RUNNER_OS" = "macOS" ]]; then - TOIT_FILE=toit-macos.tar.gz - echo "TOIT_EXEC=$DOWNLOAD_DIR/toit/bin/toit.run" >> $GITHUB_ENV - echo "TPKG_EXEC=$DOWNLOAD_DIR/toit/bin/toit.pkg" >> $GITHUB_ENV - elif [[ "$RUNNER_OS" = "Windows" ]]; then - TOIT_FILE=toit-windows.tar.gz - echo "TOIT_EXEC=$DOWNLOAD_DIR/toit/bin/toit.run.exe" >> $GITHUB_ENV - echo "TPKG_EXEC=$DOWNLOAD_DIR/toit/bin/toit.pkg.exe" >> $GITHUB_ENV - else - echo "UNSUPPORTED RUNNER: $RUNNER_OS" - exit 1 - fi - - echo "TOIT_URL=https://github.com/toitlang/toit/releases/download/$TOIT_VERSION/$TOIT_FILE" >> $GITHUB_ENV - - # Fetch the dependencies. Different for each platform. - - name: Install dependencies - Linux - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install ninja-build - ninja --version - cmake --version - - name: Install dependencies - macOS - if: runner.os == 'macOS' - run: | - brew install ninja - ninja --version - cmake --version - - name: Install dependencies - Windows - if: runner.os == 'Windows' - run: | - choco install ninja - ninja --version - cmake --version - - - uses: suisei-cn/actions-download-file@v1 - name: Download Toit + - uses: toitlang/action-setup@v1 with: - url: ${{ env.TOIT_URL }} - target: ${{ env.DOWNLOAD_DIR }} - - - name: Extract Toit - shell: bash - run: | - cd "$DOWNLOAD_DIR" - tar x -f *.tar.gz - - - name: Run cmake - shell: bash - run: | - make rebuild-cmake - cmake "-DTOIT_EXEC=$TOIT_EXEC" "-DTPKG_EXEC=$TPKG_EXEC" build - - - name: Install packages - run: | - make install-pkgs + toit-version: ${{ env.TOIT_VERSION }} - name: Test run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index f1bf07a..9cfd844 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.23) -project(certificate_roots) +project(certificate_roots NONE) enable_testing() add_subdirectory(tests) diff --git a/Makefile b/Makefile index 903f99c..16aa587 100644 --- a/Makefile +++ b/Makefile @@ -9,10 +9,10 @@ build/CMakeCache.txt: $(MAKE) rebuild-cmake install-pkgs: rebuild-cmake - (cd build && ninja install-pkgs) + cmake --build build --target install-pkgs test: install-pkgs rebuild-cmake - (cd build && ninja check) + cmake --build build --target check # We rebuild the cmake file all the time. # We use "glob" in the cmakefile, and wouldn't otherwise notice if a new @@ -20,6 +20,6 @@ test: install-pkgs rebuild-cmake # It takes <1s on Linux to run cmake, so it doesn't hurt to run it frequently. rebuild-cmake: mkdir -p build - (cd build && cmake .. -G Ninja) + cmake -B build .PHONY: all test rebuild-cmake install-pkgs diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 263aa34..5de877b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -4,8 +4,8 @@ file(GLOB TESTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*_test.toit" "*-test.toit" "*_test_slow.toit" "*-test-slow.toit") -set(TOIT_EXEC "toit.run" CACHE FILEPATH "The executable used to run the tests") -set(TPKG_EXEC "toit.pkg" CACHE FILEPATH "The executable used to install the packages") +set(TOIT_EXEC "toit.run${CMAKE_EXECUTABLE_SUFFIX}" CACHE FILEPATH "The executable used to run the tests") +set(TPKG_EXEC "toit.pkg${CMAKE_EXECUTABLE_SUFFIX}" CACHE FILEPATH "The executable used to install the packages") set(TEST_TIMEOUT 40 CACHE STRING "The maximal amount of time each test is allowed to run") set(TEST_TIMEOUT_SLOW 200 CACHE STRING "The maximal amount of time each test is allowed to run") @@ -21,7 +21,7 @@ ProcessorCount(NUM_CPU) add_custom_target( check - COMMAND ${CMAKE_CTEST_COMMAND} -j${NUM_CPU} -T test --output-on-failure + COMMAND ${CMAKE_CTEST_COMMAND} -j${NUM_CPU} -T test --output-on-failure -C Debug USES_TERMINAL )