From 31d44abab36b17b9292137dd8262596db2de0552 Mon Sep 17 00:00:00 2001 From: Christophe Calmejane Date: Fri, 18 Jul 2025 16:56:16 +0200 Subject: [PATCH 1/2] Starting v1.2.8 feat: use la-build action fix: bad gtest filter fix: wrong key for steps output fix: spelling feat: update la-build commit ref feat: single workflow and matrix runners fix: add build config matrix values fix: update commit ref for la-build action fix: update la-build commit ref + delete legacy jobs feat: update la-build commit ref feat: update la-build commit ref feat: reafactor jobs and file name feat: add commit stage workflow fix: bad dependency reference feat: add release stage feat: use vars to control build platform fix: replace double quotes fix: move condition to the steps level fix: correct vars reference fix: correct vars ref for release feat: try using jq for matrix runner fix: use jq to parse json fix: use jq to parse json fix: use jq to parse json fix: remove line breaks in output fix: bad ref for runner outputs fix: remove legacy conditions fix: adjust release wf fix: adjust release wf fix: adjust release wf fix: remove legacy release workflow refactor: better name for release action --- .github/workflows/commit_stage.yml | 96 +++++++++++++ .github/workflows/format.yml | 58 -------- .github/workflows/linux.yml | 85 ------------ .github/workflows/macos.yml | 63 --------- .github/workflows/release.yml | 206 ---------------------------- .github/workflows/release_stage.yml | 107 +++++++++++++++ .github/workflows/windows.yml | 71 ---------- 7 files changed, 203 insertions(+), 483 deletions(-) create mode 100644 .github/workflows/commit_stage.yml delete mode 100644 .github/workflows/format.yml delete mode 100644 .github/workflows/linux.yml delete mode 100644 .github/workflows/macos.yml delete mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/release_stage.yml delete mode 100644 .github/workflows/windows.yml diff --git a/.github/workflows/commit_stage.yml b/.github/workflows/commit_stage.yml new file mode 100644 index 00000000..41bb1365 --- /dev/null +++ b/.github/workflows/commit_stage.yml @@ -0,0 +1,96 @@ +name: Commit stage + +on : + push: + branches: [ dev, main ] + pull_request: + branches: [ dev ] + paths-ignore: + - 'Docker' + - '**/README.md' + - '**/LICENCE' + +jobs: + validate: + runs-on: windows-2022 + outputs: + runners: ${{ steps.runners-matrix.outputs.runners }} + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install job dependencies + shell: bash + run: | + choco install -y dos2unix jq + curl https://www.kikisoft.com/Hive/clang-format/clang-format-7.0.0-LambdaPatch-windows.exe -o clang-format.exe + ln -s $(pwd)/clang-format.exe /usr/bin/clang-format + + - name: Run fix_files + shell: bash {0} + run: | + ./scripts/bashUtils/fix_files.sh + + - name: Check for changes + shell: bash + run: | + git diff --name-status --exit-code + if [ $? -ne 0 ]; then + echo "Some files need formatting/fixing. Please run the script and commit the changes." + exit 1 + fi + - name: prepare-runners-matrix + id: runners-matrix + shell: bash + run: | + macos=$([ ${{vars.BUILD_MACOS}} = "true" ] && jq -n --argjson r '${{vars.RUNNER_LABELS_MACOS}}' '$r' || echo '""') + echo $macos + linux=$([ ${{vars.BUILD_LINUX}} = "true" ] && jq -n --argjson r '${{vars.RUNNER_LABELS_LINUX}}' '$r' || echo '""') + echo $linux + windows=$([ ${{vars.BUILD_WINDOWS}} = "true" ] && jq -n --argjson r '${{vars.RUNNER_LABELS_WINDOWS}}' '$r' || echo '""') + echo $windows + + runners=$(jq -n --argjson m "$macos" --argjson l "$linux" --argjson w "$windows" '[$m,$l,$w]' | jq 'del(.[] | select(. == ""))' | tr -d '\n' ) + echo $runners + echo "runners=$runners" >> "$GITHUB_OUTPUT" + + build-test: + needs: validate + env: + LC_ALL: en_US.UTF-8 + + strategy: + fail-fast: false + matrix: + config: + - debug + - release + runner-label: ${{ fromJSON(needs.validate.outputs.runners) }} + + runs-on: ${{matrix.runner-label}} + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-swig@v0 + name: Install custom SWIG + id: la_swig + + + - name: Configure runner + uses: L-Acoustics/la-mw-gh-action/.github/actions/la-configure-runner@v0 + + - name: Build and Test Library + uses: L-Acoustics/la-mw-gh-action/.github/actions/la-build@e368cc944233da2d9b61c7bc3e6108cacf20b174 + with: + push_bindings: 'false' + GTEST_FILTER: '-MANUAL*' + SWIG_EXEC: ${{steps.la_swig.outputs.swig_exec}} + SWIG_DIR: ${{steps.la_swig.outputs.swig_dir}} + BUILD_DIR: "_build" + include_nuget_la_feed_url: 'false' + CONFIG: ${{matrix.config}} + NUGET_CURRENT_FEED_URL: 'https://nuget.pkg.github.com/L-Acoustics/index.json' + LIB_NAME: "la_networkInterfaceHelper" + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index 00f0a513..00000000 --- a/.github/workflows/format.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Format - -on : - push: - branches: [ dev, main ] - pull_request: - branches: [ dev ] - paths-ignore: - - 'Docker' - - '**/README.md' - - '**/LICENCE' - -env: - INCLUDE_LINUX: true - INCLUDE_WINDOWS: true - INCLUDE_MACOS: true - -jobs: - fix-files: - runs-on: windows-2022 - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Install job dependencies - shell: bash - run: | - choco install -y dos2unix - curl https://www.kikisoft.com/Hive/clang-format/clang-format-7.0.0-LambdaPatch-windows.exe -o clang-format.exe - ln -s $(pwd)/clang-format.exe /usr/bin/clang-format - - - name: Run fix_files - shell: bash {0} - run: | - ./scripts/bashUtils/fix_files.sh - - - name: Check for changes - shell: bash - run: | - git diff --name-status --exit-code - if [ $? -ne 0 ]; then - echo "Some files need formatting/fixing. Please run the script and commit the changes." - exit 1 - fi - - build-test-linux: - uses: ./.github/workflows/linux.yml - if: ${{ github.event_name == 'pull_request' }} - needs: fix-files - build-test-windows: - uses: ./.github/workflows/windows.yml - if: ${{ github.event_name == 'pull_request' }} - needs: fix-files - build-test-macos: - uses: ./.github/workflows/macos.yml - if: ${{ github.event_name == 'pull_request' }} - needs: fix-files - diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml deleted file mode 100644 index 4291820a..00000000 --- a/.github/workflows/linux.yml +++ /dev/null @@ -1,85 +0,0 @@ -###### DESCRIPTION -# -# -# This workflow builds and test the la library project for the following platform and config : -# -- Ubuntu-22.04 (x86) [release & debug] -# -- Ubuntu-22.04 (arm) [release & debug] -# -# This workflow is triggered on push to `dev` and `main` branches or on workflow_call -# The swig workflow to fetch the swig binaries is called and must execute successfully to continue -# -# - -name: Linux -on: - push: - branches: [ dev, main ] - workflow_call: - -permissions: - contents: write - pull-requests: write - checks: write - packages: write - -env: - NUGET_FEED_USENAME: github - NUGET_FEED_URL: https://nuget.pkg.github.com/${{github.repository_owner}}/index.json - lib_name: la_networkInterfaceHelper - build_dir: _build - GITHUB_TOKEN: ${{secrets.NUGET_PAT}} - -jobs: - linux-build-and-test: - strategy: - fail-fast: false - matrix: - config: ["release","debug"] - os: ["ubuntu-22.04","ubuntu-22.04-arm"] - - runs-on: ${{matrix.os}} - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-swig@v0 - name: Install custom SWIG - id: la_swig - - - - name: Configure runner - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-configure-runner@v0 - - - name: Configure CMake - shell: bash - run: | - echo "Generating CMake for config: ${{matrix.config}}" - - arch=$([ ${{runner.arch}} = "X64" ] && echo "x64" || echo "arm64") - ./gen_cmake.sh -o ${{env.build_dir}} -${{matrix.config}} -c Ninja -build-csharp -arch $arch -- \ - "-DNUGET_PUBLISH_SOURCE_URL=${{env.NUGET_FEED_URL}}" \ - "-DSWIG_DIR=${{steps.la_swig.outputs.swig_dir}}" \ - "-DCU_REPO_URL=https://github.com/${{github.repository}}" \ - "-DSWIG_EXECUTABLE=${{steps.la_swig.outputs.swig_exec}}" - - - - name: Build test - # Build your program with the given configuration - run: cmake --build ${{env.build_dir}} --target Tests - - - name: Test - working-directory: ${{github.workspace}}/${{env.build_dir}}/tests/src - shell: bash - run: | - test_cmd="./Tests --gtest_filter=-MANUAL*" - if [ "${{matrix.config}}" = "debug" ]; then - test_cmd="./Tests-d --gtest_filter=-MANUAL*" - fi - eval $test_cmd - - - name: Build all - # Build your program with the given configuration - run: cmake --build ${{env.build_dir}} --target all - - diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml deleted file mode 100644 index 30bf7e11..00000000 --- a/.github/workflows/macos.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Macos - -on: - push: - branches: [ dev, main ] - workflow_call: - -env: - NUGET_FEED_USENAME: github - NUGET_FEED_URL: https://nuget.pkg.github.com/${{github.repository_owner}}/index.json - lib_name: la_networkInterfaceHelper - build_dir: _build - GITHUB_TOKEN: ${{secrets.NUGET_PAT}} - -jobs: - macos-build-and-test: - strategy: - fail-fast: false - matrix: - config: ["release","debug"] - os: ["macos-14"] - - runs-on: ${{matrix.os}} - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-swig@v0 - name: Install custom SWIG - id: la_swig - - - name: Configure runner - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-configure-runner@v0 - - - name: Configure CMake - shell: bash - run: | - echo "Generating CMake for Configuration : ${{matrix.config}}" - - ./gen_cmake.sh -o ${{env.build_dir}} -${{matrix.config}} -c Ninja -build-csharp -all-archs -- \ - "-DNUGET_PUBLISH_SOURCE_URL=${{env.NUGET_FEED_URL}}" \ - "-DSWIG_DIR=${{steps.la_swig.outputs.swig_dir}}" \ - "-DCU_REPO_URL=https://github.com/${{github.repository}}" \ - "-DSWIG_EXECUTABLE=${{steps.la_swig.outputs.swig_exec}}" - - - name: Build tests - # Build your program with the given configuration - run: cmake --build ${{env.build_dir}} --target Tests - - - name: Test - working-directory: ${{github.workspace}}/${{env.build_dir}}/tests/src - shell: bash - run: | - test_cmd="./Tests --gtest_filter=-MANUAL*" - if [ "${{matrix.config}}" = "debug" ]; then - test_cmd="./Tests-d --gtest_filter=-MANUAL*" - fi - eval $test_cmd - - - name: Build all - # Build your program with the given configuration - run: cmake --build ${{env.build_dir}} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index f0fc9620..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,206 +0,0 @@ -name: Release - -on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' - - workflow_dispatch: - inputs: - gh_release: - description: 'Create the Github Release' - type: boolean - default: true - required: true - -permissions: - contents: write - pull-requests: write - checks: write - packages: write - id-token: write - - -env: - # nuget feed url should match the destination and location of current package and dependencies. - # Each sources must be added with nuget add source - NUGET_CURRENT_FEED_URL: https://nuget.pkg.github.com/${{github.repository_owner}}/index.json - # LA feed is required to fetch dependencies. - NUGET_LA_FEED_URL: https://nuget.pkg.github.com/L-Acoustics/index.json - lib_name: la_networkInterfaceHelper - build_dir: _build - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - -jobs: - release-linux: - strategy: - fail-fast: false - matrix: - config: ["release"] - os: ["ubuntu-22.04","ubuntu-22.04-arm"] - - runs-on: ${{matrix.os}} - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-swig@v0 - name: Install custom SWIG - id: la_swig - - - name: Configure runner - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-configure-runner@v0 - - - name: Configure CMake - shell: bash - run: | - echo "Generating CMake for Configuration : ${{matrix.config}}" - dotnet nuget add source --username "${{github.repository_owner}}" --password ${{env.GITHUB_TOKEN}} --store-password-in-clear-text --name current_feed "${{env.NUGET_CURRENT_FEED_URL}}" - - arch=$([ ${{runner.arch}} = "X64" ] && echo "x64" || echo "arm64") - ./gen_cmake.sh -o ${{env.build_dir}} -${{matrix.config}} -c Ninja -build-csharp -arch $arch -- \ - "-DNUGET_PUBLISH_SOURCE_URL=current_feed" \ - "-DSWIG_DIR=${{steps.la_swig.outputs.swig_dir}}" \ - "-DCU_REPO_URL=https://github.com/${{github.repository}}" \ - "-DSWIG_EXECUTABLE=${{steps.la_swig.outputs.swig_exec}}" \ - "-DBUILD_ATDECC_AUTOMATION_EXAMPLES=FALSE" - - - name: Build All - # Build your program with the given configuration - run: cmake --build ${{env.build_dir}} - - - name: Test - working-directory: ${{github.workspace}}/${{env.build_dir}}/tests/src - shell: bash - run: | - test_cmd="./Tests --gtest_filter=-MANUAL*" - if [ "${{matrix.config}}" = "debug" ]; then - test_cmd="./Tests-d --gtest_filter=-MANUAL*" - fi - eval $test_cmd - - - name: Push package - run : | - cmake --build ${{env.build_dir}} --target ${{env.lib_name}}-csharp-nuget-push - - release-windows: - env: - LC_ALL: en_US.UTF-8 - strategy: - fail-fast: false - matrix: - config: ["release"] - os: ["windows-2022"] - - runs-on: ${{matrix.os}} - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-swig@v0 - name: Install custom SWIG - id: la_swig - - - name: Configure runner - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-configure-runner@v0 - - - name: Configure CMake - shell: bash - run: | - echo "Generating CMake for Configuration : ${{matrix.config}}" - dotnet nuget add source --username "${{github.repository_owner}}" --password ${{env.GITHUB_TOKEN}} --store-password-in-clear-text --name current_feed "${{env.NUGET_CURRENT_FEED_URL}}" - - arch=$([ ${{runner.arch}} = "X64" ] && echo "x64" || echo "arm64") - ./gen_cmake.sh -o ${{env.build_dir}} -${{matrix.config}} -c Ninja -build-csharp -arch $arch -- \ - "-DNUGET_PUBLISH_SOURCE_URL=current_feed" \ - "-DSWIG_DIR=${{steps.la_swig.outputs.swig_dir}}" \ - "-DCU_REPO_URL=https://github.com/${{github.repository}}" \ - "-DSWIG_EXECUTABLE=${{steps.la_swig.outputs.swig_exec}}" \ - "-DBUILD_ATDECC_AUTOMATION_EXAMPLES=FALSE" - - - name: Build All - # Build your program with the given configuration - run: cmake --build ${{env.build_dir}} - - name: Test - working-directory: ${{github.workspace}}/${{env.build_dir}}/tests/src - shell: bash - run: | - test_cmd="./Tests --gtest_filter=-MANUAL*" - if [ "${{matrix.config}}" = "debug" ]; then - test_cmd="./Tests-d --gtest_filter=-MANUAL*" - fi - eval $test_cmd - - - name: Push package - run : | - # add source - cmake --build ${{env.build_dir}} --target ${{env.lib_name}}-csharp-nuget-push - - release-macos: - strategy: - fail-fast: false - matrix: - config: ["release"] - os: ["macos-14"] - - runs-on: ${{matrix.os}} - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-swig@v0 - name: Install custom SWIG - id: la_swig - - - name: Configure runner - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-configure-runner@v0 - - - name: Configure CMake - shell: bash - run: | - echo "Generating CMake for Configuration : ${{matrix.config}}" - dotnet nuget add source --username "${{github.repository_owner}}" --password ${{env.GITHUB_TOKEN}} --store-password-in-clear-text --name current_feed "${{env.NUGET_CURRENT_FEED_URL}}" - - ./gen_cmake.sh -o ${{env.build_dir}} -${{matrix.config}} -c Ninja -build-csharp -all-archs -- \ - "-DNUGET_PUBLISH_SOURCE_URL=current_feed" \ - "-DSWIG_DIR=${{steps.la_swig.outputs.swig_dir}}" \ - "-DCU_REPO_URL=https://github.com/${{github.repository}}" \ - "-DSWIG_EXECUTABLE=${{steps.la_swig.outputs.swig_exec}}" \ - "-DBUILD_ATDECC_AUTOMATION_EXAMPLES=FALSE" - - - name: Build All - # Build your program with the given configuration - run: cmake --build ${{env.build_dir}} - - - name: Test - working-directory: ${{github.workspace}}/${{env.build_dir}}/tests/src - shell: bash - run: | - test_cmd="./Tests --gtest_filter=-MANUAL*" - if [ "${{matrix.config}}" = "debug" ]; then - test_cmd="./Tests-d --gtest_filter=-MANUAL*" - fi - eval $test_cmd - - - name: Push package - run : | - # add source - cmake --build ${{env.build_dir}} --target ${{env.lib_name}}-csharp-nuget-push - - create-gh-release: - needs: [release-macos,release-windows,release-linux] - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Release - uses: softprops/action-gh-release@v2 - if: github.ref_type == 'tag' - with: - prerelease: ${{ contains(github.ref_name, 'beta') }} - diff --git a/.github/workflows/release_stage.yml b/.github/workflows/release_stage.yml new file mode 100644 index 00000000..0113e25a --- /dev/null +++ b/.github/workflows/release_stage.yml @@ -0,0 +1,107 @@ +name: Release stage + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+.[0-9]+' + + workflow_dispatch: + inputs: + release_linux: + description: 'Release the linux package' + type: boolean + default: true + release_windows: + description: 'Release the windows package' + type: boolean + default: true + release_macos: + description: 'Release the macos package' + type: boolean + default: true + +jobs: + validate: + runs-on: windows-2022 + outputs: + runners: ${{ steps.runners-matrix.outputs.runners }} + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install job dependencies + shell: bash + run: | + choco install -y dos2unix + curl https://www.kikisoft.com/Hive/clang-format/clang-format-7.0.0-LambdaPatch-windows.exe -o clang-format.exe + ln -s $(pwd)/clang-format.exe /usr/bin/clang-format + + - name: Run fix_files + shell: bash {0} + run: | + ./scripts/bashUtils/fix_files.sh + + - name: Check for changes + shell: bash + run: | + git diff --name-status --exit-code + if [ $? -ne 0 ]; then + echo "Some files need formatting/fixing. Please run the script and commit the changes." + exit 1 + fi + - name: prepare-runners-matrix + id: runners-matrix + shell: bash + run: | + macos=$(([ ${{vars.RELEASE_MACOS}} = "true" ] || [ ${{inputs.RELEASE_MACOS}} = "true" ]) && jq -n --argjson r '${{vars.RUNNER_LABELS_MACOS}}' '$r' || echo '""') + echo $macos + linux=$(([ ${{vars.RELEASE_LINUX}} = "true" ] || [ ${{inputs.RELEASE_LINUX}} = "true" ]) && jq -n --argjson r '${{vars.RUNNER_LABELS_LINUX}}' '$r' || echo '""') + echo $linux + windows=$(([ ${{vars.RELEASE_WINDOWS}} = "true" ] || [ ${{inputs.RELEASE_WINDOWS}} = "true" ]) && jq -n --argjson r '${{vars.RUNNER_LABELS_WINDOWS}}' '$r' || echo '""') + echo $windows + + runners=$(jq -n --argjson m "$macos" --argjson l "$linux" --argjson w "$windows" '[$m,$l,$w]' | jq 'del(.[] | select(. == ""))' | tr -d '\n' ) + echo $runners + echo "runners=$runners" >> "$GITHUB_OUTPUT" + + release: + + needs: validate + env: + LC_ALL: en_US.UTF-8 + + strategy: + fail-fast: false + matrix: + config: + - release + runner-label: ${{ fromJSON(needs.validate.outputs.runners) }} + + runs-on: ${{matrix.runner-label}} + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-swig@v0 + name: Install custom SWIG + id: la_swig + + + - name: Configure runner + uses: L-Acoustics/la-mw-gh-action/.github/actions/la-configure-runner@v0 + + - name: Build, Test, Push Library + uses: L-Acoustics/la-mw-gh-action/.github/actions/la-build@e368cc944233da2d9b61c7bc3e6108cacf20b174 + with: + push_bindings: 'true' + GTEST_FILTER: '-MANUAL*' + SWIG_EXEC: ${{steps.la_swig.outputs.swig_exec}} + SWIG_DIR: ${{steps.la_swig.outputs.swig_dir}} + BUILD_DIR: "_build" + include_nuget_la_feed_url: 'false' + CONFIG: ${{matrix.config}} + NUGET_CURRENT_FEED_URL: 'https://nuget.pkg.github.com/L-Acoustics/index.json' + LIB_NAME: "la_networkInterfaceHelper" + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index 4a23b962..00000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Windows - - -on: - push: - branches: [ dev, main ] - workflow_call: - -env: - NUGET_FEED_USENAME: github - NUGET_FEED_URL: https://nuget.pkg.github.com/${{github.repository_owner}}/index.json - lib_name: la_networkInterfaceHelper - build_dir: _build - GITHUB_TOKEN: ${{secrets.NUGET_PAT}} - -jobs: - - windows-build-and-test: - strategy: - fail-fast: false - matrix: - config: ["release","debug"] - os: ["windows-2022"] - - runs-on: ${{matrix.os}} - env: - LC_ALL: en_US.UTF-8 - - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-swig@v0 - name: Install custom SWIG - id: la_swig - - - name: Configure runner - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-configure-runner@v0 - - - name: Configure CMake - shell: bash - run: | - echo "Generating CMake for config: ${{matrix.config}}" - - arch=$([ ${{runner.arch}} = "X64" ] && echo "x64" || echo "arm64") - ./gen_cmake.sh -o ${{env.build_dir}} -${{matrix.config}} -build-csharp -c Ninja -arch $arch -- \ - "-DNUGET_PUBLISH_SOURCE_URL=${{env.NUGET_FEED_URL}}" \ - "-DSWIG_DIR=${{steps.la_swig.outputs.swig_dir}}" \ - "-DCU_REPO_URL=https://github.com/${{github.repository}}" \ - "-DSWIG_EXECUTABLE=${{steps.la_swig.outputs.swig_exec}}" - - - - name: Build tests - # Build your program with the given configuration - run: cmake --build ${{env.build_dir}} --target Tests - - - name: Test - working-directory: ${{github.workspace}}/${{env.build_dir}}/tests/src - shell: bash - run: | - test_cmd="./Tests --gtest_filter=-MANUAL*" - if [ "${{matrix.config}}" = "debug" ]; then - test_cmd="./Tests-d --gtest_filter=-MANUAL*" - fi - eval $test_cmd - - - name: Build all - # Build your program with the given configuration - run: cmake --build ${{env.build_dir}} - From f927e7a909d214fa93c7337fb69b9d3d25bb3ce9 Mon Sep 17 00:00:00 2001 From: Adriano FRANCI Date: Thu, 24 Jul 2025 15:33:32 +0200 Subject: [PATCH 2/2] feat: use workflows from la-mw-gh-action repo fix: change gh toekn name feat: pass secrets to workflows fix: add secrets to gitignroe feat: add variables fix: set Gtest variable --- .github/workflows/commit_stage.yml | 89 +++------------------------ .github/workflows/release_stage.yml | 94 ++++------------------------- .github/workflows/variables.env | 20 ++++++ .gitignore | 2 + 4 files changed, 40 insertions(+), 165 deletions(-) create mode 100644 .github/workflows/variables.env diff --git a/.github/workflows/commit_stage.yml b/.github/workflows/commit_stage.yml index 41bb1365..93ed4bab 100644 --- a/.github/workflows/commit_stage.yml +++ b/.github/workflows/commit_stage.yml @@ -11,86 +11,11 @@ on : - '**/LICENCE' jobs: - validate: - runs-on: windows-2022 - outputs: - runners: ${{ steps.runners-matrix.outputs.runners }} - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Install job dependencies - shell: bash - run: | - choco install -y dos2unix jq - curl https://www.kikisoft.com/Hive/clang-format/clang-format-7.0.0-LambdaPatch-windows.exe -o clang-format.exe - ln -s $(pwd)/clang-format.exe /usr/bin/clang-format + commit-stage: + uses: L-Acoustics/la-mw-gh-action/.github/workflows/commit_stage.yml@main + secrets: + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + KEYCHAIN_PASSWORD: ${{secrets.KEYCHAIN_PASSWORD}} + APPLE_CERTIFICATES_P12_BASE64_PASSWORD: ${{secrets.APPLE_CERTIFICATES_P12_BASE64_PASSWORD}} + APPLE_CERTIFICATES_P12_BASE64: ${{secrets.APPLE_CERTIFICATES_P12_BASE64}} - - name: Run fix_files - shell: bash {0} - run: | - ./scripts/bashUtils/fix_files.sh - - - name: Check for changes - shell: bash - run: | - git diff --name-status --exit-code - if [ $? -ne 0 ]; then - echo "Some files need formatting/fixing. Please run the script and commit the changes." - exit 1 - fi - - name: prepare-runners-matrix - id: runners-matrix - shell: bash - run: | - macos=$([ ${{vars.BUILD_MACOS}} = "true" ] && jq -n --argjson r '${{vars.RUNNER_LABELS_MACOS}}' '$r' || echo '""') - echo $macos - linux=$([ ${{vars.BUILD_LINUX}} = "true" ] && jq -n --argjson r '${{vars.RUNNER_LABELS_LINUX}}' '$r' || echo '""') - echo $linux - windows=$([ ${{vars.BUILD_WINDOWS}} = "true" ] && jq -n --argjson r '${{vars.RUNNER_LABELS_WINDOWS}}' '$r' || echo '""') - echo $windows - - runners=$(jq -n --argjson m "$macos" --argjson l "$linux" --argjson w "$windows" '[$m,$l,$w]' | jq 'del(.[] | select(. == ""))' | tr -d '\n' ) - echo $runners - echo "runners=$runners" >> "$GITHUB_OUTPUT" - - build-test: - needs: validate - env: - LC_ALL: en_US.UTF-8 - - strategy: - fail-fast: false - matrix: - config: - - debug - - release - runner-label: ${{ fromJSON(needs.validate.outputs.runners) }} - - runs-on: ${{matrix.runner-label}} - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-swig@v0 - name: Install custom SWIG - id: la_swig - - - - name: Configure runner - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-configure-runner@v0 - - - name: Build and Test Library - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-build@e368cc944233da2d9b61c7bc3e6108cacf20b174 - with: - push_bindings: 'false' - GTEST_FILTER: '-MANUAL*' - SWIG_EXEC: ${{steps.la_swig.outputs.swig_exec}} - SWIG_DIR: ${{steps.la_swig.outputs.swig_dir}} - BUILD_DIR: "_build" - include_nuget_la_feed_url: 'false' - CONFIG: ${{matrix.config}} - NUGET_CURRENT_FEED_URL: 'https://nuget.pkg.github.com/L-Acoustics/index.json' - LIB_NAME: "la_networkInterfaceHelper" - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/release_stage.yml b/.github/workflows/release_stage.yml index 0113e25a..bc17c4a2 100644 --- a/.github/workflows/release_stage.yml +++ b/.github/workflows/release_stage.yml @@ -22,86 +22,14 @@ on: default: true jobs: - validate: - runs-on: windows-2022 - outputs: - runners: ${{ steps.runners-matrix.outputs.runners }} - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Install job dependencies - shell: bash - run: | - choco install -y dos2unix - curl https://www.kikisoft.com/Hive/clang-format/clang-format-7.0.0-LambdaPatch-windows.exe -o clang-format.exe - ln -s $(pwd)/clang-format.exe /usr/bin/clang-format - - - name: Run fix_files - shell: bash {0} - run: | - ./scripts/bashUtils/fix_files.sh - - - name: Check for changes - shell: bash - run: | - git diff --name-status --exit-code - if [ $? -ne 0 ]; then - echo "Some files need formatting/fixing. Please run the script and commit the changes." - exit 1 - fi - - name: prepare-runners-matrix - id: runners-matrix - shell: bash - run: | - macos=$(([ ${{vars.RELEASE_MACOS}} = "true" ] || [ ${{inputs.RELEASE_MACOS}} = "true" ]) && jq -n --argjson r '${{vars.RUNNER_LABELS_MACOS}}' '$r' || echo '""') - echo $macos - linux=$(([ ${{vars.RELEASE_LINUX}} = "true" ] || [ ${{inputs.RELEASE_LINUX}} = "true" ]) && jq -n --argjson r '${{vars.RUNNER_LABELS_LINUX}}' '$r' || echo '""') - echo $linux - windows=$(([ ${{vars.RELEASE_WINDOWS}} = "true" ] || [ ${{inputs.RELEASE_WINDOWS}} = "true" ]) && jq -n --argjson r '${{vars.RUNNER_LABELS_WINDOWS}}' '$r' || echo '""') - echo $windows - - runners=$(jq -n --argjson m "$macos" --argjson l "$linux" --argjson w "$windows" '[$m,$l,$w]' | jq 'del(.[] | select(. == ""))' | tr -d '\n' ) - echo $runners - echo "runners=$runners" >> "$GITHUB_OUTPUT" - - release: - - needs: validate - env: - LC_ALL: en_US.UTF-8 - - strategy: - fail-fast: false - matrix: - config: - - release - runner-label: ${{ fromJSON(needs.validate.outputs.runners) }} - - runs-on: ${{matrix.runner-label}} - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-swig@v0 - name: Install custom SWIG - id: la_swig - - - - name: Configure runner - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-configure-runner@v0 - - - name: Build, Test, Push Library - uses: L-Acoustics/la-mw-gh-action/.github/actions/la-build@e368cc944233da2d9b61c7bc3e6108cacf20b174 - with: - push_bindings: 'true' - GTEST_FILTER: '-MANUAL*' - SWIG_EXEC: ${{steps.la_swig.outputs.swig_exec}} - SWIG_DIR: ${{steps.la_swig.outputs.swig_dir}} - BUILD_DIR: "_build" - include_nuget_la_feed_url: 'false' - CONFIG: ${{matrix.config}} - NUGET_CURRENT_FEED_URL: 'https://nuget.pkg.github.com/L-Acoustics/index.json' - LIB_NAME: "la_networkInterfaceHelper" - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + release-stage: + uses: L-Acoustics/la-mw-gh-action/.github/workflows/release_stage.yml@main + with: + release_linux: ${{inputs.release_linux}} + release_windows: ${{inputs.release_windows}} + release_macos: ${{inputs.release_macos}} + secrets: + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + KEYCHAIN_PASSWORD: ${{secrets.KEYCHAIN_PASSWORD}} + APPLE_CERTIFICATES_P12_BASE64_PASSWORD: ${{secrets.APPLE_CERTIFICATES_P12_BASE64_PASSWORD}} + APPLE_CERTIFICATES_P12_BASE64: ${{secrets.APPLE_CERTIFICATES_P12_BASE64}} diff --git a/.github/workflows/variables.env b/.github/workflows/variables.env new file mode 100644 index 00000000..ecf7abde --- /dev/null +++ b/.github/workflows/variables.env @@ -0,0 +1,20 @@ +# These variables should be set within the repository +# Quotes are need to make them valid JSON +RUNNER_LABELS_WINDOWS='"windows-2022"' +RUNNER_LABELS_MACOS='"macos-14"' +RUNNER_LABELS_LINUX='"ubuntu-22.04"' + +RELEASE_MACOS='false' +RELEASE_LINUX='false' +RELEASE_WINDOWS='false' + +BUILD_MACOS='true' +BUILD_LINUX='true' +BUILD_WINDOWS='false' + +LIB_NAME='la_networkInterfaceHelper' +BUILD_DIR='_build' + +MACOS_SIGNING_IDENTITY="L-ACOUSTICS (4WPJ48N2K4)" +GTEST_FILTER='-MANUAL*' + diff --git a/.gitignore b/.gitignore index 6e58778a..7d8d197b 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ # Ignore CMakeUser presets CMakeUserPresets.json + +**/secrets.env