From f7c169d4c920b764e6a3af10eb76b236d59852cc Mon Sep 17 00:00:00 2001 From: Alex Kremer Date: Tue, 28 May 2024 21:44:57 +0100 Subject: [PATCH 1/5] Implement libxrpl upload flow --- .github/workflows/libxrpl.yml | 86 +++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/libxrpl.yml diff --git a/.github/workflows/libxrpl.yml b/.github/workflows/libxrpl.yml new file mode 100644 index 00000000000..74d8c28b24b --- /dev/null +++ b/.github/workflows/libxrpl.yml @@ -0,0 +1,86 @@ +name: Upload libXRPL to Conan +env: + CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod + CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }} + CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }} +on: + pull_request: + paths: + - 'src/ripple/protocol/impl/BuildInfo.cpp' + - '.github/workflows/libxrpl.yml' + branches: [release] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + publish: + name: Publish libXRPL + outputs: + outcome: ${{ steps.upload.outputs.outcome }} + version: ${{ steps.version.outputs.version }} + runs-on: [self-hosted, heavy] + container: rippleci/rippled-build-ubuntu:aaf5e3e + steps: + - name: Wait for essential checks to succeed + uses: lewagon/wait-on-check-action@v1.3.4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + running-workflow-name: wait-for-check-regexp + check-regexp: '(dependencies|test).*linux.*' # Ignore windows and mac tests but make sure linux passes + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 10 + - name: Checkout + uses: actions/checkout@v4 + - name: Unlock Conan + shell: bash + run: conan remove --locks + - name: Export new package + shell: bash + run: | + conan export . + - name: Add Ripple Conan remote + shell: bash + run: | + conan remote list + conan remote remove ripple || true + # Do not quote the URL. An empty string will be accepted (with a non-fatal warning), but a missing argument will not. + conan remote add ripple ${{ env.CONAN_URL }} --insert 0 + - name: Parse new version + id: version + shell: bash + run: | + echo version=$(cat src/ripple/protocol/impl/BuildInfo.cpp \ + | grep "versionString =" | awk -F '"' '{print $2}') \ + | tee ${GITHUB_OUTPUT} + - name: Try to authenticate to Ripple Conan remote + id: remote + shell: bash + run: | + # `conan user` implicitly uses the environment variables CONAN_LOGIN_USERNAME_ and CONAN_PASSWORD_. + # https://docs.conan.io/1/reference/commands/misc/user.html#using-environment-variables + # https://docs.conan.io/1/reference/env_vars.html#conan-login-username-conan-login-username-remote-name + # https://docs.conan.io/1/reference/env_vars.html#conan-password-conan-password-remote-name + echo outcome=$(conan user --remote ripple --password >&2 \ + && echo success || echo failure) | tee ${GITHUB_OUTPUT} + - name: Upload new package + id: upload + if: (steps.remote.outputs.outcome == 'success') + shell: bash + run: | + echo "conan upload version ${{ steps.version.outputs.version }}" + echo outcome=$(conan upload xrpl/${{ steps.version.outputs.version }} --remote ripple --confirm >&2 \ + && echo success || echo failure) | tee ${GITHUB_OUTPUT} + notify_clio: + name: Notify Clio + runs-on: ubuntu-latest + needs: publish + env: + GH_TOKEN: ${{ secrets.CLIO_NOTIFY_TOKEN }} + steps: + - name: Notify Clio about new version + if: (needs.publish.outputs.outcome == 'success') + shell: bash + run: | + gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/xrplf/clio/dispatches -f "event_type=check_libxrpl" -F "client_payload[version]=${{ needs.publish.outputs.version }}" From 1c08aacb08f7d54438ab7364bdc20cc450af68c8 Mon Sep 17 00:00:00 2001 From: Alex Kremer Date: Mon, 5 Aug 2024 21:12:35 +0100 Subject: [PATCH 2/5] Remove branches leaving paths only --- .github/workflows/libxrpl.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/libxrpl.yml b/.github/workflows/libxrpl.yml index 74d8c28b24b..20983ce8687 100644 --- a/.github/workflows/libxrpl.yml +++ b/.github/workflows/libxrpl.yml @@ -8,7 +8,6 @@ on: paths: - 'src/ripple/protocol/impl/BuildInfo.cpp' - '.github/workflows/libxrpl.yml' - branches: [release] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true From 495e986b1f0b56373f1eb4956659024352737b86 Mon Sep 17 00:00:00 2001 From: Alex Kremer Date: Tue, 6 Aug 2024 17:42:50 +0100 Subject: [PATCH 3/5] Introduce pr number and use channels --- .github/workflows/libxrpl.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/libxrpl.yml b/.github/workflows/libxrpl.yml index 20983ce8687..2372adc7edf 100644 --- a/.github/workflows/libxrpl.yml +++ b/.github/workflows/libxrpl.yml @@ -1,4 +1,4 @@ -name: Upload libXRPL to Conan +name: Check libXRPL compatibility with Clio env: CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }} @@ -6,7 +6,7 @@ env: on: pull_request: paths: - - 'src/ripple/protocol/impl/BuildInfo.cpp' + - 'src/libxrpl/protocol/BuildInfo.cpp' - '.github/workflows/libxrpl.yml' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -18,6 +18,7 @@ jobs: outputs: outcome: ${{ steps.upload.outputs.outcome }} version: ${{ steps.version.outputs.version }} + channel: ${{ steps.channel.outputs.channel }} runs-on: [self-hosted, heavy] container: rippleci/rippled-build-ubuntu:aaf5e3e steps: @@ -26,18 +27,23 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha || github.sha }} running-workflow-name: wait-for-check-regexp - check-regexp: '(dependencies|test).*linux.*' # Ignore windows and mac tests but make sure linux passes + check-regexp: 'test.*linux.*' # Ignore windows and mac tests but make sure linux passes repo-token: ${{ secrets.GITHUB_TOKEN }} wait-interval: 10 - name: Checkout uses: actions/checkout@v4 + - name: Generate channel + id: channel + shell: bash + run: | + echo channel="clio/pr_${{ github.event.pull_request.number }}" | tee ${GITHUB_OUTPUT} - name: Unlock Conan shell: bash run: conan remove --locks - name: Export new package shell: bash run: | - conan export . + conan export . ${{ steps.channel.outputs.channel }} - name: Add Ripple Conan remote shell: bash run: | @@ -49,9 +55,8 @@ jobs: id: version shell: bash run: | - echo version=$(cat src/ripple/protocol/impl/BuildInfo.cpp \ - | grep "versionString =" | awk -F '"' '{print $2}') \ - | tee ${GITHUB_OUTPUT} + echo version="$(cat src/libxrpl/protocol/BuildInfo.cpp | grep "versionString =" \ + | awk -F '"' '{print $2}')" | tee ${GITHUB_OUTPUT} - name: Try to authenticate to Ripple Conan remote id: remote shell: bash @@ -67,8 +72,8 @@ jobs: if: (steps.remote.outputs.outcome == 'success') shell: bash run: | - echo "conan upload version ${{ steps.version.outputs.version }}" - echo outcome=$(conan upload xrpl/${{ steps.version.outputs.version }} --remote ripple --confirm >&2 \ + echo "conan upload version ${{ steps.version.outputs.version }} on channel ${{ steps.channel.outputs.channel }}" + echo outcome=$(conan upload xrpl/${{ steps.version.outputs.version }}@${{ steps.channel.outputs.channel }} --remote ripple --confirm >&2 \ && echo success || echo failure) | tee ${GITHUB_OUTPUT} notify_clio: name: Notify Clio @@ -82,4 +87,5 @@ jobs: shell: bash run: | gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \ - /repos/xrplf/clio/dispatches -f "event_type=check_libxrpl" -F "client_payload[version]=${{ needs.publish.outputs.version }}" + /repos/xrplf/clio/dispatches -f "event_type=check_libxrpl" \ + -F "client_payload[version]=${{ needs.publish.outputs.version }}@${{ needs.publish.outputs.channel }}" From ac32c7e8a5ac16b33561f757d5f0b32d2d249a5d Mon Sep 17 00:00:00 2001 From: Alex Kremer Date: Tue, 6 Aug 2024 17:52:14 +0100 Subject: [PATCH 4/5] Remove conan unlocking --- .github/workflows/libxrpl.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/libxrpl.yml b/.github/workflows/libxrpl.yml index 2372adc7edf..9d6c4586b77 100644 --- a/.github/workflows/libxrpl.yml +++ b/.github/workflows/libxrpl.yml @@ -37,9 +37,6 @@ jobs: shell: bash run: | echo channel="clio/pr_${{ github.event.pull_request.number }}" | tee ${GITHUB_OUTPUT} - - name: Unlock Conan - shell: bash - run: conan remove --locks - name: Export new package shell: bash run: | From 93c1e208e147c42c436adb642f81bf32604e3ebe Mon Sep 17 00:00:00 2001 From: Alex Kremer Date: Tue, 6 Aug 2024 18:01:02 +0100 Subject: [PATCH 5/5] Bring back dependencies in regexp --- .github/workflows/libxrpl.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/libxrpl.yml b/.github/workflows/libxrpl.yml index 9d6c4586b77..fe4a2c3e220 100644 --- a/.github/workflows/libxrpl.yml +++ b/.github/workflows/libxrpl.yml @@ -27,7 +27,7 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha || github.sha }} running-workflow-name: wait-for-check-regexp - check-regexp: 'test.*linux.*' # Ignore windows and mac tests but make sure linux passes + check-regexp: '(dependencies|test).*linux.*' # Ignore windows and mac tests but make sure linux passes repo-token: ${{ secrets.GITHUB_TOKEN }} wait-interval: 10 - name: Checkout