-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Erik Corry
committed
Jan 14, 2024
1 parent
dd2e5a1
commit 3e15f66
Showing
7 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" # Necessary to update action hashs | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
# Allow up to 3 opened pull requests for github-actions versions | ||
open-pull-requests-limit: 3 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
release: | ||
types: [published] | ||
|
||
env: | ||
TOIT_VERSION: v2.0.0-alpha.121 | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
# Zlib in Toit is not available on these platforms yet. | ||
os: [ ubuntu-latest, windows-latest, macos-latest ] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup Toit | ||
id: setup-toit | ||
uses: toitlang/action-setup@v1 | ||
with: | ||
toit-version: ${{ env.TOIT_VERSION }} | ||
|
||
# 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 | ||
- name: Run cmake | ||
shell: bash | ||
run: | | ||
make rebuild-cmake | ||
cmake build | ||
- name: Install packages | ||
run: | | ||
make install-pkgs | ||
- name: Test | ||
run: | | ||
make test |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Zero-Clause BSD License | ||
|
||
# Copyright (C) 2023 Toitware ApS. | ||
|
||
# Permission to use, copy, modify, and/or distribute this software for any | ||
# purpose with or without fee is hereby granted. | ||
|
||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
# FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
# PERFORMANCE OF THIS SOFTWARE. | ||
|
||
name: Publish package | ||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
- 'v[0-9]+.[0-9]+.[0-9]+-*' | ||
jobs: | ||
create-release: | ||
name: Create new release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Publish | ||
uses: toitlang/pkg-publish@v1.4.0 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | ||
# for details. All rights reserved. Use of this source code is governed by a | ||
# BSD-style license that can be found in the LICENSE file. | ||
|
||
cmake_minimum_required(VERSION 3.22) | ||
|
||
# NONE means skip testing the C compiler. | ||
project(case NONE) | ||
|
||
enable_testing() | ||
add_subdirectory(tests) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | ||
# for details. All rights reserved. Use of this source code is governed by a | ||
# BSD-style license that can be found in the LICENSE file. | ||
|
||
.PHONY: all | ||
all: test | ||
|
||
.PHONY: install-pkgs | ||
install-pkgs: rebuild-cmake | ||
(cd build && ninja install-pkgs) | ||
|
||
.PHONY: test | ||
test: install-pkgs rebuild-cmake | ||
(cd build && ninja check) | ||
|
||
# We rebuild the cmake file all the time. | ||
# We use "glob" in the cmakefile, and wouldn't otherwise notice if a new | ||
# file (for example a test) was added or removed. | ||
# It takes <1s on Linux to run cmake, so it doesn't hurt to run it frequently. | ||
.PHONY: rebuild-cmake | ||
rebuild-cmake: | ||
mkdir -p build | ||
(cd build && cmake .. -G Ninja) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | ||
# for details. All rights reserved. Use of this source code is governed by a | ||
# BSD-style license that can be found in the LICENSE file. | ||
|
||
file(GLOB TESTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*-test.toit") | ||
|
||
set(TOITRUN toit.run${CMAKE_EXECUTABLE_SUFFIX} CACHE FILEPATH "The executable used to run the tests") | ||
set(TOITPKG 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(SLOW_TEST_TIMEOUT 200 CACHE STRING "The maximal amount of time each slow test is allowed to run") | ||
|
||
message("TPKG: ${TOITPKG}") | ||
add_custom_target( | ||
"install-pkgs" | ||
COMMAND "${TOITPKG}" install | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
) | ||
|
||
include(ProcessorCount) | ||
ProcessorCount(NUM_CPU) | ||
|
||
add_custom_target( | ||
check | ||
COMMAND ${CMAKE_CTEST_COMMAND} -j${NUM_CPU} -T test --output-on-failure | ||
USES_TERMINAL | ||
) | ||
|
||
set(TEST_PREFIX "") | ||
include(fail.cmake OPTIONAL) | ||
|
||
message("Failing tests: ${FAILING_TESTS}") | ||
message("Skipped tests: ${SKIP_TESTS}") | ||
|
||
foreach(file ${TESTS}) | ||
set(test_name "/tests/${file}") | ||
if("${test_name}" IN_LIST SKIP_TESTS) | ||
continue() | ||
endif() | ||
|
||
add_test( | ||
NAME "${test_name}" | ||
COMMAND ${TOITRUN} "tests/${file}" | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/.. | ||
) | ||
|
||
if ("${file}" MATCHES "slow.toit") | ||
set_tests_properties(${test_name} PROPERTIES TIMEOUT ${SLOW_TEST_TIMEOUT}) | ||
else() | ||
set_tests_properties(${test_name} PROPERTIES TIMEOUT ${TEST_TIMEOUT}) | ||
endif() | ||
|
||
if("${test_name}" IN_LIST FAILING_TESTS) | ||
set_tests_properties("${test_name}" PROPERTIES WILL_FAIL TRUE) | ||
endif() | ||
endforeach() |
File renamed without changes.