diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..5f4e01e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,19 @@ +name: test +on: + workflow_dispatch: + push: +jobs: + use-action: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3.3.0 + + - name: Move test project to the working directory + run: mv test/* . + + - name: Use this action + uses: ./ + + - name: Run build result + run: ./build/hello_world diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..28a082d --- /dev/null +++ b/action.yml @@ -0,0 +1,16 @@ +name: CMake Action +description: Configure and build CMake project +author: Alfi Maulana +branding: + color: gray-dark + icon: terminal +runs: + using: composite + steps: + - name: Configure CMake + shell: bash + run: cmake . -B build + + - name: Build targets + shell: bash + run: cmake --build build diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..71bf957 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(test) +add_executable(hello_world hello_world.cpp) diff --git a/test/hello_world.cpp b/test/hello_world.cpp new file mode 100644 index 0000000..2242cf0 --- /dev/null +++ b/test/hello_world.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + std::cout << "Hello world!" << std::endl; + return 0; +}