From 13198abd26869fc21e290393e53ead808ac57ad3 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Wed, 22 Jan 2025 07:21:12 -0500 Subject: [PATCH] ci(workflows): added build-and-test workflow added basic CI implimentation with github actions to automatically build and test code on ubuntu, fedorah, and macOS (arm64 and x86) --- .github/workflows/build-and-test.yml | 47 ++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/build-and-test.yml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..af4dbcb --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,47 @@ +name: Build and Test + +on: + push: + branches: + - main + pull_request: + +jobs: + build-and-test: + strategy: + matrix: + os: [ubuntu-latest, fedora-latest, archlinux, macos-latest] + include: + - os: macos-latest + arch: x64 + - os: macos-latest + arch: arm64 + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up dependencies + run: | + # Common setup for Linux + if [[ "$RUNNER_OS" == "Linux" ]]; then + if [[ "$matrix.os" == "ubuntu-latest" ]]; then + sudo apt-get update + sudo apt-get install -y cmake build-essential meson ninja-build python3 python3-pip libgtest-dev + # Compile gtest manually for Ubuntu + cd /usr/src/gtest && sudo cmake . && sudo make && sudo cp *.a /usr/lib + elif [[ "$matrix.os" == "fedora-latest" ]]; then + sudo dnf install -y cmake gcc-c++ make meson ninja-build gtest gtest-devel + elif [[ "$matrix.os" == "archlinux" ]]; then + sudo pacman -Syu --noconfirm cmake gcc make meson ninja python gtest + fi + # Common setup for macOS + elif [[ "$RUNNER_OS" == "macOS" ]]; then + brew update + brew install cmake meson ninja python gtest + fi + + - name: Run build and tests + run: ./mk +