Skip to content

Commit

Permalink
macos
Browse files Browse the repository at this point in the history
  • Loading branch information
r3w0p committed May 29, 2024
1 parent 7d3b609 commit 8d3c70c
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 7 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: MacOS

#on:
# release:
# types: [ created ]

on:
push:
branches: [ "1.2.0" ]

env:
BUILD_TYPE: Release

jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: MacOS Clang
os: macos-latest
compiler_cc: clang
compiler_cpp: clang++

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.27.0" # use most recent 3.27.x version
ninjaVersion: "^1.0" # use most recent 1.x version

- name: CMake Setup
run: cmake -S . -B ${{github.workspace}}/build -G Ninja -D CMAKE_C_COMPILER=${{matrix.compiler_cc}} CMAKE_CXX_COMPILER=${{matrix.compiler_cpp}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: CMake Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target caravan

#- name: Rename Executable
# working-directory: ./build
# run: mv caravan caravan_macos_x64

#- name: Upload Executable to Release
# uses: AButler/[email protected]
# with:
# files: ./build/caravan_macos_x64
# repo-token: ${{ secrets.GITHUB_TOKEN }}
14 changes: 7 additions & 7 deletions src/caravan/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,27 @@ int main(int argc, char *argv[]) {
bool imbalanced = result["imbalanced"].as<bool>();

if (pvp && bots) {
printf("Game cannot be both Player vs Player and Bot vs Bot.");
printf("Game cannot be both Player vs Player and Bot vs Bot.\n");
exit(EXIT_FAILURE);
}

if(first < FIRST_ABC || first > FIRST_DEF) {
printf("First player must be either %d or %d.", FIRST_ABC, FIRST_DEF);
printf("First player must be either %d or %d.\n", FIRST_ABC, FIRST_DEF);
exit(EXIT_FAILURE);
}

if (cards < DECK_CARAVAN_MIN || cards > DECK_CARAVAN_MAX) {
printf("Caravan decks must have between %d and %d cards (inclusive).", DECK_CARAVAN_MIN, DECK_CARAVAN_MAX);
printf("Caravan decks must have between %d and %d cards (inclusive).\n", DECK_CARAVAN_MIN, DECK_CARAVAN_MAX);
exit(EXIT_FAILURE);
}

if (samples < SAMPLE_DECKS_MIN || samples > SAMPLE_DECKS_MAX) {
printf("Number of caravan deck samples must be between %d and %d (inclusive).", SAMPLE_DECKS_MIN, SAMPLE_DECKS_MIN);
printf("Number of caravan deck samples must be between %d and %d (inclusive).\n", SAMPLE_DECKS_MIN, SAMPLE_DECKS_MIN);
exit(EXIT_FAILURE);
}

if(delay < 0) {
printf("Bot delay cannot be a negative number.");
printf("Bot delay cannot be a negative number.\n");
exit(EXIT_FAILURE);
}

Expand Down Expand Up @@ -122,11 +122,11 @@ int main(int argc, char *argv[]) {
view = new ViewTUI(&vc, game);

} catch (CaravanException &e) {
printf("%s", e.what().c_str());
printf("%s\n", e.what().c_str());
exit(EXIT_FAILURE);

} catch (std::exception &e) {
printf("%s", e.what());
printf("%s\n", e.what());
exit(EXIT_FAILURE);
}

Expand Down

0 comments on commit 8d3c70c

Please sign in to comment.