diff --git a/.github/workflows/commit_stage.yml b/.github/workflows/commit_stage.yml new file mode 100644 index 00000000..93ed4bab --- /dev/null +++ b/.github/workflows/commit_stage.yml @@ -0,0 +1,21 @@ +name: Commit stage + +on : + push: + branches: [ dev, main ] + pull_request: + branches: [ dev ] + paths-ignore: + - 'Docker' + - '**/README.md' + - '**/LICENCE' + +jobs: + 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}} + 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..bc17c4a2 --- /dev/null +++ b/.github/workflows/release_stage.yml @@ -0,0 +1,35 @@ +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: + 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/.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}} - 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