Implement continuous integration. #1
Workflow file for this run
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
name: CI | |
on: | |
push: | |
release: | |
types: [published] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
# The versions should contain (at least) the lowest requirement | |
# and a version that is more up to date. | |
toit-version: [ v2.0.0-alpha.120, latest ] | |
include: | |
- toit-version: v2.0.0-alpha.120 | |
version-name: old | |
- toit-version: latest | |
version-name: new | |
name: CI - ${{ matrix.os }} - ${{ matrix.version-name }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup constants | |
shell: bash | |
run: | | |
TOIT_VERSION=${{ matrix.toit-version }} | |
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 | |
- 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 |