From 074c9cd5fce3478ebd8cb6eea3892b2c5a947987 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Fri, 6 Jan 2023 13:59:57 +0700 Subject: [PATCH 1/5] add `action.yml` that will configure and build CMake project --- action.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 action.yml 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 From f18936167faa1c333ea361971d583537374a008d Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Fri, 6 Jan 2023 15:23:09 +0700 Subject: [PATCH 2/5] add a test project for testing this action --- .gitignore | 1 + test/CMakeLists.txt | 3 +++ test/hello_world.cpp | 6 ++++++ 3 files changed, 10 insertions(+) create mode 100644 .gitignore create mode 100644 test/CMakeLists.txt create mode 100644 test/hello_world.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +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; +} From 231bba2fa17d44c728bf6875c06f2c22c1636288 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Fri, 6 Jan 2023 20:57:40 +0700 Subject: [PATCH 3/5] add `test.yml` workflow to test this action --- .github/workflows/test.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..6b116f7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,16 @@ +name: test +on: + workflow_dispatch: + push: +jobs: + use-action: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3.2.0 + + - name: Use this action + uses: ./ + + - name: Run build result + run: ./build/hello_world From 9a41887e43836c7533a6d4763704b4ecef06e92d Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Fri, 6 Jan 2023 21:08:09 +0700 Subject: [PATCH 4/5] move test project to the working directory during `use-action` job --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6b116f7..9a6abeb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v3.2.0 + - name: Move test project to the working directory + run: mv test/* . + - name: Use this action uses: ./ From e13a53a58fd9790025a8bd2c7f3f2a2665d944a1 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Fri, 6 Jan 2023 21:15:51 +0700 Subject: [PATCH 5/5] use latest version of `actions/checkout` --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9a6abeb..5f4e01e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3.2.0 + uses: actions/checkout@v3.3.0 - name: Move test project to the working directory run: mv test/* .