fixed #10
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: "Build and Test" | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
BUILD_DIR: builds | |
jobs: | |
build-and-test: | |
strategy: | |
matrix: | |
os-version: [ ubuntu-latest, macos-latest, windows-latest ] | |
runs-on: ${{ matrix.os-version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up C/C++ compiler | |
id: setup_compiler | |
uses: rlalik/setup-cpp-compiler@master | |
with: | |
compiler: gcc-latest | |
- name: Compile and build executable | |
run: gcc -o ${{ env.BUILD_DIR }}/largeintcalculator largeintcalculator.c | |
working-directory: ${{ github.workspace }} | |
- name: Move executable to appropriate directory (Linux/macOS) | |
if: runner.os != 'Windows' | |
run: | | |
mkdir -p ${{ env.BUILD_DIR }}/ubuntu ${{ env.BUILD_DIR }}/macos | |
if [[ -e ${{ env.BUILD_DIR }}/largeintcalculator ]]; then | |
mv ${{ env.BUILD_DIR }}/largeintcalculator ${{ env.BUILD_DIR }}/ubuntu/largeintcalculator | |
mv ${{ env.BUILD_DIR }}/largeintcalculator ${{ env.BUILD_DIR }}/macos/largeintcalculator | |
echo "Executable moved successfully." | |
else | |
echo "Error: largeintcalculator binary not found in the expected location." | |
fi | |
working-directory: ${{ github.workspace }} | |
- name: Move executable to appropriate directory (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
mkdir -p ${{ env.BUILD_DIR }}/windows | |
mv ${{ env.BUILD_DIR }}/largeintcalculator.exe ${{ env.BUILD_DIR }}/windows/largeintcalculator.exe | |
working-directory: ${{ github.workspace }} |