-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
354 additions
and
58 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,278 @@ | ||
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 }} | ||
- name: Checkout | ||
uses: actions/checkout@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 | ||
run: | | ||
set -euxo pipefail | ||
cd build | ||
export IMAGE_TAG=$(awk -F= '{ if ($1 == "build-environment-${{ matrix.platform }}") print $2 }' tags.ini) | ||
export IMAGE_NAME="ghcr.io/electroly/tmbasic-build-env:$IMAGE_TAG" | ||
docker pull "$IMAGE_NAME" | ||
./${{ matrix.platform }}.sh -c "make runner" | ||
- name: Upload runner.gz | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: runner-${{ matrix.platform }}.gz | ||
path: bin/runner.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 }' tags.ini) | ||
export S3_URL="s3://tmbasic/mac-build-envs/$FILENAME" | ||
aws s3 cp "$S3_URL" build-environment.tar.gz | ||
tar zxvf build-environment.tar.gz | ||
cd build | ||
./${{ matrix.platform }}.sh -c "make runner" | ||
- name: Upload runner.gz | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: runner-${{ matrix.platform }}.gz | ||
path: bin/runner.gz | ||
|
||
gather-runners: | ||
runs-on: ubuntu-latest | ||
name: Gather Runners | ||
needs: [build-runner-docker, build-runner-mac] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Download runner-linux-arm64.gz | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: runner-linux-arm64.gz | ||
|
||
- name: Download runner-linux-arm32.gz | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: runner-linux-arm32.gz | ||
|
||
- name: Download runner-linux-x64.gz | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: runner-linux-x64.gz | ||
|
||
- name: Download runner-linux-x86.gz | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: runner-linux-x86.gz | ||
|
||
- name: Download runner-win-x64.gz | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: runner-win-x64.gz | ||
|
||
- name: Download runner-win-x86.gz | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: runner-win-x86.gz | ||
|
||
- name: Download runner-mac-arm64.gz | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: runner-mac-arm64.gz | ||
|
||
- name: Download runner-mac-x64.gz | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: runner-mac-x64.gz | ||
|
||
- name: Combine | ||
run: | | ||
set -euxo pipefail | ||
tar cvf runners.tar runner-*.gz | ||
- name: Upload runners.tar | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: runners.tar | ||
path: runners.tar | ||
|
||
- name: Delete runner-*.gz | ||
uses: geekyeggo/delete-artifact@v2 | ||
with: | ||
useGlob: false | ||
name: | | ||
runner-linux-arm64.gz | ||
runner-linux-arm32.gz | ||
runner-linux-x64.gz | ||
runner-linux-x86.gz | ||
runner-win-x64.gz | ||
runner-win-x86.gz | ||
runner-mac-arm64.gz | ||
runner-mac-x64.gz | ||
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@v2 | ||
with: | ||
name: runners.tar | ||
|
||
- 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 | ||
run: | | ||
set -euxo pipefail | ||
cd build | ||
export IMAGE_TAG=$(awk -F= '{ if ($1 == "build-environment-${{ matrix.platform }}") print $2 }' tags.ini) | ||
export IMAGE_NAME="ghcr.io/electroly/tmbasic-build-env:$IMAGE_TAG" | ||
docker pull "$IMAGE_NAME" | ||
./${{ matrix.platform }}.sh -c "make release" | ||
pushd bin | ||
if [ "${{ matrix.format }}" = "zip" ]; then | ||
zip -9 tmbasic.zip tmbasic | ||
else | ||
tar cvf tmbasic.tar.gz tmbasic | ||
fi | ||
popd | ||
- name: Upload tmbasic.zip | ||
if: matrix.format == 'zip' | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: tmbasic-${{ matrix.platform }}.zip | ||
path: bin/tmbasic.zip | ||
|
||
- name: Upload tmbasic.tar.gz | ||
if: matrix.format == 'tar.gz' | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: tmbasic-${{ matrix.platform }}.tar.gz | ||
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@v2 | ||
with: | ||
name: runners.tar | ||
|
||
- 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 }' tags.ini) | ||
export S3_URL="s3://tmbasic/mac-build-envs/$FILENAME" | ||
aws s3 cp "$S3_URL" build-environment.tar.gz | ||
tar zxvf build-environment.tar.gz | ||
mkdir -p obj/resources/runners/ | ||
tar zxvf runners.tar -C obj/resources/runners/ | ||
cd build | ||
./${{ matrix.platform }}.sh -c "make release" | ||
pushd bin | ||
zip -9 tmbasic.zip tmbasic | ||
popd | ||
- name: Upload tmbasic.zip | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: tmbasic-${{ matrix.platform }}.zip | ||
path: bin/tmbasic.zip |
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
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
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
Oops, something went wrong.