Skip to content

Commit 93d8baf

Browse files
committed
chore: libxrpl verification on CI (XRPLF#5028)
Implements a CI workflow that detects when a new version of libxrpl is proposed, uploads it to artifactory under the `clio` channel and notifies Clio's CI to check this newly proposed version.
1 parent c19a88f commit 93d8baf

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

.github/workflows/libxrpl.yml

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Check libXRPL compatibility with Clio
2+
env:
3+
CONAN_URL: http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
4+
CONAN_LOGIN_USERNAME_RIPPLE: ${{ secrets.CONAN_USERNAME }}
5+
CONAN_PASSWORD_RIPPLE: ${{ secrets.CONAN_TOKEN }}
6+
on:
7+
pull_request:
8+
paths:
9+
- 'src/libxrpl/protocol/BuildInfo.cpp'
10+
- '.github/workflows/libxrpl.yml'
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
publish:
17+
name: Publish libXRPL
18+
outputs:
19+
outcome: ${{ steps.upload.outputs.outcome }}
20+
version: ${{ steps.version.outputs.version }}
21+
channel: ${{ steps.channel.outputs.channel }}
22+
runs-on: [self-hosted, heavy]
23+
container: rippleci/rippled-build-ubuntu:aaf5e3e
24+
steps:
25+
- name: Wait for essential checks to succeed
26+
uses: lewagon/[email protected]
27+
with:
28+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
29+
running-workflow-name: wait-for-check-regexp
30+
check-regexp: '(dependencies|test).*linux.*' # Ignore windows and mac tests but make sure linux passes
31+
repo-token: ${{ secrets.GITHUB_TOKEN }}
32+
wait-interval: 10
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
- name: Generate channel
36+
id: channel
37+
shell: bash
38+
run: |
39+
echo channel="clio/pr_${{ github.event.pull_request.number }}" | tee ${GITHUB_OUTPUT}
40+
- name: Export new package
41+
shell: bash
42+
run: |
43+
conan export . ${{ steps.channel.outputs.channel }}
44+
- name: Add Ripple Conan remote
45+
shell: bash
46+
run: |
47+
conan remote list
48+
conan remote remove ripple || true
49+
# Do not quote the URL. An empty string will be accepted (with a non-fatal warning), but a missing argument will not.
50+
conan remote add ripple ${{ env.CONAN_URL }} --insert 0
51+
- name: Parse new version
52+
id: version
53+
shell: bash
54+
run: |
55+
echo version="$(cat src/libxrpl/protocol/BuildInfo.cpp | grep "versionString =" \
56+
| awk -F '"' '{print $2}')" | tee ${GITHUB_OUTPUT}
57+
- name: Try to authenticate to Ripple Conan remote
58+
id: remote
59+
shell: bash
60+
run: |
61+
# `conan user` implicitly uses the environment variables CONAN_LOGIN_USERNAME_<REMOTE> and CONAN_PASSWORD_<REMOTE>.
62+
# https://docs.conan.io/1/reference/commands/misc/user.html#using-environment-variables
63+
# https://docs.conan.io/1/reference/env_vars.html#conan-login-username-conan-login-username-remote-name
64+
# https://docs.conan.io/1/reference/env_vars.html#conan-password-conan-password-remote-name
65+
echo outcome=$(conan user --remote ripple --password >&2 \
66+
&& echo success || echo failure) | tee ${GITHUB_OUTPUT}
67+
- name: Upload new package
68+
id: upload
69+
if: (steps.remote.outputs.outcome == 'success')
70+
shell: bash
71+
run: |
72+
echo "conan upload version ${{ steps.version.outputs.version }} on channel ${{ steps.channel.outputs.channel }}"
73+
echo outcome=$(conan upload xrpl/${{ steps.version.outputs.version }}@${{ steps.channel.outputs.channel }} --remote ripple --confirm >&2 \
74+
&& echo success || echo failure) | tee ${GITHUB_OUTPUT}
75+
notify_clio:
76+
name: Notify Clio
77+
runs-on: ubuntu-latest
78+
needs: publish
79+
env:
80+
GH_TOKEN: ${{ secrets.CLIO_NOTIFY_TOKEN }}
81+
steps:
82+
- name: Notify Clio about new version
83+
if: (needs.publish.outputs.outcome == 'success')
84+
shell: bash
85+
run: |
86+
gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" \
87+
/repos/xrplf/clio/dispatches -f "event_type=check_libxrpl" \
88+
-F "client_payload[version]=${{ needs.publish.outputs.version }}@${{ needs.publish.outputs.channel }}"

0 commit comments

Comments
 (0)