TMBASIC #39
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: TMBASIC | |
on: [workflow_dispatch] | |
jobs: | |
build-runner-docker: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- platform: linux-arm64 | |
- platform: linux-arm32 | |
- platform: linux-x64 | |
- platform: linux-x86 | |
- platform: win-x64 | |
- platform: win-x86 | |
name: Runner (${{ matrix.platform }}) | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- 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: | |
NO_BUILD: 1 | |
TTY_FLAG: " " | |
run: | | |
set -euxo pipefail | |
export IMAGE_TAG=$(awk -F= '{ if ($1 == "build-environment-${{ matrix.platform }}") print $2 }' build/tags.ini) | |
export IMAGE_NAME="ghcr.io/electroly/tmbasic-build-env:$IMAGE_TAG" | |
docker pull "$IMAGE_NAME" | |
pushd build | |
./${{ matrix.platform }}.sh -c "make test && make clean && make runner" | |
popd | |
mv bin/runner.gz runner-${{ matrix.platform }}.gz | |
- name: Upload runner.gz | |
uses: actions/upload-artifact@v3 | |
with: | |
name: runner-${{ matrix.platform }} | |
path: runner-${{ matrix.platform }}.gz | |
build-runner-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 | |
- platform: mac-x64 | |
name: Runner (${{ 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 | |
run: | | |
set -euxo pipefail | |
# https://github.com/actions/runner-images/issues/8613 | |
brew install awscli | |
export FILENAME=$(awk -F= '{ if ($1 == "build-environment-${{ matrix.platform }}") print $2 }' build/tags.ini) | |
export S3_URL="s3://tmbasic/mac-build-envs/$FILENAME" | |
aws s3 cp "$S3_URL" build-environment.tar.gz | |
tar zxf build-environment.tar.gz | |
pushd build | |
./${{ matrix.platform }}.sh -c "make test && make clean && make runner" | |
popd | |
mv bin/runner.gz runner-${{ matrix.platform }}.gz | |
- name: Upload runner.gz | |
uses: actions/upload-artifact@v3 | |
with: | |
name: runner-${{ matrix.platform }} | |
path: runner-${{ matrix.platform }}.gz | |
gather-runners: | |
runs-on: ubuntu-latest | |
name: Gather Runners | |
needs: [build-runner-docker, build-runner-mac] | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: . | |
- name: Combine | |
run: | | |
set -euxo pipefail | |
mv runner-linux-arm64/runner-linux-arm64.gz linux_arm64.gz | |
mv runner-linux-arm32/runner-linux-arm32.gz linux_arm32.gz | |
mv runner-linux-x64/runner-linux-x64.gz linux_x64.gz | |
mv runner-linux-x86/runner-linux-x86.gz linux_x86.gz | |
mv runner-win-x64/runner-win-x64.gz win_x64.gz | |
mv runner-win-x86/runner-win-x86.gz win_x86.gz | |
mv runner-mac-arm64/runner-mac-arm64.gz mac_arm64.gz | |
mv runner-mac-x64/runner-mac-x64.gz mac_x64.gz | |
tar cvf runners.tar *.gz | |
ls -l runners.tar | |
- name: Upload runners.tar | |
uses: actions/upload-artifact@v3 | |
with: | |
name: runners | |
path: runners.tar | |
- name: Delete runner-*.gz | |
uses: geekyeggo/delete-artifact@v2 | |
with: | |
useGlob: false | |
name: | | |
runner-linux-arm64 | |
runner-linux-arm32 | |
runner-linux-x64 | |
runner-linux-x86 | |
runner-win-x64 | |
runner-win-x86 | |
runner-mac-arm64 | |
runner-mac-x64 | |
build-tmbasic-docker: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- platform: linux-arm64 | |
format: tar.gz | |
- platform: linux-arm32 | |
format: tar.gz | |
- platform: linux-x64 | |
format: tar.gz | |
- platform: linux-x86 | |
format: tar.gz | |
- platform: win-x64 | |
format: zip | |
- platform: win-x86 | |
format: zip | |
name: TMBASIC (${{ matrix.platform }}) | |
needs: gather-runners | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download runners.tar | |
uses: actions/download-artifact@v3 | |
with: | |
name: runners | |
path: . | |
- 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: | |
NO_BUILD: 1 | |
TTY_FLAG: " " | |
run: | | |
set -euxo pipefail | |
export IMAGE_TAG=$(awk -F= '{ if ($1 == "build-environment-${{ matrix.platform }}") print $2 }' build/tags.ini) | |
export IMAGE_NAME="ghcr.io/electroly/tmbasic-build-env:$IMAGE_TAG" | |
docker pull "$IMAGE_NAME" | |
mkdir -p obj/resources/runners/ | |
tar xf runners.tar -C obj/resources/runners/ | |
ls -lR obj/resources/runners/ | |
pushd build | |
./${{ matrix.platform }}.sh -c "make release" | |
popd | |
export VERSION=$(awk -F= '{ if ($1 == "version") print $2 }' build/version.ini) | |
pushd bin | |
if [ "${{ matrix.format }}" = "zip" ]; then | |
zip -9 tmbasic-${{ matrix.platform }}-$VERSION.zip tmbasic* | |
else | |
tar cvf tmbasic-${{ matrix.platform }}-$VERSION.tar.gz tmbasic | |
fi | |
popd | |
- name: Upload tmbasic.zip | |
if: matrix.format == 'zip' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tmbasic-${{ matrix.platform }} | |
path: bin/tmbasic-*.zip | |
- name: Upload tmbasic.tar.gz | |
if: matrix.format == 'tar.gz' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tmbasic-${{ matrix.platform }} | |
path: bin/tmbasic-*.tar.gz | |
build-tmbasic-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 | |
- platform: mac-x64 | |
name: TMBASIC (${{ matrix.platform }}) | |
needs: gather-runners | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download runners.tar | |
uses: actions/download-artifact@v3 | |
with: | |
name: runners | |
path: . | |
- 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 | |
NO_BUILD: 1 | |
run: | | |
set -euxo pipefail | |
# https://github.com/actions/runner-images/issues/8613 | |
brew install awscli | |
export FILENAME=$(awk -F= '{ if ($1 == "build-environment-${{ matrix.platform }}") print $2 }' build/tags.ini) | |
export S3_URL="s3://tmbasic/mac-build-envs/$FILENAME" | |
aws s3 cp "$S3_URL" build-environment.tar.gz | |
tar zxf build-environment.tar.gz | |
mkdir -p obj/resources/runners/ | |
tar xf runners.tar -C obj/resources/runners/ | |
ls -lR obj/resources/runners/ | |
pushd build | |
./${{ matrix.platform }}.sh -c "make release" | |
popd | |
export VERSION=$(awk -F= '{ if ($1 == "version") print $2 }' build/version.ini) | |
pushd bin | |
zip -9 tmbasic-${{ matrix.platform }}-$VERSION.zip tmbasic | |
popd | |
- name: Upload tmbasic.zip | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tmbasic-${{ matrix.platform }} | |
path: bin/tmbasic-*.zip | |
final-cleanup: | |
runs-on: ubuntu-latest | |
name: Cleanup | |
needs: [build-tmbasic-docker, build-tmbasic-mac] | |
steps: | |
- name: Delete runners.tar | |
uses: geekyeggo/delete-artifact@v2 | |
with: | |
useGlob: false | |
name: runners |