diff --git a/.github/workflows/autotag.yaml b/.github/workflows/autotag.yaml index 38d67d1..f798922 100644 --- a/.github/workflows/autotag.yaml +++ b/.github/workflows/autotag.yaml @@ -32,7 +32,7 @@ jobs: steps: - name: Check pull request id: check-pr - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: retries: 3 script: | @@ -87,28 +87,28 @@ jobs: core.setOutput('PULL_SHA', pullSHA) - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 if: ${{ steps.check-pr.outputs.RELEASE_TYPE != '' }} with: fetch-depth: 0 # Ref: https://github.com/actions/checkout/issues/100 - name: Get current tag id: current-tag - uses: "WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce" # v1.4.0 - latest as of 2025-04-27 + uses: "WyriHaximus/github-action-get-previous-tag@61819f33034117e6c686e6a31dba995a85afc9de" # v2.0.0 - latest as of 2026-03-21 if: ${{ steps.check-pr.outputs.RELEASE_TYPE != '' }} with: fallback: v0.0.0 - name: Determine next semver version id: next-semver-version - uses: madhead/semver-utils@36d1e0ed361bd7b4b77665de8093092eaeabe6ba # v4.3.0 - latest as of 2025-04-27 + uses: madhead/semver-utils@36d1e0ed361bd7b4b77665de8093092eaeabe6ba # v4.3.0 - latest as of 2026-03-21 if: ${{ steps.check-pr.outputs.RELEASE_TYPE != '' }} with: version: ${{ steps.current-tag.outputs.tag }} - name: Determine next tag id: next-tag - uses: actions/github-script@v7 + uses: actions/github-script@v8 if: ${{ steps.check-pr.outputs.RELEASE_TYPE != '' }} with: script: | @@ -141,7 +141,7 @@ jobs: steps: - name: Create tag id: create-tag - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: github-token: ${{ secrets.PAT_WORKFLOW }} retries: 3 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3756291..7a6e5fe 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -30,7 +30,7 @@ jobs: steps: - name: Check release tag id: check-tag - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: script: | console.log('github.event_name', '${{ github.event_name }}') @@ -51,7 +51,7 @@ jobs: - name: Check tag semver id: check-tag-semver - uses: madhead/semver-utils@36d1e0ed361bd7b4b77665de8093092eaeabe6ba # v4.3.0 - latest as of 2025-04-27 + uses: madhead/semver-utils@36d1e0ed361bd7b4b77665de8093092eaeabe6ba # v4.3.0 - latest as of 2026-03-21 if: ${{ steps.check-tag.outputs.RELEASE_TAG != '' }} with: version: ${{ steps.check-tag.outputs.RELEASE_TAG }} @@ -63,7 +63,7 @@ jobs: if: ${{ needs.check.outputs.RELEASE_TAG != '' }} steps: - name: Make a release - uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2 - latest as of 2025-04-27 + uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1 - latest as of 2026-03-21 if: github.event.inputs.dryRun != 'true' with: tag_name: ${{ needs.check.outputs.RELEASE_TAG }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9b55164..99196b3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -28,8 +28,44 @@ on: default: test jobs: - + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Install mise + run: | + curl https://mise.run | sh + mise settings experimental=true + + - name: Trust workspace + run: mise trust + + - name: Install dependencies + run: mise exec -- mise install + + - name: Configure project + run: mise exec -- make configure + + - name: Run formatting checks + run: mise exec -- make format + + - name: Run lint + run: mise exec -- make lint + + - name: Run static analysis + run: mise exec -- make check + + - name: Build project + run: mise exec -- make build + + - name: Run tests + run: mise exec -- make test + test-amd64: + needs: test runs-on: ubuntu-latest strategy: matrix: @@ -42,15 +78,15 @@ jobs: steps: - name: Docker Setup QEMU if: matrix.platform != 'linux/amd64' - uses: docker/setup-qemu-action@v3.6.0 # v3.6.0 - latest as of 2025-04-27 + uses: docker/setup-qemu-action@v4 # v4 - latest as of 2026-03-21 with: platforms: all - name: Docker Setup Buildx - uses: docker/setup-buildx-action@v3.10.0 # v3.10.0 - latest as of 2025-04-27 + uses: docker/setup-buildx-action@v4 # v4 - latest as of 2026-03-21 - name: Checkout code - uses: actions/checkout@v4 # v4.2.2 - latest as of 2025-04-27 + uses: actions/checkout@v6 - name: Create Buildx run: | @@ -74,6 +110,7 @@ jobs: done test-arm64: + needs: test runs-on: ubuntu-24.04-arm strategy: matrix: @@ -100,10 +137,10 @@ jobs: steps: - name: Docker Setup Buildx - uses: docker/setup-buildx-action@v3.10.0 # v3.10.0 - latest as of 2025-04-27 + uses: docker/setup-buildx-action@v4 # v4 - latest as of 2026-03-21 - name: Checkout code - uses: actions/checkout@v4 # v4.2.2 - latest as of 2025-04-27 + uses: actions/checkout@v6 - name: Create Buildx run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f4e4c9..6a4a09b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,7 +98,7 @@ if(BUILD_TESTS) enable_testing() foreach(t app config debug error test) - add_executable(tl_${t}_test tests/arch/generic/tl_${t}_test.c) + add_executable(tl_${t}_test tests/unit/tl_${t}_test.c) target_link_libraries(tl_${t}_test unity tinyclib) add_test(NAME tl_${t}_test COMMAND tl_${t}_test) endforeach() diff --git a/Makefile b/Makefile index 8c786dc..f25d1a4 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ CPPCHECK := $(shell if command -v cppcheck >/dev/null 2>&1; then echo cppcheck; CLANG_TIDY_EXTRA_ARGS := $(shell if [ "$$(uname)" = "Darwin" ]; then echo "--extra-arg=--sysroot=$$(xcrun --show-sdk-path)"; fi) SRC_FILES := src/*.c include/*.h -TEST_FILES := tests/arch/generic/*.c +TEST_FILES := tests/unit/*.c ALL_FILES := $(SRC_FILES) $(TEST_FILES) help: ## Show available make targets @@ -18,14 +18,15 @@ configure: ## Configure cmake cmake --preset default build: ## Build the project + @test -d "$(BUILD_DIR)" || cmake --preset default cmake --build --preset default clean: ## Remove build directory @test -n "$(CURDIR)" && [ "$(CURDIR)" != "/" ] rm -rf "$(CURDIR)/$(BUILD_DIR)" -test: ## Build and run tests - cmake --workflow --preset default +test: ## Run tests + ctest --preset default format: ## Check code formatting @test -n "$(CLANG_FORMAT)" || { echo "error: clang-format not found"; exit 1; } @@ -34,7 +35,7 @@ format: ## Check code formatting lint: ## Check code linting @test -n "$(CLANG_TIDY)" || { echo "error: clang-tidy not found"; exit 1; } $(CLANG_TIDY) -p $(BUILD_DIR) $(CLANG_TIDY_EXTRA_ARGS) \ - --header-filter="^$(CURDIR)/(src|include|tests)/" src/*.c tests/arch/generic/*.c + --header-filter="^$(CURDIR)/(src|include|tests)/" src/*.c tests/unit/*.c check: ## Static analysis @test -n "$(CPPCHECK)" || { echo "error: cppcheck not found"; exit 1; } diff --git a/mise.toml b/mise.toml index df13554..1d7b474 100644 --- a/mise.toml +++ b/mise.toml @@ -5,6 +5,6 @@ cmake = "4.3.0" "conda:make" = "4.4.1" ninja = "1.13.2" -"pipx:clang-format" = "latest" -"pipx:clang-tidy" = "latest" -"pipx:cppcheck" = "latest" +"pipx:clang-format" = "22.1.1" +"pipx:clang-tidy" = "22.1.0" +"pipx:cppcheck" = "1.5.1" diff --git a/tests/arch/generic/tl_app_test.c b/tests/unit/tl_app_test.c similarity index 100% rename from tests/arch/generic/tl_app_test.c rename to tests/unit/tl_app_test.c diff --git a/tests/arch/generic/tl_config_test.c b/tests/unit/tl_config_test.c similarity index 100% rename from tests/arch/generic/tl_config_test.c rename to tests/unit/tl_config_test.c diff --git a/tests/arch/generic/tl_debug_test.c b/tests/unit/tl_debug_test.c similarity index 100% rename from tests/arch/generic/tl_debug_test.c rename to tests/unit/tl_debug_test.c diff --git a/tests/arch/generic/tl_error_test.c b/tests/unit/tl_error_test.c similarity index 100% rename from tests/arch/generic/tl_error_test.c rename to tests/unit/tl_error_test.c diff --git a/tests/arch/generic/tl_test_test.c b/tests/unit/tl_test_test.c similarity index 100% rename from tests/arch/generic/tl_test_test.c rename to tests/unit/tl_test_test.c