From 556fbd89d5855cf3467b358319337f6ebff427f6 Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Mon, 27 Jan 2025 12:37:11 -0500 Subject: [PATCH 1/5] Add build tasks and build workflow --- .github/workflows/code-linting-checks.yaml | 4 +- .github/workflows/unit-tests.yaml | 53 ++++++++++++++++++++++ taskfile.yaml | 1 + taskfiles/build.yaml | 27 +++++++++++ 4 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/unit-tests.yaml create mode 100644 taskfiles/build.yaml diff --git a/.github/workflows/code-linting-checks.yaml b/.github/workflows/code-linting-checks.yaml index ae7670bb..195cf21d 100644 --- a/.github/workflows/code-linting-checks.yaml +++ b/.github/workflows/code-linting-checks.yaml @@ -20,7 +20,9 @@ jobs: lint-check: strategy: matrix: - os: ["macos-latest", "ubuntu-latest"] + os: + - "macos-latest" + - "ubuntu-latest" runs-on: "${{matrix.os}}" steps: - uses: "actions/checkout@v4" diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml new file mode 100644 index 00000000..4ce56f1d --- /dev/null +++ b/.github/workflows/unit-tests.yaml @@ -0,0 +1,53 @@ +name: "unit-tests" + +on: + pull_request: + push: + schedule: + # Run daily at 00:15 UTC (the 15 is to avoid periods of high load) + - cron: "15 0 * * *" + workflow_dispatch: + +permissions: {} + +concurrency: + group: "${{github.workflow}}-${{github.ref}}" + + # Cancel in-progress jobs for efficiency + cancel-in-progress: true + +jobs: + build-ystdlib-cpp: + strategy: + matrix: + os: + - "macos-latest" + - "ubuntu-22.04" + - "ubuntu-24.04" + runs-on: "${{matrix.os}}" + steps: + - uses: "actions/checkout@v4" + with: + submodules: "recursive" + + - uses: "actions/setup-python@v5" + with: + python-version: "3.11" + + - name: "Install task" + shell: "bash" + run: "npm install -g @go-task/cli" + + - if: "matrix.os == 'macos-latest'" + name: "Install coreutils (for md5sum)" + run: "brew install coreutils" + + - name: "Log tool versions" + run: |- + md5sum --version + python --version + tar --version + task --version + + # TODO: Run any existing unit tests after building ystdlib-cpp + - run: "task build:target" diff --git a/taskfile.yaml b/taskfile.yaml index 64ed8c47..77d6ceea 100644 --- a/taskfile.yaml +++ b/taskfile.yaml @@ -1,6 +1,7 @@ version: "3" includes: + build: "./taskfiles/build.yaml" lint: "./taskfiles/lint.yaml" utils: "tools/yscope-dev-utils/taskfiles/utils.yml" diff --git a/taskfiles/build.yaml b/taskfiles/build.yaml new file mode 100644 index 00000000..83123a48 --- /dev/null +++ b/taskfiles/build.yaml @@ -0,0 +1,27 @@ +version: "3" + +tasks: + target: + desc: "Builds ystdlib-cpp." + vars: + TARGETS: + ref: "default (list \"all\") .TARGETS" + deps: + - ":config-cmake-project" + cmds: + - >- + cmake + --build "{{.G_BUILD_DIR}}" + --parallel {{numCPU}} + --target {{range .TARGETS}}{{.}} {{end}} + + clean: + desc: "Removes all built artifacts." + deps: + - ":config-cmake-project" + cmds: + - >- + cmake + --build "{{.G_BUILD_DIR}}" + --parallel {{numCPU}} + --target clean From 9fa77160240223e3ba77471687e5bdecbdca7c20 Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Mon, 27 Jan 2025 12:44:48 -0500 Subject: [PATCH 2/5] Add ubuntu 20.04 --- .github/workflows/unit-tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 4ce56f1d..eb83939e 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -22,6 +22,7 @@ jobs: matrix: os: - "macos-latest" + - "ubuntu-20.04" - "ubuntu-22.04" - "ubuntu-24.04" runs-on: "${{matrix.os}}" From 6a2c2bc3e22310fdd1c25bc85e4f48e968f05a84 Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Mon, 27 Jan 2025 13:38:47 -0500 Subject: [PATCH 3/5] Update .github/workflows/unit-tests.yaml Co-authored-by: davidlion --- .github/workflows/unit-tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index eb83939e..4826565c 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -50,5 +50,6 @@ jobs: tar --version task --version - # TODO: Run any existing unit tests after building ystdlib-cpp + # TODO: Change the task to run all unittests once any unittest is added. Until then we check + # that building the project succeeds. - run: "task build:target" From 09df7dc44df99dde6833f46d0a87063799e0549d Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Mon, 27 Jan 2025 13:41:30 -0500 Subject: [PATCH 4/5] Add instructions to build ystdlib-cpp --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index fcbd2aad..c318fff9 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,12 @@ Initialize and update submodules: git submodule update --init --recursive ``` +# Building +To build `ystdlib-cpp`: +```shell +task build:target +``` + ## Linting Before submitting a pull request, ensure you’ve run the linting commands below and have fixed all violations and suppressed all warnings. From 22790d301d31cada28ed8f3a3c22e3cee94acf3b Mon Sep 17 00:00:00 2001 From: Bingran Hu Date: Mon, 27 Jan 2025 13:50:20 -0500 Subject: [PATCH 5/5] Update README.md Co-authored-by: davidlion --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c318fff9..63ccbaf8 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ git submodule update --init --recursive ``` # Building -To build `ystdlib-cpp`: +To build all targets in `ystdlib-cpp`: ```shell task build:target ```