From 3d658d8ff12c984a56ff201a83ad971c985ebcd7 Mon Sep 17 00:00:00 2001 From: Antonia Elsen Date: Tue, 11 Mar 2025 14:52:25 -0700 Subject: [PATCH 1/7] ci: add workflows for testing and cutting releases --- .github/workflows/build-test.yml | 107 +++++++++++++++++++++++++++ .github/workflows/main.yml | 28 +++++++ .github/workflows/release-please.yml | 18 +++++ .release-please-manifest.json | 3 + CMakeLists.txt | 4 +- release-please-config.json | 10 +++ version.txt | 1 + 7 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-test.yml create mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/release-please.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json create mode 100644 version.txt diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000..ab0d515 --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,107 @@ +on: + workflow_call: + inputs: + runner: + description: "The runner to use" + required: true + default: "ubuntu-22.04" + type: string + triplet: + description: "The triplet to use" + required: true + default: "x64-linux" + type: string + +permissions: + contents: write + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + _VCPKG_: ${{ github.workspace }}/external/microsoft/vcpkg + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" + VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/external/microsoft/vcpkg/bincache + VCPKG_FEATURE_FLAGS: "dependencygraph" + +jobs: + build: + runs-on: ${{ inputs.runner }} + steps: + - name: Check out repository code + uses: actions/checkout@v4 + with: + submodules: "true" + + - uses: actions/github-script@v6 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" + run: mkdir -p ${{ github.workspace }}/external/microsoft/vcpkg/bincache + shell: bash + + - uses: lukka/get-cmake@latest + with: + cmakeVersion: "3.29.0" + + - name: Restore vcpkg + uses: actions/cache@v3 + with: + path: | + ${{ env._VCPKG_ }} + !${{ env._VCPKG_ }}/buildtrees + !${{ env._VCPKG_ }}/packages + !${{ env._VCPKG_ }}/downloads + !${{ env._VCPKG_ }}/installed + key: | + ${{ inputs.triplet }}-${{ hashFiles( '.git/modules/external/microsoft/vcpkg/HEAD' )}} + + - name: Configure + env: + CMAKE_VERBOSE_MAKEFILE: 1 + VCPKG_DEBUG: 1 + run: | + echo "Configuring for triplet ${{ inputs.triplet }}" + TRIPLET=${{ inputs.triplet }} make configure + + - name: Build + run: NPROC=1 make build + + - uses: actions/upload-artifact@v4 + with: + name: build-${{ inputs.triplet }}-${{ github.sha }} + path: build + retention-days: 1 + + test: + needs: [build] + runs-on: ${{ inputs.runner }} + steps: + - name: Check out repository code + uses: actions/checkout@v4 + with: + submodules: "true" + + - uses: actions/github-script@v6 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" + run: mkdir -p ${{ github.workspace }}/external/microsoft/vcpkg/bincache + shell: bash + + - uses: lukka/get-cmake@latest + with: + cmakeVersion: "3.29.0" + + - uses: actions/download-artifact@v4 + with: + name: build-${{ inputs.triplet }}-${{ github.sha }} + path: build + + - name: Run tests + run: make test + shell: bash diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..8fa609b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,28 @@ +on: + push: + branches: + - "main" + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: write + +jobs: + build-test: + strategy: + fail-fast: false + matrix: + build: + [ + { runner: "ubuntu-22.04", triplet: "x64-linux" }, + ] + uses: ./.github/workflows/build-test.yml + with: + runner: ${{ matrix.build.runner }} + triplet: ${{ matrix.build.triplet }} + secrets: inherit diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..8d3bf99 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,18 @@ +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +name: release-please + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@v4 + with: + token: ${{ secrets.RELEASE_PLEASE_AT }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..34d692d --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.15.5" +} diff --git a/CMakeLists.txt b/CMakeLists.txt index e0e946b..3f668e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.23.5) -project(synapse VERSION 0.0.1) +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/version.txt" SYNAPSE_CPP_VERSION) +string(STRIP "${SYNAPSE_CPP_VERSION}" SYNAPSE_CPP_VERSION) +project(synapse VERSION ${SYNAPSE_CPP_VERSION}) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..2bf86f1 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,10 @@ +{ + "packages": { + ".": { + "release-type": "simple" + } + }, + "bootstrap-sha": "e255ba2a354554be7b59ad7711aef9695cd34a92", + "always-update": true, + "bump-minor-pre-major": true +} diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..6c6aa7c --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +0.1.0 \ No newline at end of file From 23f7fe07758020a0eb7e78bbe1dac8fc56ee3202 Mon Sep 17 00:00:00 2001 From: Antonia Elsen Date: Tue, 11 Mar 2025 18:15:19 -0700 Subject: [PATCH 2/7] chore: fix vcpkg root --- .github/workflows/build-test.yml | 1 + README.md | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index ab0d515..eaa54be 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -18,6 +18,7 @@ permissions: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} _VCPKG_: ${{ github.workspace }}/external/microsoft/vcpkg + VCPKG_ROOT: ${{ github.workspace }}/external/microsoft/vcpkg VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/external/microsoft/vcpkg/bincache VCPKG_FEATURE_FLAGS: "dependencygraph" diff --git a/README.md b/README.md index 18add40..f53ec75 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,11 @@ To build: ```sh git submodule update --init + +# Set up vcpkg -- you can also use a vcpkg elsewhere via VCPKG_ROOT cd external/microsoft/vcpkg && ./bootstrap-vcpkg.sh && cd - +export VCPKG_ROOT="$(pwd)/external/microsoft/vcpkg}" + make all # or From e677d8947005d4e33ecd4d3f52ee7ea35f824980 Mon Sep 17 00:00:00 2001 From: Antonia Elsen Date: Tue, 11 Mar 2025 23:53:49 -0700 Subject: [PATCH 3/7] chore: update scipp --- external/sciencecorp/vcpkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/sciencecorp/vcpkg b/external/sciencecorp/vcpkg index 5a626e6..bd3f89c 160000 --- a/external/sciencecorp/vcpkg +++ b/external/sciencecorp/vcpkg @@ -1 +1 @@ -Subproject commit 5a626e6f89f096d20a95a169ca914a9285f33d51 +Subproject commit bd3f89c443359a6128a9529b7f0d1790523f6ae8 From 2700189b30725c983c21eca330f46584a022bf46 Mon Sep 17 00:00:00 2001 From: Antonia Elsen Date: Wed, 12 Mar 2025 00:11:36 -0700 Subject: [PATCH 4/7] chore: update scipp --- external/sciencecorp/vcpkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/sciencecorp/vcpkg b/external/sciencecorp/vcpkg index bd3f89c..6d9fc95 160000 --- a/external/sciencecorp/vcpkg +++ b/external/sciencecorp/vcpkg @@ -1 +1 @@ -Subproject commit bd3f89c443359a6128a9529b7f0d1790523f6ae8 +Subproject commit 6d9fc9518b884eb8e2e627e86862d47f3848fc5e From 94d429d532408be52322b314e005b5b9506a7377 Mon Sep 17 00:00:00 2001 From: Antonia Elsen Date: Wed, 12 Mar 2025 00:13:08 -0700 Subject: [PATCH 5/7] chore: release-please --- .release-please-manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 34d692d..466df71 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.15.5" + ".": "0.1.0" } From b7f7cd56ac2c25bce6b3ce50410a4b4df8d98947 Mon Sep 17 00:00:00 2001 From: Antonia Elsen Date: Wed, 12 Mar 2025 00:14:49 -0700 Subject: [PATCH 6/7] chore: consolidate build & test in ci --- .github/workflows/build-test.yml | 38 ++++++++------------------------ Makefile | 2 ++ 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index eaa54be..34e5104 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -66,6 +66,14 @@ jobs: echo "Configuring for triplet ${{ inputs.triplet }}" TRIPLET=${{ inputs.triplet }} make configure + - name: Upload vcpkg buildtrees + if: always() + uses: actions/upload-artifact@v4 + with: + name: vcpkg-buildtrees-${{ inputs.triplet }}-${{ github.sha }} + path: external/microsoft/vcpkg/buildtrees/science-scipp + retention-days: 1 + - name: Build run: NPROC=1 make build @@ -75,34 +83,6 @@ jobs: path: build retention-days: 1 - test: - needs: [build] - runs-on: ${{ inputs.runner }} - steps: - - name: Check out repository code - uses: actions/checkout@v4 - with: - submodules: "true" - - - uses: actions/github-script@v6 - with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - - - name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" - run: mkdir -p ${{ github.workspace }}/external/microsoft/vcpkg/bincache - shell: bash - - - uses: lukka/get-cmake@latest - with: - cmakeVersion: "3.29.0" - - - uses: actions/download-artifact@v4 - with: - name: build-${{ inputs.triplet }}-${{ github.sha }} - path: build - - name: Run tests run: make test - shell: bash + shell: bash \ No newline at end of file diff --git a/Makefile b/Makefile index 74ae658..7b6b7c1 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +VCPKG_MANIFEST_FEATURES ?= examples\;tests + .PHONY: all all: clean configure build From 1be63bc328e6cf0aaad33ba4299bc63e06a7b9fd Mon Sep 17 00:00:00 2001 From: Antonia Elsen Date: Wed, 12 Mar 2025 00:18:38 -0700 Subject: [PATCH 7/7] chore: consolidate ci workflows --- .github/workflows/build-test.yml | 88 -------------------------------- .github/workflows/main.yml | 87 +++++++++++++++++++++++++------ 2 files changed, 71 insertions(+), 104 deletions(-) delete mode 100644 .github/workflows/build-test.yml diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml deleted file mode 100644 index 34e5104..0000000 --- a/.github/workflows/build-test.yml +++ /dev/null @@ -1,88 +0,0 @@ -on: - workflow_call: - inputs: - runner: - description: "The runner to use" - required: true - default: "ubuntu-22.04" - type: string - triplet: - description: "The triplet to use" - required: true - default: "x64-linux" - type: string - -permissions: - contents: write - -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - _VCPKG_: ${{ github.workspace }}/external/microsoft/vcpkg - VCPKG_ROOT: ${{ github.workspace }}/external/microsoft/vcpkg - VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" - VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/external/microsoft/vcpkg/bincache - VCPKG_FEATURE_FLAGS: "dependencygraph" - -jobs: - build: - runs-on: ${{ inputs.runner }} - steps: - - name: Check out repository code - uses: actions/checkout@v4 - with: - submodules: "true" - - - uses: actions/github-script@v6 - with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - - - name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" - run: mkdir -p ${{ github.workspace }}/external/microsoft/vcpkg/bincache - shell: bash - - - uses: lukka/get-cmake@latest - with: - cmakeVersion: "3.29.0" - - - name: Restore vcpkg - uses: actions/cache@v3 - with: - path: | - ${{ env._VCPKG_ }} - !${{ env._VCPKG_ }}/buildtrees - !${{ env._VCPKG_ }}/packages - !${{ env._VCPKG_ }}/downloads - !${{ env._VCPKG_ }}/installed - key: | - ${{ inputs.triplet }}-${{ hashFiles( '.git/modules/external/microsoft/vcpkg/HEAD' )}} - - - name: Configure - env: - CMAKE_VERBOSE_MAKEFILE: 1 - VCPKG_DEBUG: 1 - run: | - echo "Configuring for triplet ${{ inputs.triplet }}" - TRIPLET=${{ inputs.triplet }} make configure - - - name: Upload vcpkg buildtrees - if: always() - uses: actions/upload-artifact@v4 - with: - name: vcpkg-buildtrees-${{ inputs.triplet }}-${{ github.sha }} - path: external/microsoft/vcpkg/buildtrees/science-scipp - retention-days: 1 - - - name: Build - run: NPROC=1 make build - - - uses: actions/upload-artifact@v4 - with: - name: build-${{ inputs.triplet }}-${{ github.sha }} - path: build - retention-days: 1 - - - name: Run tests - run: make test - shell: bash \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8fa609b..9116b23 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,24 +5,79 @@ on: pull_request: workflow_dispatch: -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - permissions: contents: write +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + _VCPKG_: ${{ github.workspace }}/external/microsoft/vcpkg + VCPKG_ROOT: ${{ github.workspace }}/external/microsoft/vcpkg + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" + VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/external/microsoft/vcpkg/bincache + VCPKG_FEATURE_FLAGS: "dependencygraph" + jobs: build-test: - strategy: - fail-fast: false - matrix: - build: - [ - { runner: "ubuntu-22.04", triplet: "x64-linux" }, - ] - uses: ./.github/workflows/build-test.yml - with: - runner: ${{ matrix.build.runner }} - triplet: ${{ matrix.build.triplet }} - secrets: inherit + runs-on: ubuntu-22.04 + env: + TRIPLET: x64-linux + steps: + - name: Check out repository code + uses: actions/checkout@v4 + with: + submodules: "true" + + - uses: actions/github-script@v6 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" + run: mkdir -p ${{ github.workspace }}/external/microsoft/vcpkg/bincache + shell: bash + + - uses: lukka/get-cmake@latest + with: + cmakeVersion: "3.29.0" + + - name: Restore vcpkg + uses: actions/cache@v3 + with: + path: | + ${{ env._VCPKG_ }} + !${{ env._VCPKG_ }}/buildtrees + !${{ env._VCPKG_ }}/packages + !${{ env._VCPKG_ }}/downloads + !${{ env._VCPKG_ }}/installed + key: | + ${{ env.TRIPLET }}-${{ hashFiles( '.git/modules/external/microsoft/vcpkg/HEAD' )}} + + - name: Configure + env: + CMAKE_VERBOSE_MAKEFILE: 1 + VCPKG_DEBUG: 1 + run: | + echo "Configuring for triplet ${{ env.TRIPLET }}" + TRIPLET=${{ env.TRIPLET }} make configure + + - name: Upload vcpkg buildtrees + if: always() + uses: actions/upload-artifact@v4 + with: + name: vcpkg-buildtrees-${{ env.TRIPLET }}-${{ github.sha }} + path: external/microsoft/vcpkg/buildtrees/science-scipp + retention-days: 1 + + - name: Build + run: NPROC=1 make build + + - uses: actions/upload-artifact@v4 + with: + name: build-${{ env.TRIPLET }}-${{ github.sha }} + path: build + retention-days: 1 + + - name: Run tests + run: make test + shell: bash \ No newline at end of file