Compare commits

..

9 Commits

Author SHA1 Message Date
Bart
08e9f439ff Fix comment 2026-01-16 15:38:30 -05:00
Bart
c6dc700673 Merge branch 'develop' into bthomee/upload 2026-01-16 15:05:10 -05:00
Bart
72f0a30dfe Can't use secrets in if-statement 2026-01-16 14:04:54 -05:00
Bart
9ac4e95ec2 Can't use secrets in if-statement 2026-01-16 14:03:50 -05:00
Bart
7b1c83e6e1 Merge branch 'develop' into bthomee/upload 2026-01-16 13:58:07 -05:00
Bart
a43c4ce441 Shorten commit hash 2026-01-16 13:57:30 -05:00
Bart
aae623eb67 ci: Upload Conan recipe for merges into develop and commits to release 2026-01-16 13:45:07 -05:00
Bart
857a4eea9a Add shell: bash to each composite action step 2026-01-15 14:23:30 -05:00
Bart
24177fdca0 ci: Move Conan package versioning and uploading into action 2026-01-15 14:19:34 -05:00
5 changed files with 121 additions and 38 deletions

View File

@@ -0,0 +1,32 @@
name: Generate build version number
description: "Generate build version number."
outputs:
version:
description: "The generated build version number."
value: ${{ steps.version.outputs.version }}
runs:
using: composite
steps:
- name: Generate version
id: version
shell: bash
env:
# Only append the commit hash for the develop branch. For releases the
# version is used as-is. We will shorten it to 6 characters below.
COMMIT_HASH: ${{ github.ref == 'refs/heads/develop' && github.sha || '' }}
run: |
echo 'Extracting version from BuildInfo.cpp.'
VERSION="$(cat src/libxrpl/protocol/BuildInfo.cpp | grep "versionString =" | awk -F '"' '{print $2}')"
if [[ -z "${VERSION}" ]]; then
echo 'Unable to extract version from BuildInfo.cpp.'
exit 1
fi
if [[ -n "${COMMIT_HASH}" ]]; then
echo 'Appending shortened commit hash to version.'
VERSION="${VERSION}-${COMMIT_HASH:0:6}"
fi
echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"

View File

@@ -0,0 +1,46 @@
name: Upload Conan recipe
description: "Upload recipe to a Conan remote."
inputs:
conan_recipe_ref:
description: "The Conan recipe reference ('name/version') to upload."
required: true
conan_remote_name:
description: "The name of the Conan remote to use."
required: true
conan_remote_url:
description: "The URL of the Conan endpoint to use."
required: true
conan_remote_username:
description: "The username for logging into the Conan remote."
required: true
conan_remote_password:
description: "The password for logging into the Conan remote."
required: true
runs:
using: composite
steps:
- name: Set up Conan
uses: ./.github/actions/setup-conan
with:
conan_remote_name: ${{ inputs.conan_remote_name }}
conan_remote_url: ${{ inputs.conan_remote_url }}
- name: Log into Conan remote
shell: bash
env:
CONAN_REMOTE_NAME: ${{ inputs.conan_remote_name }}
CONAN_REMOTE_USERNAME: ${{ inputs.conan_remote_username }}
CONAN_REMOTE_PASSWORD: ${{ inputs.conan_remote_password }}
run: conan remote login "${CONAN_REMOTE_NAME}" "${CONAN_REMOTE_USERNAME}" --password "${CONAN_REMOTE_PASSWORD}"
- name: Upload Conan recipe
shell: bash
env:
CONAN_RECIPE_REF: ${{ inputs.conan_recipe_ref }}
CONAN_REMOTE_NAME: ${{ inputs.conan_remote_name }}
run: |
conan export .
conan upload --confirm --check --remote="${CONAN_REMOTE_NAME}" ${CONAN_RECIPE_REF}

View File

@@ -53,7 +53,6 @@ jobs:
.github/scripts/rename/** .github/scripts/rename/**
.github/workflows/reusable-check-levelization.yml .github/workflows/reusable-check-levelization.yml
.github/workflows/reusable-check-rename.yml .github/workflows/reusable-check-rename.yml
.github/workflows/reusable-notify-clio.yml
.github/workflows/on-pr.yml .github/workflows/on-pr.yml
# Keep the paths below in sync with those in `on-trigger.yml`. # Keep the paths below in sync with those in `on-trigger.yml`.
@@ -66,6 +65,7 @@ jobs:
.github/workflows/reusable-build-test.yml .github/workflows/reusable-build-test.yml
.github/workflows/reusable-strategy-matrix.yml .github/workflows/reusable-strategy-matrix.yml
.github/workflows/reusable-test.yml .github/workflows/reusable-test.yml
.github/workflows/reusable-upload-recipe.yml
.codecov.yml .codecov.yml
cmake/** cmake/**
conan/** conan/**
@@ -121,12 +121,15 @@ jobs:
secrets: secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
notify-clio: upload-recipe:
needs: needs:
- should-run - should-run
- build-test - build-test
if: ${{ needs.should-run.outputs.go == 'true' && startsWith(github.ref, 'refs/heads/release') }} # Only run when committing to the release branch in the XRPLF repository. We
uses: ./.github/workflows/reusable-notify-clio.yml # also upload the recipe when merging into the develop branch, but that is
# handled in the on-trigger.yml workflow.
if: ${{ github.repository_owner == 'XRPLF' && needs.should-run.outputs.go == 'true' && startsWith(github.ref, 'refs/heads/release') }}
uses: ./.github/workflows/reusable-upload-recipe.yml
secrets: secrets:
clio_notify_token: ${{ secrets.CLIO_NOTIFY_TOKEN }} clio_notify_token: ${{ secrets.CLIO_NOTIFY_TOKEN }}
conan_remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }} conan_remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
@@ -137,6 +140,7 @@ jobs:
needs: needs:
- build-test - build-test
- check-levelization - check-levelization
- upload-recipe
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Fail - name: Fail

View File

@@ -24,6 +24,7 @@ on:
- ".github/workflows/reusable-build-test.yml" - ".github/workflows/reusable-build-test.yml"
- ".github/workflows/reusable-strategy-matrix.yml" - ".github/workflows/reusable-strategy-matrix.yml"
- ".github/workflows/reusable-test.yml" - ".github/workflows/reusable-test.yml"
- ".github/workflows/reusable-upload-recipe.yml"
- ".codecov.yml" - ".codecov.yml"
- "cmake/**" - "cmake/**"
- "conan/**" - "conan/**"
@@ -76,3 +77,14 @@ jobs:
strategy_matrix: ${{ github.event_name == 'schedule' && 'all' || 'minimal' }} strategy_matrix: ${{ github.event_name == 'schedule' && 'all' || 'minimal' }}
secrets: secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
upload-recipe:
needs: build-test
# Only run when pushing to the develop branch in the XRPLF repository. We
# also upload the recipe when committing to a release branch, but that is
# handled in the on-pr.yml workflow.
if: ${{ github.repository_owner == 'XRPLF' && github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
uses: ./.github/workflows/reusable-upload-recipe.yml
secrets:
conan_remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
conan_remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}

View File

@@ -1,7 +1,7 @@
# This workflow exports the built libxrpl package to the Conan remote on a # This workflow exports the built libxrpl package to the Conan remote, and for
# a channel named after the pull request, and notifies the Clio repository about # releases also notifies the Clio repository about the new version, so it can
# the new version so it can check for compatibility. # check for compatibility.
name: Notify Clio name: Upload Conan recipe
# This workflow can only be triggered by other workflows. # This workflow can only be triggered by other workflows.
on: on:
@@ -20,7 +20,7 @@ on:
secrets: secrets:
clio_notify_token: clio_notify_token:
description: "The GitHub token to notify Clio about new versions." description: "The GitHub token to notify Clio about new versions."
required: true required: false
conan_remote_username: conan_remote_username:
description: "The username for logging into the Conan remote." description: "The username for logging into the Conan remote."
required: true required: true
@@ -29,7 +29,7 @@ on:
required: true required: true
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-clio group: ${{ github.workflow }}-${{ github.ref }}-upload-recipe
cancel-in-progress: true cancel-in-progress: true
defaults: defaults:
@@ -38,46 +38,35 @@ defaults:
jobs: jobs:
upload: upload:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: ghcr.io/xrplf/ci/ubuntu-noble:gcc-13-sha-5dd7158 container: ghcr.io/xrplf/ci/ubuntu-noble:gcc-13-sha-5dd7158
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Generate outputs
id: generate - name: Generate build version number
env: id: version
PR_NUMBER: ${{ github.event.pull_request.number }} uses: ./.github/actions/generate-version
run: |
echo 'Generating user and channel.' - name: Determine recipe reference
echo "user=clio" >> "${GITHUB_OUTPUT}" id: ref
echo "channel=pr_${PR_NUMBER}" >> "${GITHUB_OUTPUT}" run: echo "ref=xrpl/${{ steps.version.outputs.version }}" >> "${GITHUB_OUTPUT}"
echo 'Extracting version.'
echo "version=$(cat src/libxrpl/protocol/BuildInfo.cpp | grep "versionString =" | awk -F '"' '{print $2}')" >> "${GITHUB_OUTPUT}" - name: Upload recipe
- name: Calculate conan reference uses: ./.github/actions/upload-recipe
id: conan_ref id: upload
run: |
echo "conan_ref=${{ steps.generate.outputs.version }}@${{ steps.generate.outputs.user }}/${{ steps.generate.outputs.channel }}" >> "${GITHUB_OUTPUT}"
- name: Set up Conan
uses: ./.github/actions/setup-conan
with: with:
conan_recipe_ref: ${{ steps.version.outputs.version }}
conan_remote_name: ${{ inputs.conan_remote_name }} conan_remote_name: ${{ inputs.conan_remote_name }}
conan_remote_url: ${{ inputs.conan_remote_url }} conan_remote_url: ${{ inputs.conan_remote_url }}
- name: Log into Conan remote conan_remote_username: ${{ secrets.conan_remote_username }}
env: conan_remote_password: ${{ secrets.conan_remote_password }}
CONAN_REMOTE_NAME: ${{ inputs.conan_remote_name }}
run: conan remote login "${CONAN_REMOTE_NAME}" "${{ secrets.conan_remote_username }}" --password "${{ secrets.conan_remote_password }}"
- name: Upload package
env:
CONAN_REMOTE_NAME: ${{ inputs.conan_remote_name }}
run: |
conan export --user=${{ steps.generate.outputs.user }} --channel=${{ steps.generate.outputs.channel }} .
conan upload --confirm --check --remote="${CONAN_REMOTE_NAME}" xrpl/${{ steps.conan_ref.outputs.conan_ref }}
outputs: outputs:
conan_ref: ${{ steps.conan_ref.outputs.conan_ref }} conan_ref: ${{ steps.ref.outputs.ref }}
notify: notify:
needs: upload needs: upload
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Notify Clio - name: Notify Clio