Execute ./apeinstall.sh #775
Workflow file for this run
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: CI | |
on: | |
[push, workflow_dispatch] | |
#concurrency: | |
# group: "make" | |
# cancel-in-progress: false | |
jobs: | |
clang-format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Make check | |
run: | | |
make check | |
build-and-test: | |
# runs-on: self-hosted | |
timeout-minutes: 5 | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: ubuntu-latest, CXX: g++, build_type: all} | |
- {os: ubuntu-latest, CXX: g++, build_type: release} | |
- {os: ubuntu-latest, CXX: clang++, build_type: all} | |
- {os: ubuntu-latest, CXX: clang++, build_type: release} | |
- {os: ubuntu-latest, CXX: cmake, build_type: Debug} | |
- {os: ubuntu-latest, CXX: cosmoc++, build_type: all} | |
- {os: ubuntu-latest, CXX: cosmoc++, build_type: release} | |
- {os: windows-latest, CXX: cl, build_type: Debug} | |
- {os: windows-latest, CXX: g++, build_type: all} | |
- {os: windows-latest, CXX: g++, build_type: release} | |
- {os: windows-latest, CXX: clang++, build_type: all} | |
- {os: windows-latest, CXX: clang++, build_type: release} | |
- {os: windows-latest, CXX: cmake, build_type: Debug} | |
# macos-12 is for x64, while macos-14 is for arm64 (M1) | |
- {os: macos-12, CXX: g++, build_type: all} | |
- {os: macos-12, CXX: g++, build_type: release} | |
- {os: macos-12, CXX: clang++, build_type: all} | |
- {os: macos-12, CXX: clang++, build_type: release} | |
- {os: macos-12, CXX: cmake, build_type: Debug} | |
- {os: macos-latest, CXX: g++, build_type: all} | |
- {os: macos-latest, CXX: g++, build_type: release} | |
- {os: macos-latest, CXX: clang++, build_type: all} | |
- {os: macos-latest, CXX: clang++, build_type: release} | |
- {os: macos-latest, CXX: cmake, build_type: Debug} | |
name: "${{ matrix.config.os }} ${{ matrix.config.CXX }} ${{ matrix.config.build_type }}" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup LLVM on Windows | |
# https://github.com/actions/runner-images/issues/10001 | |
if: matrix.config.CXX == 'clang++' && matrix.config.os == 'windows-latest' | |
run: | | |
choco upgrade llvm -y | |
echo "LLVM_PATH=C:\Program Files\LLVM\bin" >> $GITHUB_ENV | |
- name: Set up Microsoft Dev Cmd | |
if: matrix.config.os == 'windows-latest' && matrix.config.CXX == 'cl' | |
uses: ilammy/[email protected] | |
with: | |
arch: amd64 | |
- name: Setup cosmoc++ | |
if: matrix.config.CXX == 'cosmoc++' && matrix.config.os == 'ubuntu-latest' | |
run: | | |
mkdir -p cosmocc | |
cd cosmocc | |
wget https://cosmo.zip/pub/cosmocc/cosmocc.zip -q | |
unzip -qq cosmocc.zip | |
wget https://raw.githubusercontent.com/jart/cosmopolitan/master/ape/apeinstall.sh -q | |
sudo ./apeinstall.sh | |
cd .. | |
echo "$(pwd)/cosmocc/bin" >> $GITHUB_PATH | |
- name: Output compiler version | |
shell: bash | |
run: | | |
if [[ "${{ matrix.config.CXX }}" == "cl" ]]; then | |
cl | |
else \ | |
${{ matrix.config.CXX }} --version | |
fi | |
- name: Make all | |
if: matrix.config.CXX != 'cmake' && matrix.config.CXX != 'cl' && matrix.config.build_type == 'all' | |
shell: bash | |
run: | | |
# Enabling optimization checks -Wmaybe-uninitialized from -Wall | |
# output 3 to stdin (to close the game) as 'make all' will start the game | |
echo -e "3" | CXXFLAGS=-O2 make CXX=${{ matrix.config.CXX }} all -j2 | |
- name: Make release | |
if: matrix.config.CXX != 'cmake' && matrix.config.CXX != 'cl' && matrix.config.build_type == 'release' | |
shell: bash | |
run: | | |
CXX=${{ matrix.config.CXX }} make release -j 2 | |
- name: CMake | |
if: matrix.config.CXX == 'cmake' | |
shell: bash | |
run: | | |
cmake -B build -S . -DOUTPUT_NAME=stocksim-cmake -Werror=dev -Werror=deprecated --fresh | |
cmake --build build --parallel 2 --config ${{ matrix.config.build_type }} --clean-first | |
cmake --install build --prefix . --config ${{ matrix.config.build_type }} | |
- name: Compile with cl | |
if: matrix.config.os == 'windows-latest' && matrix.config.CXX == 'cl' | |
shell: cmd | |
run: | | |
make msvc | |
- name: Run test cases | |
shell: bash | |
run: | | |
if [[ "${{ matrix.config.CXX }}" == "cmake" ]]; then | |
executable="stocksim-cmake" | |
elif [[ "${{ matrix.config.CXX }}" == "cl" ]]; then | |
executable="stocksim-msvc" | |
elif [[ "${{ matrix.config.build_type }}" == "release" ]]; then | |
executable="stocksim-release" | |
else | |
executable="stocksim" | |
fi | |
echo -e "1\ntest\nX\nY\n" | ./$executable | |
echo -e "0\n saves\nsaves\nB\n1\n1\nN\nY\nN\nY\nN\nY\nT\n0\nT\n1\nT\n2\nE\nT\nX\nY\n" | ./$executable | |
# test for loading saves | |
echo -e "1\nsaves\nN\nY\nN\nY\nN\nY\nN\nY\nT\n0\nT\nT\n3\nT\n4\nT\nS\n1\n1\nX\nY\n" | ./$executable | |
# test for deleting saves | |
echo -e "2\nsaves\nY\n3\n" | ./$executable | |
- name: Upload executable | |
uses: actions/upload-artifact@v4 | |
with: | |
# suppose we compiled our game and named it 'stocksim' | |
# use wildcard to match the executable for all platforms | |
# name: stocksim | |
name: stocksim-${{ matrix.config.os }}-${{ matrix.config.CXX }}-${{ matrix.config.build_type }} | |
path: stocksim* | |
compression-level: 9 | |
if-no-files-found: error |