Skip to content

Build

Build #46

Workflow file for this run

name: Build
on:
push:
release:
types: [published]
workflow_dispatch:
inputs:
packages:
description: 'list of packages to build'
required: false
type: string
default: ''
jobs:
build-qemu:
name: Build sysroot for ${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
matrix:
arch: [armv7, aarch64, riscv64, s390x, ppc64le]
env:
# For workflow dispatches the value will be overridden by the input.
PACKAGES:
steps:
- name: Set packages variable
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "PACKAGES=${{ github.event.inputs.packages }}" >> $GITHUB_ENV
- uses: uraimo/run-on-arch-action@v2
name: Run commands
id: runcmd
with:
arch: ${{ matrix.arch }}
distro: ubuntu20.04
# Not required, but speeds up builds by storing container images in
# a GitHub package registry.
githubToken: ${{ github.token }}
setup: |
mkdir -p "${PWD}/artifacts"
# Mount the artifacts directory as /artifacts in the container
dockerRunArgs: |
--volume "${PWD}/artifacts:/artifacts"
install: |
apt-get update -q -y
apt-get install -q -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
git \
libssl-dev \
libgpiod-dev \
pkg-config \
python3 \
python3-pip \
python3-setuptools \
python3-wheel \
sudo \
unzip \
wget \
zip \
${{env.PACKAGES}}
shell: /bin/bash
run: |
cd /
shopt -s extglob
tar c -zf /artifacts/sysroot-${{ matrix.arch }}.tar.gz *(lib|include) usr/*(lib|include) usr/local/*(lib|include)
- uses: actions/upload-artifact@v3
with:
name: sysroot
path: artifacts/sysroot-${{ matrix.arch }}.tar.gz
- 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: artifacts/sysroot-${{ matrix.arch }}.tar.gz
tag: ${{ github.ref }}
overwrite: true
build-raspbian:
name: Build sysroot for Raspbian
runs-on: ubuntu-latest
env:
# For workflow dispatches the value will be overridden by the input.
PACKAGES:
steps:
- name: Set packages variable
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "PACKAGES=${{ github.event.inputs.packages }}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Build
run: |
# The sysroot script doesn't like symlinks in the path.
# We shouldn't need it here, but doesn't hurt either.
third_party/rpi/sysroot.py \
--distro raspbian \
--sysroot $(realpath .) \
libc6-dev libstdc++-6-dev \
$PACKAGES
- name: Compress
run: |
# shopt doesn't work for the bash script that is already running.
# Run the command in a child bash instead.
bash <<'EOF'
shopt -s extglob
tar c -zf sysroot-raspbian.tar.gz *(lib|include) usr/*(lib|include)
EOF
- uses: actions/upload-artifact@v3
with:
name: sysroot
path: sysroot-raspbian.tar.gz
- 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: sysroot-raspbian.tar.gz
tag: ${{ github.ref }}
overwrite: true
build-linaro:
name: Build sysroot for Linaro
runs-on: ubuntu-latest
env:
ARM_LINUX_GNUEABI_SYSROOT_URL: https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabi/sysroot-glibc-linaro-2.25-2019.12-arm-linux-gnueabi.tar.xz
ARM_LINUX_GNUEABI_GCC_TOOLCHAIN_URL: https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabi/gcc-linaro-7.5.0-2019.12-i686_arm-linux-gnueabi.tar.xz
steps:
- name: Download
run: |
curl --location --output sysroot.tar.xz $ARM_LINUX_GNUEABI_SYSROOT_URL
curl --location --output gcc.tar.xz $ARM_LINUX_GNUEABI_GCC_TOOLCHAIN_URL
- name: Extract
run: |
tar x --strip-components=1 -f sysroot.tar.xz
tar x --strip-components=1 -f gcc.tar.xz
- name: Compress
shell: bash
run: |
# shopt doesn't work for the bash script that is already running.
# Run the command in a child bash instead.
bash <<'EOF'
shopt -s extglob
tar c -zf sysroot-arm-linux-gnueabi.tar.gz \
*(lib|include) \
usr/*(lib|include) \
arm-linux-gnueabi/*(lib|include) \
arm-linux-gnueabi/libc/*(lib|include) \
arm-linux-gnueabi/libc/usr/*(lib|include)
EOF
- uses: actions/upload-artifact@v3
with:
name: sysroot
path: sysroot-arm-linux-gnueabi.tar.gz
- 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: sysroot-arm-linux-gnueabi.tar.gz
tag: ${{ github.ref }}
overwrite: true