CI: Use macos-latest (macos-10.15 runner is obsolete) #92
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
--- | |
# CI build for The Great Escape | |
# | |
name: The Great Escape | |
# Controls when the action will run. Triggers the workflow on: | |
# * push on any branch. | |
# * any tag. | |
on: | |
push: | |
branches: ["*"] | |
tags: ["*"] | |
# Pull request events happen on pull request state transitions, so we probably don't want this here. | |
#pull_request: | |
# branches: ["*"] | |
jobs: | |
## | |
## Windows | |
## | |
windows-cmake-build: | |
runs-on: windows-latest | |
steps: | |
- name: get-cmake | |
uses: lukka/get-cmake@v3.28.1 | |
- uses: actions/checkout@v4 | |
- name: Compile The Great Escape for Windows (via CMake) | |
run: | | |
cmake -E make_directory ${{github.workspace}}\build | |
cd ${{github.workspace}}\build | |
cmake -DCMAKE_BUILD_TYPE=Release ${{github.workspace}} | |
cmake --build . | |
## | |
## macOS | |
## | |
macos-build: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Compile The Great Escape for macOS (via xcodebuild) | |
run: xcodebuild -project platform/osx/TheGreatEscape.xcodeproj -scheme Debug -derivedDataPath DerivedData build | |
macos-cmake-build: | |
runs-on: macos-latest | |
outputs: | |
changeset: ${{ steps.version.outputs.changeset }} | |
tag: ${{ steps.version.outputs.tag }} | |
leafname: ${{ steps.version.outputs.leafname }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: get-cmake | |
uses: lukka/get-cmake@v3.28.1 | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- name: Compile The Great Escape for macOS (via CMake) | |
run: | | |
cmake -E make_directory ${{github.workspace}}/build | |
cd ${{github.workspace}}/build | |
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ${{github.workspace}} | |
cmake --build . | |
- name: Give the output a versioned name | |
id: version | |
run: | | |
changeset=$(git rev-parse --short HEAD) | |
tag=$(git describe --tags | awk -F - '{ print $2 }') | |
leafname="TheGreatEscape-$changeset-macOS.zip" | |
echo "This is changeset: $changeset, tag: $tag" | |
echo "changeset=$changeset" >> $GITHUB_OUTPUT | |
echo "tag=$tag" >> $GITHUB_OUTPUT | |
echo "leafname=$leafname" >> $GITHUB_OUTPUT | |
- name: Archive it | |
run: | | |
cd ${{github.workspace}}/build/platform/osx/Release | |
zip -9r ${{ steps.version.outputs.leafname }} TheGreatEscape.app | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: The-Great-Escape-macOS | |
path: ${{github.workspace}}/build/platform/osx/Release/${{ steps.version.outputs.leafname }} | |
if-no-files-found: error | |
# The release only triggers when the thing that was pushed was a tag starting with 'macos-' | |
macos-release: | |
needs: macos-cmake-build | |
runs-on: macos-latest | |
if: startsWith(github.ref, 'refs/tags/macos-') | |
steps: | |
- name: Download built binary | |
uses: actions/download-artifact@v4 | |
with: | |
name: The-Great-Escape-macOS | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ needs.macos-cmake-build.outputs.tag }} | |
draft: true | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
# This pulls from the CREATE RELEASE step above, referencing its ID to get its outputs object, which include a `upload_url`. | |
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: The-Great-Escape-macOS/${{ needs.macos-cmake-build.outputs.leafname }} | |
asset_name: TheGreatEscape-${{ needs.macos-cmake-build.outputs.tag }}-macOS.zip | |
asset_content_type: application/zip | |
## | |
## RISC OS | |
## | |
riscos-build: | |
# The type of runner that the job will run on | |
container: riscosdotinfo/riscos-gccsdk-4.7:latest | |
runs-on: ubuntu-latest | |
outputs: | |
changeset: ${{ steps.version.outputs.changeset }} | |
tag: ${{ steps.version.outputs.tag }} | |
leafname: ${{ steps.version.outputs.leafname }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Step intended to be reused in CI pipelines. | |
- name: Cross compile The Great Escape for RISC OS | |
run: | | |
apt-get update | |
apt-get install -y ca-certificates | |
./riscos-ci-build.sh | |
- name: Give the output a versioned name | |
id: version | |
run: | | |
changeset=$(git rev-parse --short HEAD) | |
tag=$(git describe --tags | awk -F - '{ print $3 }') | |
leafname="TheGreatEscape-$changeset-RISC_OS.zip" | |
echo "This is changeset: $changeset, tag: $tag" | |
echo "changeset=$changeset" >> $GITHUB_OUTPUT | |
echo "tag=$tag" >> $GITHUB_OUTPUT | |
echo "leafname=$leafname" >> $GITHUB_OUTPUT | |
- name: Archive it | |
run: | | |
apt-get install -y python3 python3-pip | |
pip install rozipinfo | |
cd build-riscos/install | |
find . -type f -not -name '*,*' -exec mv '{}' '{},fff' \; # ensure that type-less files come out as Text | |
python3 -m rozipfile --verbose --create ../../${{ steps.version.outputs.leafname }} * | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: The-Great-Escape-RISC_OS | |
path: ${{ steps.version.outputs.leafname }} | |
if-no-files-found: error | |
# The artifact that is downloadable from the Actions is actually a zip of the artifacts | |
# that we supply. So it will be a regular Zip file containing a RISC OS Zip file. | |
# The release only triggers when the thing that was pushed was a tag starting with 'risc-os-' | |
riscos-release: | |
needs: riscos-build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/risc-os-') | |
steps: | |
- name: Download built binary | |
uses: actions/download-artifact@v4 | |
with: | |
name: The-Great-Escape-RISC_OS | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ needs.riscos-build.outputs.tag }} | |
draft: true | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
# This pulls from the CREATE RELEASE step above, referencing its ID to get its outputs object, which include a `upload_url`. | |
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: The-Great-Escape-RISC_OS/${{ needs.riscos-build.outputs.leafname }} | |
asset_name: TheGreatEscape-${{ needs.riscos-build.outputs.tag }}-RISC_OS.zip | |
asset_content_type: application/zip |