Skip to content

Do a GC when there is an OOM error. (#2313) #8231

Do a GC when there is an OOM error. (#2313)

Do a GC when there is an OOM error. (#2313) #8231

Workflow file for this run

name: CI
on:
push:
branches-ignore:
- "wip/**"
- "wip-**"
- "*/wip-**"
- "*/wip/**"
release:
types: [published]
workflow_dispatch:
env:
ESPTOOL_VERSION: v4.6
jobs:
build:
strategy:
# The matrix will run all possible combinations in parallel.
matrix:
# ubuntu-20.04 so that we don't depend on a recent glibc.
container: [ ubuntu-20.04, macos-latest, windows-latest ]
shard: [1, 2, 3, 4, 5]
include:
- container: ubuntu-20.04
shard: 6
- container: ubuntu-20.04
shard: 7
- container: ubuntu-20.04
shard: 8
runs-on: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up constants
id: constants
shell: bash
run: |
echo "flaky_result=flaky-result/$RUNNER_OS-${{ matrix.shard }}.txt" >> $GITHUB_OUTPUT
echo "flaky_result_name=flaky-result-${{ github.run_id }}-${{ github.run_attempt }}" >> $GITHUB_OUTPUT
echo "external_result=external-result/$RUNNER_OS-${{ matrix.shard }}.txt" >> $GITHUB_OUTPUT
echo "external_result_name=external-result-${{ github.run_id }}-${{ github.run_attempt }}" >> $GITHUB_OUTPUT
echo "debug_root_dir=debug-ci" >> $GITHUB_OUTPUT
echo "debug_dir=debug-ci/$RUNNER_OS-${{ matrix.shard }}" >> $GITHUB_OUTPUT
TOIT_VERSION=$(cmake -DPRINT_VERSION=1 -P tools/gitversion.cmake)
echo $TOIT_VERSION
echo "toit_version=$TOIT_VERSION" >> $GITHUB_OUTPUT
if [ "$RUNNER_OS" == "Linux" ]; then
echo "artifact=toit-linux.tar.gz" >> $GITHUB_OUTPUT
echo "total_shards=8" >> $GITHUB_OUTPUT
elif [ "$RUNNER_OS" == "macOS" ]; then
echo "artifact=toit-macos.tar.gz" >> $GITHUB_OUTPUT
echo "total_shards=5" >> $GITHUB_OUTPUT
elif [ "$RUNNER_OS" == "Windows" ]; then
echo "artifact=toit-windows.tar.gz" >> $GITHUB_OUTPUT
echo "total_shards=5" >> $GITHUB_OUTPUT
else
echo "UNSUPPORTED RUNNER: $RUNNER_OS"
exit 1
fi
# Anything in the debug dir will be uploaded as artifact.
- name: Setup debug dir
shell: sh
run: |
mkdir -p ${{ steps.constants.outputs.debug_dir }}
- name: Setup build environment
uses: ./actions/setup-build
with:
toit-dir: .
- name: Setup compilation env
shell: bash
run: |
echo "SHARD_START=${{ matrix.shard }}" >> $GITHUB_ENV
echo "SHARD_STRIDE=${{ steps.constants.outputs.total_shards }}" >> $GITHUB_ENV
# Build using make.
- name: Build sdk
shell: bash
run: |
ccache -s
make sdk
if [ "$RUNNER_OS" == "Linux" ]; then
make HOST=host32 BUILD_TYPE=Debug sdk
make HOST=host-ctp TOOLCHAIN=host TOIT_CHECK_PROPAGATED_TYPES=1 sdk
fi
ccache -s
# Build 64-bit debug if we are comitting to master.
- name: Build 64-bit debug
if: runner.os == 'Linux' && github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
ccache -s
make BUILD=build-debug BUILD_TYPE=Debug sdk
ccache -s
# Test.
- name: Test
shell: bash # This is crucial, as the powershell doesn't abort when there is an error.
run: |
make test
make test-health
- name: Test flaky
continue-on-error: true
shell: bash # This is crucial, as the powershell doesn't abort when there is an error.
run: |
mkdir -p $(dirname ${{ steps.constants.outputs.flaky_result }})
echo fail > ${{ steps.constants.outputs.flaky_result }}
make test-flaky
# If we reach here, then the test-flaky target succeeded.
echo success > ${{ steps.constants.outputs.flaky_result }}
- name: Test type propagator
if: runner.os == 'Linux'
run: |
make HOST=host-ctp TOIT_CHECK_PROPAGATED_TYPES=1 test
- name: Test 32-bit debug
if: runner.os == 'Linux'
run: |
make HOST=host32 BUILD_TYPE=Debug test
- name: Test 64-bit debug
if: runner.os == 'Linux' && github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
make BUILD=build-debug BUILD_TYPE=Debug test
- name: Test install
if : matrix.shard == 1
shell: bash
run: |
make prefix=$PWD/build/install-out install
build/install-out/bin/toit.run --version
build/install-out/bin/toit.run -s "print 499"
# Test external code.
- name: Test external
# External tests are allowed to fail, but we record them and
# fail a non-required job if they do.
continue-on-error: true
env:
IDF_PATH: ${{ github.workspace }}/third_party/esp-idf
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: '6'
CCACHE_MAXSIZE: 400M
SHARD_START: ${{ matrix.shard }}
SHARD_STRIDE: ${{ steps.constants.outputs.total_shards }}
shell: bash
run: |
# Mark the external test as failing, and update it at the end of this step.
mkdir -p $(dirname ${{ steps.constants.outputs.external_result }})
echo fail > ${{ steps.constants.outputs.external_result }}
make enable-external
find external > ${{ steps.constants.outputs.debug_dir }}/${{ matrix.container }}_${{ matrix.shard }}_files_after_enable_external.log
make test-external
make test-external-health
if [ "$RUNNER_OS" == "Linux" ]; then
cmake -DTOIT_TEST_EXTERNAL=ON build/host32
make HOST=host32 BUILD_TYPE=Debug rebuild-cmake
cd build/host32
ninja check_external
cd ../..
fi
# If we reach here, all steps of this step succeeded.
echo success > ${{ steps.constants.outputs.external_result }}
- name: Store flaky test result
uses: actions/upload-artifact@v3
with:
name: ${{ steps.constants.outputs.flaky_result_name }}
path: ${{ steps.constants.outputs.flaky_result }}
- name: Store external test result
uses: actions/upload-artifact@v3
with:
name: ${{ steps.constants.outputs.external_result_name }}
path: ${{ steps.constants.outputs.external_result }}
- name: Toitdoc - Linux
if: runner.os == 'Linux' && matrix.shard == 1
env:
TOIT_VERSION: ${{ steps.constants.outputs.toit_version }}
TOITLSP: ${{ github.workspace }}/build/host/sdk/bin/toit.lsp
TOITC: ${{ github.workspace }}/build/host/sdk/bin/toit.compile
SDKDIR: ${{ github.workspace }}/
shell: bash
run: |
CPU_CORES=$(nproc)
JSON_OUT_PATH=${{ github.workspace }}/toitdoc_$TOIT_VERSION.json
cd "$SDKDIR"
echo "$TOITLSP" toitdoc -p $CPU_CORES --toitc=$TOITC "--sdk=$SDKDIR" "--out=$JSON_OUT_PATH" --version=$TOIT_VERSION lib
"$TOITLSP" toitdoc -p $CPU_CORES --toitc=$TOITC "--sdk=$SDKDIR" "--out=$JSON_OUT_PATH" --version=$TOIT_VERSION lib
- name: Pack artifacts
if: matrix.shard == 1
shell: bash
# Note that we use `cp -R` first, since that works on every platform.
run: |
cp -R ./build/host/sdk ./build/host/toit
tar -czf build/${{ steps.constants.outputs.artifact }} -C ./build/host --dereference toit
- name: Prepare debug repros
if: always()
continue-on-error: true
shell: bash
run: |
ls /tmp/lsp_repro-* || true
REPRO_DIR=${{ steps.constants.outputs.debug_dir }}/repros
mkdir -p $REPRO_DIR
find /tmp -maxdepth 1 -name 'lsp_repro-*' -exec cp -r {} $REPRO_DIR \;
ls $REPRO_DIR
- name: Upload debug artifacts
if: always()
continue-on-error: true
uses: actions/upload-artifact@v3
with:
name: debug
path: ${{ steps.constants.outputs.debug_root_dir }}
retention-days: 5
if-no-files-found: ignore
- name: Upload toitdoc - Linux
if: runner.os == 'Linux' && matrix.shard == 1
uses: actions/upload-artifact@v3
with:
name: toitdoc
path: toitdoc_${{ steps.constants.outputs.toit_version }}.json
- name: Authenticate to Google cloud - Linux
if: |
runner.os == 'Linux' && matrix.shard == 1 &&
github.repository_owner == 'toitlang'
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.INFRASTRUCTURE_SERVICE_ACCOUNT_JSON_KEY }}
service_account: github-action@infrastructure-220307.iam.gserviceaccount.com
- name: Set up Cloud SDK
if: |
runner.os == 'Linux' && matrix.shard == 1 &&
github.repository_owner == 'toitlang'
uses: google-github-actions/setup-gcloud@v2
with:
project_id: infrastructure-220307
- name: Upload toitdoc to gcloud - Linux
if: |
runner.os == 'Linux' && matrix.shard == 1 &&
github.repository_owner == 'toitlang'
env:
TOIT_VERSION: ${{ steps.constants.outputs.toit_version }}
run: |
JSON_PATH=${{ github.workspace }}/toitdoc_$TOIT_VERSION.json
echo -n $TOIT_VERSION > LATEST.tmp
gsutil cp $JSON_PATH gs://toit-web/toitdoc-sdk/$TOIT_VERSION.json
gsutil cp LATEST.tmp gs://toit-web/toitdoc-sdk/LATEST
- name: Update RELEASE in gcloud - Linux
if: |
runner.os == 'Linux' && matrix.shard == 1 &&
github.event_name == 'release' &&
github.repository_owner == 'toitlang'
env:
TOIT_VERSION: ${{ steps.constants.outputs.toit_version }}
run: |
echo -n $TOIT_VERSION > LATEST.tmp
gsutil cp LATEST.tmp gs://toit-web/toitdoc-sdk/RELEASED
gsutil cp LATEST.tmp gs://toit-web/toitdoc-sdk/RELEASED.$TOIT_VERSION
- name: Upload unsigned artifacts - Windows
if: runner.os == 'Windows' && matrix.shard == 1
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-build-unsigned
path: build/${{ steps.constants.outputs.artifact }}
- name: Upload artifacts - Linux/macOS
if: runner.os != 'Windows' && matrix.shard == 1
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-build
path: build/${{ steps.constants.outputs.artifact }}
# Really annoying that we need to duplicate so much.
esp32:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up build environment
uses: ./actions/setup-build
with:
toit-dir: .
esp32: true
# Build using make.
- name: make
run: |
ccache -s
source third_party/esp-idf/export.sh
# Install the Python packages necessary for MbedTLS after
# setting up the virtual Python environment.
pip install jsonschema jinja2
make esp32
make ESP32_CHIP=esp32c3 esp32
make ESP32_CHIP=esp32s2 esp32
make ESP32_CHIP=esp32s3 esp32
ccache -s
- name: Pack firmware artifacts
shell: bash
run: |
gzip --to-stdout build/esp32/firmware.envelope > build/firmware-esp32.gz
gzip --to-stdout build/esp32c3/firmware.envelope > build/firmware-esp32c3.gz
gzip --to-stdout build/esp32s2/firmware.envelope > build/firmware-esp32s2.gz
gzip --to-stdout build/esp32s3/firmware.envelope > build/firmware-esp32s3.gz
- name: Upload firmware artifacts
uses: actions/upload-artifact@v3
with:
name: firmwares
path: |
build/firmware-esp32.gz
build/firmware-esp32c3.gz
build/firmware-esp32s2.gz
build/firmware-esp32s3.gz
- name: Upload ESP32 release firmware artifacts
if: |
github.event_name == 'release' &&
github.repository_owner == 'toitlang'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/firmware-esp32.gz
tag: ${{ github.event.release.tag_name }}
overwrite: true
- name: Upload ESP32-C3 release firmware artifacts
if: |
github.event_name == 'release' &&
github.repository_owner == 'toitlang'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/firmware-esp32c3.gz
tag: ${{ github.event.release.tag_name }}
overwrite: true
- name: Upload ESP32-S2 release firmware artifacts
if: |
github.event_name == 'release' &&
github.repository_owner == 'toitlang'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/firmware-esp32s2.gz
tag: ${{ github.event.release.tag_name }}
overwrite: true
- name: Upload ESP32-S3 release firmware artifacts
if: |
github.event_name == 'release' &&
github.repository_owner == 'toitlang'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/firmware-esp32s3.gz
tag: ${{ github.event.release.tag_name }}
overwrite: true
# Really annoying that we need to duplicate so much.
cross:
runs-on: ubuntu-latest
steps:
- name: Set up constants
id: constants
shell: bash
run: |
echo raspberry_pi_artifact=toit-rpi.tar.gz >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up build environment
uses: ./actions/setup-build
with:
toit-dir: .
cache-key-prefix: cross
- name: Install mingw
run: |
sudo apt-get install mingw-w64
- name: Make
run: |
make TARGET=win64 sdk
make raspbian
make aarch64
make arm-linux-gnueabi
- name: Test executables 32-bit
uses: pguyot/arm-runner-action@v2
with:
cpu: cortex-a7
base_image: "raspios_lite:2022-01-28"
bind_mount_repository: true
commands: |
uname -m > pi_uname
build/raspbian/sdk/bin/toit.pkg version
build/raspbian/sdk/bin/toit.run --version
build/raspbian/sdk/tools/firmware --help
- name: Test executables 64-bit
uses: pguyot/arm-runner-action@v2
with:
cpu: cortex-a7
base_image: "raspios_lite_arm64:2022-01-28"
bind_mount_repository: true
commands: |
uname -m > pi_uname
build/aarch64/sdk/bin/toit.pkg version
build/aarch64/sdk/bin/toit.run --version
build/aarch64/sdk/tools/firmware --help
- 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/${{ steps.constants.outputs.raspberry_pi_artifact }} -C ./build/raspbian --dereference toit
cp -R ./build/aarch64/sdk ./build/aarch64/toit
tar -czf build/toit-aarch64.tar.gz -C ./build/aarch64 --dereference toit
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-build
path: |
build/${{ steps.constants.outputs.raspberry_pi_artifact }}
build/toit-aarch64.tar.gz
combine:
needs: [build, cross]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: Windows-build-unsigned
- uses: actions/download-artifact@v3
with:
name: Linux-build
- uses: actions/download-artifact@v3
with:
name: macOS-build
- name: Unpack SDKs
run: |
for os in windows linux macos rpi aarch64; do
mkdir -p $os
tar x -zf toit-$os.tar.gz -C $os
done
- name: Copy vessels
run: |
mkdir -p vessels
for source in windows linux macos rpi aarch64; do
# Use same values as Go.
if [ "$source" == "windows" ]; then
CROSS_OS=windows
CROSS_ARCH=amd64
elif [ "$source" == "linux" ]; then
CROSS_OS=linux
CROSS_ARCH=amd64
elif [ "$source" == "macos" ]; then
CROSS_OS=darwin
CROSS_ARCH=amd64
elif [ "$source" == "rpi" ]; then
CROSS_OS=linux
CROSS_ARCH=arm
elif [ "$source" == "aarch64" ]; then
CROSS_OS=linux
CROSS_ARCH=arm64
else
echo "Unknown source: $source"
exit 1
fi
mkdir -p vessels/$CROSS_OS/$CROSS_ARCH
cp $source/toit/vessels/vessel* vessels/$CROSS_OS/$CROSS_ARCH
for target in windows linux macos rpi aarch64; do
if [ "$source" == "$target" ]; then
continue
fi
mkdir -p $target/toit/vessels/$CROSS_OS/$CROSS_ARCH
cp $source/toit/vessels/vessel* $target/toit/vessels/$CROSS_OS/$CROSS_ARCH
done
done
- name: Create vessels artifact
run: |
tar c -zf vessels.tar.gz vessels
- name: Download esptools
run: |
for arch in arm arm64 linux-amd64 macos win64; do
curl -O -L https://github.com/espressif/esptool/releases/download/$ESPTOOL_VERSION/esptool-$ESPTOOL_VERSION-$arch.zip
unzip esptool-$ESPTOOL_VERSION-$arch.zip
EXTENSION=""
if [[ "$arch" = "arm" ]]; then
TARGET=rpi
elif [[ "$arch" = "arm64" ]]; then
TARGET=aarch64
elif [[ "$arch" = "linux-amd64" ]]; then
TARGET=linux
elif [[ "$arch" = "macos" ]]; then
TARGET=macos
elif [[ "$arch" = "win64" ]]; then
TARGET=windows
EXTENSION=.exe
fi
cp esptool-$ESPTOOL_VERSION-$arch/esptool$EXTENSION $TARGET/toit/tools/esptool$EXTENSION
chmod +x $TARGET/toit/tools/esptool$EXTENSION
done
- name: Compress SDKs
run: |
for os in windows linux macos rpi aarch64; do
tar c -zf toit-$os.tar.gz -C $os toit
done
- name: Upload vessels
uses: actions/upload-artifact@v3
with:
name: vessels
path: vessels.tar.gz
- name: Upload Windows unsigned
uses: actions/upload-artifact@v3
with:
name: Windows-build-unsigned
path: toit-windows.tar.gz
- name: Upload Linux
uses: actions/upload-artifact@v3
with:
name: Linux-build
path: |
toit-linux.tar.gz
toit-rpi.tar.gz
toit-aarch64.tar.gz
- name: Upload macOS
uses: actions/upload-artifact@v3
with:
name: macOS-build
path: toit-macos.tar.gz
- name: Upload release vessels
if: |
github.event_name == 'release' &&
github.repository_owner == 'toitlang'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: vessels.tar.gz
tag: ${{ github.event.release.tag_name }}
overwrite: true
- name: Upload release Linux
if: |
github.event_name == 'release' &&
github.repository_owner == 'toitlang'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: toit-linux.tar.gz
tag: ${{ github.event.release.tag_name }}
overwrite: true
- name: Upload release macOS
if: |
github.event_name == 'release' &&
github.repository_owner == 'toitlang'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: toit-macos.tar.gz
tag: ${{ github.event.release.tag_name }}
overwrite: true
- name: Upload release Raspberry Pi 32-bit
if: |
github.event_name == 'release' &&
github.repository_owner == 'toitlang'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: toit-rpi.tar.gz
tag: ${{ github.event.release.tag_name }}
overwrite: true
- name: Upload release aarch64
if: |
github.event_name == 'release' &&
github.repository_owner == 'toitlang'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: toit-aarch64.tar.gz
tag: ${{ github.event.release.tag_name }}
overwrite: true
sign_windows:
runs-on: windows-latest
needs: [combine]
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: Windows-build-unsigned
- name: Decompress
run: |
& "C:\Program Files\Git\bin\bash.exe" --noprofile --norc -e -o pipefail -c "tar -xzf toit-windows.tar.gz"
- name: Sign Windows binary
uses: toitlang/action-code-sign@5da128f4fb4f719c1b667867815f6c31e743b111 # v1.1.0
with:
certificate: ${{ secrets.DIGICERT_CERTIFICATE }}
api-key: ${{ secrets.DIGICERT_API_KEY }}
certificate-password: ${{ secrets.DIGICERT_PASSWORD }}
certificate-fingerprint: ${{ secrets.DIGICERT_FINGERPRINT }}
keypair-alias: ${{ vars.DIGICERT_KEYPAIR_ALIAS }}
path: toit/bin
- name: Sign Windows tools
uses: toitlang/action-code-sign@5da128f4fb4f719c1b667867815f6c31e743b111 # v1.1.0
with:
certificate: ${{ secrets.DIGICERT_CERTIFICATE }}
api-key: ${{ secrets.DIGICERT_API_KEY }}
certificate-password: ${{ secrets.DIGICERT_PASSWORD }}
certificate-fingerprint: ${{ secrets.DIGICERT_FINGERPRINT }}
keypair-alias: ${{ vars.DIGICERT_KEYPAIR_ALIAS }}
path: toit/tools
- name: Compress
run: |
& "C:\Program Files\Git\bin\bash.exe" --noprofile --norc -e -o pipefail -c "tar -czf toit-windows.tar.gz toit"
- name: Version number
id: version
shell: powershell
run: |
$versionV = "${{ github.event.release.tag_name }}"
$version = $versionV.Substring(1)
echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Build installer
run: |
& tools\windows_installer\build.bat ${{ steps.version.outputs.version }} $PWD\toit $PWD\toit-windows-x64-installer.exe
- name: Sign Windows installer
uses: toitlang/action-code-sign@5da128f4fb4f719c1b667867815f6c31e743b111 # v1.1.0
with:
certificate: ${{ secrets.DIGICERT_CERTIFICATE }}
api-key: ${{ secrets.DIGICERT_API_KEY }}
certificate-password: ${{ secrets.DIGICERT_PASSWORD }}
certificate-fingerprint: ${{ secrets.DIGICERT_FINGERPRINT }}
keypair-alias: ${{ vars.DIGICERT_KEYPAIR_ALIAS }}
path: toit-windows-x64-installer.exe
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Windows-build
path: |
toit-windows.tar.gz
toit-windows-x64-installer.exe
- name: Upload release artifacts
if: github.event_name == 'release' &&
github.repository_owner == 'toitlang'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: toit-windows.tar.gz
tag: ${{ github.event.release.tag_name }}
overwrite: true
- name: Upload release installer
if: github.event_name == 'release' &&
github.repository_owner == 'toitlang'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: toit-windows-x64-installer.exe
tag: ${{ github.event.release.tag_name }}
overwrite: true
external-and-flaky:
needs: build
runs-on: ubuntu-latest
steps:
- name: Set up constants
id: constants
shell: bash
run: |
echo flaky_result_dir=flaky-result >> $GITHUB_OUTPUT
echo flaky_result_name=flaky-result-${{ github.run_id }}-${{ github.run_attempt }} >> $GITHUB_OUTPUT
echo external_result_dir=external-result >> $GITHUB_OUTPUT
echo external_result_name=external-result-${{ github.run_id }}-${{ github.run_attempt }} >> $GITHUB_OUTPUT
- name: Retrieve
uses: actions/download-artifact@v3
with:
name: ${{ steps.constants.outputs.flaky_result_name }}
path: flaky-result
- name: Retrieve
uses: actions/download-artifact@v3
with:
name: ${{ steps.constants.outputs.external_result_name }}
path: external-result
- name: List downloaded files
# This is mostly for debugging purposes.
shell: bash
run: |
find .
- name: Check external
shell: bash
run: |
cat external-result/*
grep "fail" external-result/* && exit 1
# If we get here, we didn't find any failures but
# the exit code of the grep is still 1 or 2. Echo
# something to make it clear and avoid letting the
# result of the action be non-zero.
echo "success: no failures found"
- name: Check flaky
# Even if the external result already failed we want to know whether flaky tests failed
# as well.
# Since the two steps aren't dependent always run this step.
if: always()
shell: bash
run: |
cat flaky-result/*
grep "fail" flaky-result/* && exit 1
# If we get here, we didn't find any failures but
# the exit code of the grep is still 1 or 2. Echo
# something to make it clear and avoid letting the
# result of the action be non-zero.
echo "success: no failures found"
AUR:
name: Update AUR package
runs-on: ubuntu-latest
needs: [combine]
if: github.event_name == 'release' &&
!github.event.release.prerelease &&
github.repository_owner == 'toitlang'
steps:
# This shouldn't be necessary, but the archlinux-package-action
# doesn't work without it.
- uses: actions/checkout@v4
- name: Version number
id: version
shell: bash
run: |
VERSION="${{ github.event.release.tag_name }}"
echo "version=$VERSION" >> $GITHUB_ENV
- name: Ssh
env:
AUR_SSH_KEY: ${{ secrets.AUR_SSH_KEY }}
run: |
echo "$AUR_SSH_KEY" > ${{ github.workspace }}/aur_ssh_key
chmod 600 ${{ github.workspace }}/aur_ssh_key
mkdir -p $HOME/.ssh
echo "Host aur.archlinux.org" >> $HOME/.ssh/config
echo " IdentityFile ${{ github.workspace }}/aur_ssh_key" >> $HOME/.ssh/config
echo " User aur" >> $HOME/.ssh/config
ssh-keyscan -H aur.archlinux.org > $HOME/.ssh/known_hosts
- name: Fetch AUR packages
run: |
git clone ssh://aur@aur.archlinux.org/toit.git
git clone ssh://aur@aur.archlinux.org/toit-vessels-bin.git
- name: Configure git
run: |
pushd toit
git config user.email "leon@toit.io"
git config user.name "Leon Gungadin Mogensen"
popd
pushd toit-vessels-bin
git config user.email "leon@toit.io"
git config user.name "Leon Gungadin Mogensen"
popd
- name: Update AUR packages
shell: bash
run: |
# Toit's PKGBUILD is a bit special in that we don't download
# a tarball (since those don't contain submodules), but instead
# use Git to get the source code.
# For security, we store the hash of the commit in the PKGBUILD,
# which is why we run a custom 'update_hash.sh' script.
# This is the reason we can't just use the 'archlinux-package-action'.
pushd toit
sed -i "s/_tag=.*/_tag=\"${{ env.version }}\"/g" PKGBUILD
sed -i "s/pkgrel=.*/pkgrel=1/g" PKGBUILD
./update_hash.sh
popd
# The vessel PKGBUILD also needs the '_tag' replaced instead of
# the usual 'pkgver'.
pushd toit-vessels-bin
sed -i "s/_tag=.*/_tag=\"${{ env.version }}\"/g" PKGBUILD
popd
- name: Update .SRCINFO for toit
uses: toitlang/archlinux-package-action@main
with:
path: toit
flags: ''
namcap: false
srcinfo: true
- name: Update pkgsums and .SRCINFO for toit-vessels-bin
uses: toitlang/archlinux-package-action@main
with:
path: toit-vessels-bin
flags: ''
namcap: false
updpkgsums: true
srcinfo: true
- name: Upload toit and toit-vessels-bin
run: |
pushd toit
cat PKGBUILD
cat .SRCINFO
git commit -am "Update to version ${{ env.version }}"
git push origin master
popd
pushd toit-vessels-bin
cat PKGBUILD
cat .SRCINFO
git commit -am "Update to version ${{ env.version }}"
git push origin master
popd