diff --git a/.github/actions/contract-tests/action.yml b/.github/actions/contract-tests/action.yml index 9fad6825..2eae46da 100644 --- a/.github/actions/contract-tests/action.yml +++ b/.github/actions/contract-tests/action.yml @@ -33,5 +33,5 @@ runs: uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1.0.2 with: test_service_port: 8000 - extra_params: '--status-timeout=120' + extra_params: '--status-timeout=360' token: ${{ inputs.token }} diff --git a/.github/workflows/manual-publish.yml b/.github/workflows/manual-publish.yml index c74851e4..a1aad17b 100644 --- a/.github/workflows/manual-publish.yml +++ b/.github/workflows/manual-publish.yml @@ -2,13 +2,14 @@ name: Manual Publish Package on: workflow_dispatch: inputs: - pkg_name: + pkg_workspace: description: 'The package to publish' required: true type: choice options: - - LaunchDarkly.ServerSdk - - LaunchDarkly.ServerSdk.Telemetry + - pkgs/sdk/client + - pkgs/sdk/server + - pkgs/telemetry dry_run: description: 'Is this a dry run. If so no package will be published.' type: boolean @@ -23,58 +24,32 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: macos-latest permissions: id-token: write contents: write outputs: - server-sdk-hashes: ${{ steps.server-sdk-release.outputs.hashes }} - telemetry-hashes: ${{ steps.telemetry-release.outputs.hashes }} + full-release-hashes: ${{ steps.full-release.outputs.hashes }} steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/full-release - id: server-sdk-release - if: ${{ inputs.pkg_name == 'LaunchDarkly.ServerSdk' }} - with: - workspace_path: 'pkgs/sdk/server' - project_file: 'pkgs/sdk/server/src/LaunchDarkly.ServerSdk.csproj' - test_project_file: 'pkgs/sdk/server/test/LaunchDarkly.ServerSdk.Tests.csproj' - build_output_path: 'pkgs/sdk/server/src/bin/Release/' - dll_name: 'LaunchDarkly.ServerSdk.dll' - dry_run: ${{ inputs.dry_run }} - aws_role: ${{ vars.AWS_ROLE_ARN }} - token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Env from project's Env file + shell: bash + run: echo "$(cat ${{ inputs.pkg_workspace }}/github_actions.env)" >> $GITHUB_ENV - uses: ./.github/actions/full-release - id: telemetry-release - if: ${{ inputs.pkg_name == 'LaunchDarkly.ServerSdk.Telemetry' }} + id: full-release with: - workspace_path: 'pkgs/telemetry' - project_file: 'pkgs/telemetry/src/LaunchDarkly.ServerSdk.Telemetry.csproj' - test_project_file: 'pkgs/telemetry/test/LaunchDarkly.ServerSdk.Telemetry.Tests.csproj' - build_output_path: 'pkgs/telemetry/src/bin/Release/' - dll_name: 'LaunchDarkly.ServerSdk.Telemetry.dll' + workspace_path: ${{ env.WORKSPACE_PATH }} + project_file: ${{ env.PROJECT_FILE }} + build_output_path: ${{ env.BUILD_OUTPUT_PATH }} + test_project_file: ${{ env.TEST_PROJECT_FILE }} + dll_name: ${{ env.BUILD_OUTPUT_DLL_NAME }} dry_run: ${{ inputs.dry_run }} aws_role: ${{ vars.AWS_ROLE_ARN }} token: ${{ secrets.GITHUB_TOKEN }} - release-sdk-server-provenance: - needs: ['build'] - permissions: - actions: read - id-token: write - contents: write - uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.10.0 - if: | - (inputs.generate_provenance == 'Generate' || (inputs.generate_provenance == 'Default' && github.ref_name == 'main')) && - inputs.pkg_name == 'LaunchDarkly.ServerSdk' - with: - base64-subjects: "${{ needs.build.outputs.server-sdk-hashes }}" - upload-assets: true - provenance-name: ${{ 'LaunchDarkly.ServerSdk_provenance.intoto.jsonl' }} - - - release-telemetry-server-provenance: + release-provenance: needs: ['build'] permissions: actions: read @@ -82,9 +57,8 @@ jobs: contents: write uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.10.0 if: | - (inputs.generate_provenance == 'Generate' || (inputs.generate_provenance == 'Default' && github.ref_name == 'main')) && - inputs.pkg_name == 'LaunchDarkly.ServerSdk.Telemetry' + (inputs.generate_provenance == 'Generate' || (inputs.generate_provenance == 'Default' && github.ref_name == 'main')) with: - base64-subjects: "${{ needs.build.outputs.telemetry-hashes }}" + base64-subjects: "${{ needs.build.outputs.full-release-hashes }}" upload-assets: true - provenance-name: ${{ 'LaunchDarkly.ServerSdk.Telemetry_provenance.intoto.jsonl' }} \ No newline at end of file + provenance-name: ${{inputs.pkg_workspace}}_provenance.intoto.jsonl diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index f14fbe4d..b9b5ca22 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -1,57 +1,44 @@ on: workflow_dispatch: inputs: - workspace_path: - description: 'Path to the workspace being released.' + pkg_workspace: + description: 'The package to publish' required: true - type: string - project_file: - description: 'Path to the project file.' - required: true - type: string - test_project_file: - description: 'Path to the test project file. If provided, run unit tests, otherwise skip them.' - required: false - type: string - workflow_call: - inputs: - workspace_path: - description: 'Path to the workspace being released.' - required: true - type: string - project_file: - description: 'Path to the project file.' - required: true - type: string - test_project_file: - description: 'Path to the test project file. If provided, run unit tests, otherwise skip them.' - required: false - type: string + type: choice + options: + - pkgs/sdk/client + - pkgs/sdk/server + - pkgs/telemetry name: Publish Docs jobs: build-publish: - runs-on: ubuntu-latest + runs-on: macos-latest permissions: contents: write # Needed in this case to write github pages. steps: - uses: actions/checkout@v4 + + - name: Setup Env from project's Env file + shell: bash + run: echo "$(cat ${{ inputs.pkg_workspace }}/github_actions.env)" >> $GITHUB_ENV + - id: build name: Build and Test SDK uses: ./.github/actions/ci with: - project_file: ${{ inputs.project_file }} - test_project_file: ${{ inputs.test_project_file }} + project_file: ${{ env.PROJECT_FILE }} + test_project_file: ${{ env.TEST_PROJECT_FILE }} - id: build-docs name: Build Documentation uses: ./.github/actions/build-docs with: - workspace_path: ${{ inputs.workspace_path }} + workspace_path: ${{ env.WORKSPACE_PATH }} - id: publish-docs name: Publish Documentation uses: ./.github/actions/publish-docs with: - workspace_path: ${{ inputs.workspace_path }} + workspace_path: ${{ env.WORKSPACE_PATH }} token: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index cf4869b6..8d4404f9 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -7,13 +7,15 @@ on: jobs: release-please: - runs-on: ubuntu-latest + runs-on: macos-latest outputs: package-sdk-server-released: ${{ steps.release.outputs['pkgs/sdk/server--release_created'] }} package-sdk-server-tag_name: ${{ steps.release.outputs['pkgs/sdk/server--tag_name'] }} package-sdk-server-telemetry-released: ${{ steps.release.outputs['pkgs/telemetry--release_created'] }} package-sdk-server-telemetry-tag_name: ${{ steps.release.outputs['pkgs/telemetry--tag_name'] }} + package-sdk-client-released: ${{ steps.release.outputs['pkgs/sdk/client--release_created'] }} + package-sdk-client-tag_name: ${{ steps.release.outputs['pkgs/sdk/client--tag_name'] }} tag_name: ${{ steps.release.outputs.tag_name }} steps: @@ -24,7 +26,7 @@ jobs: target-branch: ${{ github.ref_name }} release-sdk-server: - runs-on: ubuntu-latest + runs-on: macos-latest needs: release-please permissions: id-token: write @@ -35,55 +37,96 @@ jobs: hashes: ${{ steps.full-release.outputs.hashes }} steps: - uses: actions/checkout@v4 + + - name: Setup Env from project's Env file + shell: bash + run: echo "$(cat pkgs/sdk/server/github_actions.env)" >> $GITHUB_ENV + - uses: ./.github/actions/full-release id: full-release with: - workspace_path: 'pkgs/sdk/server' - project_file: 'pkgs/sdk/server/src/LaunchDarkly.ServerSdk.csproj' - test_project_file: 'pkgs/sdk/server/test/LaunchDarkly.ServerSdk.Tests.csproj' - build_output_path: 'pkgs/sdk/server/src/bin/Release/' - dll_name: 'LaunchDarkly.ServerSdk.dll' + workspace_path: ${{ env.WORKSPACE_PATH }} + project_file: ${{ env.PROJECT_FILE }} + build_output_path: ${{ env.BUILD_OUTPUT_PATH }} + test_project_file: ${{ env.TEST_PROJECT_FILE }} + dll_name: ${{ env.BUILD_OUTPUT_DLL_NAME }} dry_run: false aws_role: ${{ vars.AWS_ROLE_ARN }} token: ${{ secrets.GITHUB_TOKEN }} - release-sdk-server-provenance: - needs: ['release-please', 'release-sdk-server'] + release-telemetry: + runs-on: macos-latest + needs: release-please permissions: - actions: read id-token: write contents: write - uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.10.0 - with: - base64-subjects: "${{ needs.release-sdk-server.outputs.hashes }}" - upload-assets: true - upload-tag-name: ${{ needs.release-please.outputs.package-sdk-server-tag_name }} - provenance-name: ${{ format('LaunchDarkly.ServerSdk-{0}_provenance.intoto.jsonl', needs.release-please.outputs.package-sdk-server-tag_name) }} + pull-requests: write + if: ${{ needs.release-please.outputs.package-sdk-server-telemetry-released == 'true'}} + outputs: + hashes: ${{ steps.full-release.outputs.hashes }} + steps: + - uses: actions/checkout@v4 - release-telemetry: - runs-on: ubuntu-latest + - name: Setup Env from project's Env file + shell: bash + run: echo "$(cat pkgs/telemetry/github_actions.env)" >> $GITHUB_ENV + + - uses: ./.github/actions/full-release + id: full-release + with: + workspace_path: ${{ env.WORKSPACE_PATH }} + project_file: ${{ env.PROJECT_FILE }} + build_output_path: ${{ env.BUILD_OUTPUT_PATH }} + test_project_file: ${{ env.TEST_PROJECT_FILE }} + dll_name: ${{ env.BUILD_OUTPUT_DLL_NAME }} + dry_run: false + aws_role: ${{ vars.AWS_ROLE_ARN }} + token: ${{ secrets.GITHUB_TOKEN }} + + release-sdk-client: + runs-on: macos-latest needs: release-please permissions: id-token: write contents: write pull-requests: write - if: ${{ needs.release-please.outputs.package-sdk-server-telemetry-released == 'true'}} + if: ${{ needs.release-please.outputs.package-sdk-client-released == 'true'}} outputs: hashes: ${{ steps.full-release.outputs.hashes }} steps: - uses: actions/checkout@v4 + + - name: Setup Env from project's Env file + shell: bash + run: echo "$(cat pkgs/sdk/client/github_actions.env)" >> $GITHUB_ENV + - uses: ./.github/actions/full-release id: full-release with: - workspace_path: 'pkgs/telemetry' - project_file: 'pkgs/telemetry/src/LaunchDarkly.ServerSdk.Telemetry.csproj' - test_project_file: 'pkgs/telemetry/test/LaunchDarkly.ServerSdk.Telemetry.Tests.csproj' - build_output_path: 'pkgs/telemetry/src/bin/Release/' - dll_name: 'LaunchDarkly.ServerSdk.Telemetry.dll' + workspace_path: ${{ env.WORKSPACE_PATH }} + project_file: ${{ env.PROJECT_FILE }} + build_output_path: ${{ env.BUILD_OUTPUT_PATH }} + test_project_file: ${{ env.TEST_PROJECT_FILE }} + dll_name: ${{ env.BUILD_OUTPUT_DLL_NAME }} dry_run: false aws_role: ${{ vars.AWS_ROLE_ARN }} token: ${{ secrets.GITHUB_TOKEN }} + # TODO: refactor provenance + release-sdk-server-provenance: + needs: ['release-please', 'release-sdk-server'] + permissions: + actions: read + id-token: write + contents: write + uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.10.0 + with: + base64-subjects: "${{ needs.release-sdk-server.outputs.hashes }}" + upload-assets: true + upload-tag-name: ${{ needs.release-please.outputs.package-sdk-server-tag_name }} + provenance-name: ${{ format('LaunchDarkly.ServerSdk-{0}_provenance.intoto.jsonl', needs.release-please.outputs.package-sdk-server-tag_name) }} + + release-telemetry-provenance: needs: ['release-please', 'release-telemetry'] permissions: @@ -96,3 +139,5 @@ jobs: upload-assets: true upload-tag-name: ${{ needs.release-please.outputs.package-sdk-server-telemetry-tag_name }} provenance-name: ${{ format('LaunchDarkly.ServerSdk.Telemetry-{0}_provenance.intoto.jsonl', needs.release-please.outputs.package-sdk-server-telemetry-tag_name) }} + + # TODO: add client provenance \ No newline at end of file diff --git a/.github/workflows/sdk-client-ci.yml b/.github/workflows/sdk-client-ci.yml index 2880f402..9320ec66 100644 --- a/.github/workflows/sdk-client-ci.yml +++ b/.github/workflows/sdk-client-ci.yml @@ -13,7 +13,6 @@ jobs: build-and-test: strategy: matrix: - # TODO: Figure out mechanism to skip iOS framework on ubuntu and windows and re-add ubuntu and windows os: [macos-latest] fail-fast: false runs-on: ${{ matrix.os }} @@ -23,6 +22,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Setup Env from project's Env file + shell: bash + run: echo "$(cat pkgs/sdk/client/github_actions.env)" >> $GITHUB_ENV + - uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.0.1 name: Get secrets with: @@ -34,15 +37,17 @@ jobs: - uses: ./.github/actions/ci with: - project_file: pkgs/sdk/client/src/LaunchDarkly.ClientSdk.csproj - test_project_file: pkgs/sdk/client/test/LaunchDarkly.ClientSdk.Tests/LaunchDarkly.ClientSdk.Tests.csproj + project_file: ${{ env.PROJECT_FILE}} + test_project_file: ${{ env.TEST_PROJECT_FILE}} - uses: ./.github/actions/contract-tests with: - service_project_file: pkgs/sdk/client/contract-tests/TestService.csproj - service_dll_file: pkgs/sdk/client/contract-tests/bin/debug/net7.0/ContractTestService.dll + service_project_file: ${{ env.CONTRACT_TEST_PROJECT_FILE}} + service_dll_file: ${{ env.CONTRACT_TEST_DLL_FILE}} token: ${{ secrets.GITHUB_TOKEN }} - uses: ./.github/actions/build-docs with: - workspace_path: pkgs/sdk/client + workspace_path: ${{ env.WORKSPACE_PATH}} + +# TODO: resolve issue with emulator and device tests \ No newline at end of file diff --git a/.github/workflows/sdk-server-ci.yml b/.github/workflows/sdk-server-ci.yml index 2d672a66..4fddae42 100644 --- a/.github/workflows/sdk-server-ci.yml +++ b/.github/workflows/sdk-server-ci.yml @@ -22,6 +22,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Setup Env from project's Env file + shell: bash + run: echo "$(cat pkgs/sdk/server/github_actions.env)" >> $GITHUB_ENV + - uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.0.1 name: Get secrets with: @@ -29,15 +33,15 @@ jobs: - uses: ./.github/actions/ci with: - project_file: pkgs/sdk/server/src/LaunchDarkly.ServerSdk.csproj - test_project_file: pkgs/sdk/server/test/LaunchDarkly.ServerSdk.Tests.csproj + project_file: ${{ env.PROJECT_FILE}} + test_project_file: ${{ env.TEST_PROJECT_FILE}} - uses: ./.github/actions/contract-tests with: - service_project_file: pkgs/sdk/server/contract-tests/TestService.csproj - service_dll_file: pkgs/sdk/server/contract-tests/bin/debug/net6.0/ContractTestService.dll + service_project_file: ${{ env.CONTRACT_TEST_PROJECT_FILE}} + service_dll_file: ${{ env.CONTRACT_TEST_DLL_FILE}} token: ${{ secrets.GITHUB_TOKEN }} - uses: ./.github/actions/build-docs with: - workspace_path: pkgs/sdk/server + workspace_path: ${{ env.WORKSPACE_PATH}} diff --git a/.github/workflows/telemetry-ci.yml b/.github/workflows/telemetry-ci.yml index 625f0c5b..00c2eb19 100644 --- a/.github/workflows/telemetry-ci.yml +++ b/.github/workflows/telemetry-ci.yml @@ -22,6 +22,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Setup Env from project's Env file + shell: bash + run: echo "$(cat pkgs/telemetry/github_actions.env)" >> $GITHUB_ENV + - uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.0.1 name: Get secrets with: @@ -29,9 +33,9 @@ jobs: - uses: ./.github/actions/ci with: - project_file: pkgs/telemetry/src/LaunchDarkly.ServerSdk.Telemetry.csproj - test_project_file: pkgs/telemetry/test/LaunchDarkly.ServerSdk.Telemetry.Tests.csproj + project_file: ${{ env.PROJECT_FILE}} + test_project_file: ${{ env.TEST_PROJECT_FILE}} - uses: ./.github/actions/build-docs with: - workspace_path: pkgs/telemetry + workspace_path: ${{ env.WORKSPACE_PATH}} diff --git a/pkgs/sdk/client/github_actions.env b/pkgs/sdk/client/github_actions.env new file mode 100644 index 00000000..44dbcb33 --- /dev/null +++ b/pkgs/sdk/client/github_actions.env @@ -0,0 +1,7 @@ +WORKSPACE_PATH='pkgs/sdk/client' +PROJECT_FILE='pkgs/sdk/client/src/LaunchDarkly.ClientSdk.csproj' +BUILD_OUTPUT_PATH='pkgs/sdk/client/src/LaunchDarkly.ClientSdk/bin/Release/' +BUILD_OUTPUT_DLL_NAME='LaunchDarkly.ClientSdk.dll' +TEST_PROJECT_FILE='pkgs/sdk/client/test/LaunchDarkly.ClientSdk.Tests/LaunchDarkly.ClientSdk.Tests.csproj' +CONTRACT_TEST_PROJECT_FILE='pkgs/sdk/client/contract-tests/TestService.csproj' +CONTRACT_TEST_DLL_FILE='pkgs/sdk/client/contract-tests/bin/debug/net7.0/ContractTestService.dll' diff --git a/pkgs/sdk/server/github_actions.env b/pkgs/sdk/server/github_actions.env new file mode 100644 index 00000000..f1dc57de --- /dev/null +++ b/pkgs/sdk/server/github_actions.env @@ -0,0 +1,7 @@ +WORKSPACE_PATH='pkgs/sdk/server' +PROJECT_FILE='pkgs/sdk/server/src/LaunchDarkly.ServerSdk.csproj' +BUILD_OUTPUT_PATH='pkgs/sdk/server/src/bin/Release/' +BUILD_OUTPUT_DLL_NAME='LaunchDarkly.ServerSdk.dll' +TEST_PROJECT_FILE='pkgs/sdk/server/test/LaunchDarkly.ServerSdk.Tests.csproj' +CONTRACT_TEST_PROJECT_FILE='pkgs/sdk/server/contract-tests/TestService.csproj' +CONTRACT_TEST_DLL_FILE='pkgs/sdk/server/contract-tests/bin/debug/net6.0/ContractTestService.dll' \ No newline at end of file diff --git a/pkgs/telemetry/github_actions.env b/pkgs/telemetry/github_actions.env new file mode 100644 index 00000000..e8937a46 --- /dev/null +++ b/pkgs/telemetry/github_actions.env @@ -0,0 +1,5 @@ +WORKSPACE_PATH='pkgs/telemetry' +PROJECT_FILE='pkgs/telemetry/src/LaunchDarkly.ServerSdk.Telemetry.csproj' +BUILD_OUTPUT_PATH='pkgs/telemetry/src/bin/Release/' +BUILD_OUTPUT_DLL_NAME='LaunchDarkly.ServerSdk.Telemetry.dll' +TEST_PROJECT_FILE='pkgs/telemetry/test/LaunchDarkly.ServerSdk.Telemetry.Tests.csproj' \ No newline at end of file diff --git a/release-please-config.json b/release-please-config.json index 7d1f82c7..ced71197 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1,5 +1,5 @@ { - "bootstrap-sha": "7870a6ed7450d211ae822a281de45b6fc3df39c3", + "bootstrap-sha": "fedc48807cd2bb295f2e700352859779c0eea8c0", "separate-pull-requests": true, "include-component-in-tag": true, "packages": {