Build Environments #20
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: Build Environments | |
on: workflow_dispatch | |
jobs: | |
build-docker: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- platform: linux-arm64 | |
arch: arm64v8 | |
os: linux | |
- platform: linux-arm32 | |
arch: arm32v7 | |
os: linux | |
- platform: linux-x64 | |
arch: x86_64 | |
os: linux | |
- platform: linux-x86 | |
arch: i686 | |
os: linux | |
- platform: win-x64 | |
arch: x86_64 | |
os: win | |
- platform: win-x86 | |
arch: i686 | |
os: win | |
name: ${{ matrix.platform }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: us-east-1 | |
AWS_DEFAULT_OUTPUT: json | |
USE_S3_MIRROR: 1 | |
run: | | |
set -euxo pipefail | |
cd build | |
if [ "${{ matrix.os }}" = "linux" ]; then | |
echo "Downloading Linux System Root." | |
ARCH=${{ matrix.arch }} scripts/sysrootDownload.sh | |
fi | |
echo "Building container." | |
export TIMESTAMP=$(date -u "+%Y%m%d%H%M%S") | |
export IMAGE_TAG=${{ matrix.platform }}-$TIMESTAMP | |
export IMAGE_NAME="ghcr.io/${{ github.repository_owner }}/tmbasic-build-env:$IMAGE_TAG" | |
export PUSH_ONLY=1 | |
./${{ matrix.platform }}.sh | |
echo "Finished building container: $IMAGE_NAME" | |
build-mac: | |
# Our build process requires an M1 Mac; it won't work on an Intel Mac. | |
runs-on: macos-latest-xlarge | |
strategy: | |
matrix: | |
include: | |
- platform: mac-arm64 | |
short_arch: arm64 | |
- platform: mac-x64 | |
short_arch: x64 | |
name: ${{ matrix.platform }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: us-east-1 | |
AWS_DEFAULT_OUTPUT: json | |
USE_S3_MIRROR: 1 | |
run: | | |
set -euxo pipefail | |
# https://github.com/actions/runner-images/issues/8613 | |
echo "Installing AWSCLI." | |
brew install awscli | |
echo "Installing GNU sed." | |
brew install gnu-sed | |
export PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH" | |
echo "Building environment." | |
pushd build | |
./${{ matrix.platform }}.sh | |
popd | |
echo "Archiving environment." | |
export TIMESTAMP=$(date -u "+%Y%m%d%H%M%S") | |
export FILENAME=tmbasic-build-env-${{ matrix.platform }}-$TIMESTAMP.tar.gz | |
tar zcvf "../$FILENAME" "mac-${{ matrix.short_arch }}" | |
echo "Uploading environment tarball." | |
export S3_URL="s3://tmbasic/mac-build-envs/$FILENAME" | |
aws s3 cp "../$FILENAME" $S3_URL | |
echo "Finished building environment: $S3_URL" |