-
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.
Merge remote-tracking branch 'gitorigin/main' into fix-canvas-type
- Loading branch information
Showing
84 changed files
with
1,123 additions
and
415 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,97 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
release: | ||
types: [published] | ||
|
||
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@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup constants | ||
shell: bash | ||
run: | | ||
TOIT_VERSION=v2.0.0-alpha.107 | ||
echo "TOIT_VERSION=$TOIT_VERSION" >> $GITHUB_ENV | ||
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 | ||
if [[ $TOIT_VERSION = latest ]]; then | ||
echo "TOIT_URL=https://github.com/toitlang/toit/releases/latest/download/$TOIT_FILE" >> $GITHUB_ENV | ||
else | ||
echo "TOIT_URL=https://github.com/toitlang/toit/releases/download/$TOIT_VERSION/$TOIT_FILE" >> $GITHUB_ENV | ||
fi | ||
# 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/[email protected] | ||
name: Download Toit | ||
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 | ||
- 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
*.swp | ||
*.swo | ||
.packages |
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,10 @@ | ||
# Copyright (C) 2023 Toitware ApS. | ||
# Use of this source code is governed by a Zero-Clause BSD license that can | ||
# be found in the tests/TESTS_LICENSE file. | ||
|
||
cmake_minimum_required(VERSION 3.22) | ||
|
||
project(cli) | ||
|
||
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,25 @@ | ||
# Copyright (C) 2023 Toitware ApS. | ||
# Use of this source code is governed by a Zero-Clause BSD license that can | ||
# be found in the tests/LICENSE file. | ||
|
||
all: test | ||
|
||
.PHONY: build/host/CMakeCache.txt | ||
build/CMakeCache.txt: | ||
$(MAKE) rebuild-cmake | ||
|
||
install-pkgs: rebuild-cmake | ||
(cd build && ninja install-pkgs) | ||
|
||
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. | ||
rebuild-cmake: | ||
mkdir -p build | ||
(cd build && cmake .. -G Ninja) | ||
|
||
.PHONY: all test rebuild-cmake install-pkgs |
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
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
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
Oops, something went wrong.