Skip to content

Only run serial.

Only run serial. #9783

Workflow file for this run

name: CI
on:
schedule:
- cron: '00 2 * * *' # 02:00 UTC
push:
branches-ignore:
- "wip/**"
- "wip-**"
- "*/wip-**"
- "*/wip/**"
release:
types: [published]
workflow_dispatch:
inputs:
# Use 'inputs.<name>' when pasting into a bash `if`, like so:
# if [[ "${{ inputs.strip }}" == 'true' ]]; then ...
#
# When using to guard a step, use 'github.event.inputs.<name>', like so:
# if: ${{ github.event.inputs.<name> == 'true' }}
# or
# if: ${{ github.event.inputs.<name> != 'false' }}
# In the first case, the step will not run if there isn't any workflow dispatch.
# In the second case, the step will run if there isn't any workflow dispatch.
# As such, the recommendation is to use the `== true` if the default is
# false, and the `!= false` if the default is true.
strip:
description: "Strip executables"
required: false
type: boolean
default: false
sign-macos:
description: "Sign macOS executables"
required: false
type: boolean
default: false
build-arm-macos:
description: "Build ARM macOS executables"
required: false
type: boolean
default: false
dispatch-toitdocs:
description: "Dispatch toitdoc rebuild"
required: false
type: boolean
default: false
run-tests:
description: "Run tests"
required: false
type: boolean
default: true
test-more:
description: "Run more tests"
required: false
type: boolean
default: false
run-esp32-flow:
description: "Run the ESP32 flow"
required: false
type: boolean
default: true
do-release:
description: "Build release artifacts and upload with this version"
required: false
type: string
default:
enable-lto:
description: "Enable link-time optimizations"
required: false
type: boolean
default: false
env:
TOIT_VERSION: ${{ github.event.inputs.do-release || github.event.release.tag_name || '' }}
DO_RELEASE: ${{ github.event_name == 'release' || startsWith(github.event.inputs.do-release, 'v') }}
DO_MORE_TESTS: ${{ github.event_name == 'schedule' || github.event.inputs.test-more == 'true' }}
ESPTOOL_VERSION: "v4.8.1%2Btoitlang"
TEST_PI_HW: "true"
jobs:
prereqs:
runs-on: ubuntu-latest
steps:
- name: Set strategy variables
id: vars
run: |
# ubuntu-20.04 so that we don't depend on a recent glibc.
# macos-13, since it's still intel based.
if [[ "${{ github.ref }}" == 'refs/heads/master' || \
"${{ env.DO_RELEASE }}" == "true" || \
"${{ inputs.build-arm-macos }}" == "true" || \
"${{ inputs.sign-macos }}" == "true" \
]]; then
echo 'CONTAINERS=[ "ubuntu-20.04", "macos-13", "macos-latest", "windows-latest" ]' > $GITHUB_OUTPUT
else
echo 'CONTAINERS=[ "ubuntu-20.04", "macos-13", "windows-latest" ]' > $GITHUB_OUTPUT
fi
if [[ "${{ inputs.run-tests }}" != "false" ]]; then
echo 'SHARDS=[1, 2, 3, 4, 5]' >> $GITHUB_OUTPUT
echo 'EXTRA_INCLUDES=[{"container": "ubuntu-20.04", "shard": 6}, {"container": "ubuntu-20.04", "shard": 7}, {"container": "ubuntu-20.04", "shard": 8}]' >> $GITHUB_OUTPUT
echo 'SHARD_COUNT=5' >> $GITHUB_OUTPUT
echo 'SHARD_COUNT_LINUX=8' >> $GITHUB_OUTPUT
else
echo 'SHARDS=[1]' >> $GITHUB_OUTPUT
echo 'EXTRA_INCLUDES=[]' >> $GITHUB_OUTPUT
echo 'SHARD_COUNT=1' >> $GITHUB_OUTPUT
fi
outputs:
CONTAINERS: ${{ steps.vars.outputs.CONTAINERS }}
SHARDS: ${{ steps.vars.outputs.SHARDS }}
EXTRA_INCLUDES: ${{ steps.vars.outputs.EXTRA_INCLUDES }}
SHARD_COUNT: ${{ steps.vars.outputs.SHARD_COUNT }}
SHARD_COUNT_LINUX: ${{ steps.vars.outputs.SHARD_COUNT_LINUX }}
TEST_PI_HW: ${{ env.TEST_PI_HW }}
rpi:
runs-on: ubuntu-latest
needs: prereqs
if: needs.prereqs.outputs.TEST_PI_HW == 'true'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set version
run: |
if [ -z "$TOIT_VERSION" ]; then
TOIT_VERSION=$(cmake -DPRINT_VERSION=1 -P tools/gitversion.cmake)
fi
echo "TOIT_GIT_VERSION=$TOIT_VERSION" >> $GITHUB_ENV
- name: Set up build environment
uses: ./actions/setup-build
with:
toit-dir: .
cache-key-prefix: cross-pi
- name: Make
# Note that the TOIT_GIT_VERSION is set. The make step will thus not
# compute the version from git.
run: |
make raspbian
- name: Pack artifacts
shell: bash
# Note that we use `cp -R` first, since that works on every platform.
run: |
cp -R ./build/raspbian/sdk ./build/raspbian/toit
tar -czf build/rpi.tar.gz -C ./build/raspbian --dereference toit
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: rpi-build
path: |
build/rpi.tar.gz
serial:
needs: [prereqs, rpi]
if: needs.prereqs.outputs.TEST_PI_HW == 'true'
runs-on: serial
steps:
- name: Clean workspace
run: |
rm -rf ${{ github.workspace }}/*
- uses: actions/checkout@v4
# Download the pi artifact.
- uses: actions/download-artifact@v4
with:
name: rpi-build
- name: Unpack Raspberry Pi
run: |
mkdir -p rpi
tar x -zf rpi.tar.gz -C rpi
- name: Test Raspberry Pi
run: |
# Get the pin configuration from the file in the runner's home.
source $HOME/pi-test.env
make PI_TOIT_EXE=${{ github.workspace }}/rpi/toit/bin/toit test-serial