From 7aa82374ac37eb7dd85d96c72b2466ab07ad2051 Mon Sep 17 00:00:00 2001 From: nhatdongdang <144138246+nhatdongdang@users.noreply.github.com> Date: Mon, 9 Sep 2024 21:50:36 +1000 Subject: [PATCH] Add install and compile for CI pipeline --- .github/workflows/ci.yml | 29 +++++++++++++++++++++++++++++ test/link_test.cpp | 7 +++++++ 2 files changed, 36 insertions(+) create mode 100644 test/link_test.cpp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d925997..550d4a85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,3 +28,32 @@ jobs: - name: Run test suite working-directory: ./build run: make test_suite && ctest -R full -V + + install-and-compile: + strategy: + matrix: + os: [ubuntu-latest,macos-latest] + runs-on: ${{ matrix.os }} + steps: + # Checkout the mcpp repository + - name: Checkout mcpp + uses: actions/checkout@v4 + + - name: Build file + run: cmake . + + - name: Install library + run: sudo make install + + - name: Update linux cache + if: runner.os == 'Linux' + run: sudo ldconfig + + - name: Compile and link library + run: g++ -std=c++17 test/link_test.cpp -o test/link_test -lmcpp + + - name: Run executable + run: test/link_test + + + diff --git a/test/link_test.cpp b/test/link_test.cpp new file mode 100644 index 00000000..58565f94 --- /dev/null +++ b/test/link_test.cpp @@ -0,0 +1,7 @@ +#include + +int main() { + std::cout << mcpp::Blocks::AIR << "\n"; + std::cout << "Link success"; + return EXIT_SUCCESS; +}