Skip to content

Merge pull request #41 from jbrandwood/master #113

Merge pull request #41 from jbrandwood/master

Merge pull request #41 from jbrandwood/master #113

Workflow file for this run

name: build
# Github Actions aren't supporting anchors yet
# upvote here https://github.com/github/feedback/discussions/4501
#
# See https://github.com/marketplace/actions/setup-xcode-version
on:
push:
pull_request:
branches:
- master
# activating dispatch to allow manual runs
# workflow_dispatch:
env:
MSYS2_INSTALL_FOLDER: C:\msys64\ # provided by GitHub Actions VMs
jobs:
build:
strategy:
matrix:
os: [ubuntu-22.04, macos-12, macos-14, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code from the repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build on Linux
if: startsWith(matrix.os, 'ubuntu')
run: |
make
echo Build Complete
- name: Build on Windows
if: startsWith(matrix.os, 'windows')
run: |
${{ env.MSYS2_INSTALL_FOLDER }}\msys2_shell.cmd -mingw64 -no-start -defterm -c "pacman -S binutils make mingw-w64-x86_64-gcc git --noconfirm"
${{ env.MSYS2_INSTALL_FOLDER }}\msys2_shell.cmd -mingw64 -no-start -defterm -where %CD% -c "make"
echo Build Complete
- name: Build on MacOs-12
if: startsWith(matrix.os, 'macos-12')
run: |
sudo xcode-select -s "/Applications/Xcode_13.4.1.app"
make
echo Build Complete
- name: Build on MacOs-14
if: startsWith(matrix.os, 'macos-14')
run: |
make
echo Build Complete
- name: Archive toolchain
uses: actions/upload-artifact@v4
with:
name: toolchain-${{ matrix.os }}
path: |
bin
examples/**/*.iso
examples/**/*.pce
examples/**/*.sgx
tgemu/tgemu*
test:
strategy:
matrix:
os: [ubuntu-22.04, macos-12, macos-14, windows-2022]
runs-on: ${{ matrix.os }}
needs: build
steps:
- name: Check out code from the repository
uses: actions/checkout@v4
- name: Get previoulsy built artifacts
uses: actions/download-artifact@v4
with:
name: toolchain-${{ matrix.os }}
- name: Restore Execute Flags
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
run: |
chmod +x bin/* # Github Action artifacts don't keep exec flags https://github.com/actions/upload-artifact#permission-loss'
chmod +x tgemu/tgemu
- name: Run tests on Linux
if: startsWith(matrix.os, 'ubuntu')
run: |
make check
make test
echo Test Complete
- name: Setup Msys2
if: startsWith(matrix.os, 'windows')
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: coreutils make git
- name: Run tests on Windows
if: startsWith(matrix.os, 'windows')
shell: msys2 {0}
run: |
make check
make test
echo Build Complete
- name: Run tests on Mac
if: startsWith(matrix.os, 'macos')
run: |
make check
make test
echo Build Complete
package:
strategy:
matrix:
os: [ubuntu-22.04, macos-12, windows-2022]
runs-on: ${{ matrix.os }}
needs: build
steps:
- name: Check out code from the repository
uses: actions/checkout@v4
- name: Get previously built artifacts
uses: actions/download-artifact@v4
with:
name: toolchain-${{ matrix.os }}
- name: Package ${{ matrix.os }}
if: startsWith(matrix.os, 'ubuntu')
run: |
make package
echo Package Complete
- name: Package ${{ matrix.os }}
if: startsWith(matrix.os, 'windows')
run: |
${{ env.MSYS2_INSTALL_FOLDER }}\msys2_shell.cmd -mingw64 -no-start -defterm -c "pacman -S binutils make git zip --noconfirm"
${{ env.MSYS2_INSTALL_FOLDER }}\msys2_shell.cmd -mingw64 -no-start -defterm -where %CD% -c "make package"
echo Package Complete
- name: Package ${{ matrix.os }}
if: startsWith(matrix.os, 'macos')
run: |
make package
echo Package Complete
- name: Archive package
uses: actions/upload-artifact@v4
with:
name: package-${{ matrix.os }}
path: |
*.zip
if-no-files-found: error
publish_package:
runs-on: ubuntu-latest
needs: [package, test]
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
steps:
- name: Check out code from the repository
uses: actions/checkout@v4
- name: Get previoulsy built artifacts win64
uses: actions/download-artifact@v4
with:
name: package-windows-2022
- name: Get previously built artifacts macos
uses: actions/download-artifact@v4
with:
name: package-macos-12
- name: Get previously built artifacts linux
uses: actions/download-artifact@v4
with:
name: package-ubuntu-22.04
# https://github.com/pyTooling/Actions/tree/main/releaser
# need to use composite on windows, since docker isn't available
- name: publish release package
if: ${{ github.event_name == 'release' }}
uses: pyTooling/Actions/releaser@r0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
rm: true # do not keep old latest artifacts
files: |
*.zip
- name: publish current package
if: ${{ github.event_name != 'release' }}
uses: pyTooling/Actions/releaser@r0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: "current"
rm: true # do not keep old latest artifacts
files: |
*.zip