Skip to content

Commit 9ebeb41

Browse files
authored
feat: Implement separate upload workflow (#5762)
* feat: Implement separate upload workflow * Use cleanup-workspace * Name some workflows reusable * Add dependencies
1 parent 6d40b88 commit 9ebeb41

File tree

11 files changed

+243
-153
lines changed

11 files changed

+243
-153
lines changed
Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
# This action installs and optionally uploads Conan dependencies to a remote
2-
# repository. The dependencies will only be uploaded if the credentials are
3-
# provided.
41
name: Build Conan dependencies
2+
description: "Install Conan dependencies, optionally forcing a rebuild of all dependencies."
53

64
# Note that actions do not support 'type' and all inputs are strings, see
75
# https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax#inputs.
@@ -12,28 +10,10 @@ inputs:
1210
build_type:
1311
description: 'The build type to use ("Debug", "Release").'
1412
required: true
15-
conan_remote_name:
16-
description: "The name of the Conan remote to use."
17-
required: true
18-
conan_remote_url:
19-
description: "The URL of the Conan endpoint to use."
20-
required: true
21-
conan_remote_username:
22-
description: "The username for logging into the Conan remote. If not provided, the dependencies will not be uploaded."
23-
required: false
24-
default: ""
25-
conan_remote_password:
26-
description: "The password for logging into the Conan remote. If not provided, the dependencies will not be uploaded."
27-
required: false
28-
default: ""
2913
force_build:
3014
description: 'Force building of all dependencies ("true", "false").'
3115
required: false
3216
default: "false"
33-
force_upload:
34-
description: 'Force uploading of all dependencies ("true", "false").'
35-
required: false
36-
default: "false"
3717

3818
runs:
3919
using: composite
@@ -51,12 +31,3 @@ runs:
5131
--options:host '&:xrpld=True' \
5232
--settings:all build_type=${{ inputs.build_type }} \
5333
--format=json ..
54-
- name: Upload Conan dependencies
55-
if: ${{ inputs.conan_remote_username != '' && inputs.conan_remote_password != '' }}
56-
shell: bash
57-
working-directory: ${{ inputs.build_dir }}
58-
run: |
59-
echo "Logging into Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}."
60-
conan remote login ${{ inputs.conan_remote_name }} "${{ inputs.conan_remote_username }}" --password "${{ inputs.conan_remote_password }}"
61-
echo 'Uploading dependencies.'
62-
conan upload '*' --confirm --check ${{ inputs.force_upload == 'true' && '--force' || '' }} --remote=${{ inputs.conan_remote_name }}

.github/actions/build-test/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This action build and tests the binary. The Conan dependencies must have
22
# already been installed (see the build-deps action).
33
name: Build and Test
4+
description: "Build and test the binary."
45

56
# Note that actions do not support 'type' and all inputs are strings, see
67
# https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax#inputs.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Setup Conan
2+
description: "Set up Conan configuration, profile, and remote."
3+
4+
inputs:
5+
conan_remote_name:
6+
description: "The name of the Conan remote to use."
7+
required: false
8+
default: xrplf
9+
conan_remote_url:
10+
description: "The URL of the Conan endpoint to use."
11+
required: false
12+
default: https://conan.ripplex.io
13+
14+
runs:
15+
using: composite
16+
17+
steps:
18+
- name: Set up Conan configuration
19+
shell: bash
20+
run: |
21+
echo 'Installing configuration.'
22+
cat conan/global.conf ${{ runner.os == 'Linux' && '>>' || '>' }} $(conan config home)/global.conf
23+
24+
echo 'Conan configuration:'
25+
conan config show '*'
26+
27+
- name: Set up Conan profile
28+
shell: bash
29+
run: |
30+
echo 'Installing profile.'
31+
conan config install conan/profiles/default -tf $(conan config home)/profiles/
32+
33+
echo 'Conan profile:'
34+
conan profile show
35+
36+
- name: Set up Conan remote
37+
shell: bash
38+
run: |
39+
echo "Adding Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}."
40+
conan remote add --index 0 --force ${{ inputs.conan_remote_name }} ${{ inputs.conan_remote_url }}
41+
42+
echo 'Listing Conan remotes.'
43+
conan remote list

.github/scripts/strategy-matrix/generate.py

100644100755
File mode changed.

.github/workflows/build-test.yml

Lines changed: 7 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ on:
1313
required: false
1414
type: string
1515
default: ".build"
16-
conan_remote_name:
17-
description: "The name of the Conan remote to use."
18-
required: true
19-
type: string
20-
conan_remote_url:
21-
description: "The URL of the Conan endpoint to use."
22-
required: true
23-
type: string
2416
dependencies_force_build:
2517
description: "Force building of all dependencies."
2618
required: false
@@ -45,12 +37,6 @@ on:
4537
codecov_token:
4638
description: "The Codecov token to use for uploading coverage reports."
4739
required: false
48-
conan_remote_username:
49-
description: "The username for logging into the Conan remote. If not provided, the dependencies will not be uploaded."
50-
required: false
51-
conan_remote_password:
52-
description: "The password for logging into the Conan remote. If not provided, the dependencies will not be uploaded."
53-
required: false
5440

5541
concurrency:
5642
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.os }}
@@ -63,20 +49,10 @@ defaults:
6349
jobs:
6450
# Generate the strategy matrix to be used by the following job.
6551
generate-matrix:
66-
runs-on: ubuntu-latest
67-
steps:
68-
- name: Checkout repository
69-
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
70-
- name: Set up Python
71-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
72-
with:
73-
python-version: 3.13
74-
- name: Generate strategy matrix
75-
working-directory: .github/scripts/strategy-matrix
76-
id: generate
77-
run: python generate.py ${{ inputs.strategy_matrix == 'all' && '--all' || '' }} --config=${{ inputs.os }}.json >> "${GITHUB_OUTPUT}"
78-
outputs:
79-
matrix: ${{ steps.generate.outputs.matrix }}
52+
uses: ./.github/workflows/reusable-strategy-matrix.yml
53+
with:
54+
os: ${{ inputs.os }}
55+
strategy_matrix: ${{ inputs.strategy_matrix }}
8056

8157
# Build and test the binary.
8258
build-test:
@@ -148,40 +124,16 @@ jobs:
148124
echo 'Checking nproc version.'
149125
nproc --version
150126
151-
- name: Set up Conan configuration
152-
run: |
153-
echo 'Installing configuration.'
154-
cat conan/global.conf ${{ inputs.os == 'linux' && '>>' || '>' }} $(conan config home)/global.conf
155-
156-
echo 'Conan configuration:'
157-
conan config show '*'
158-
- name: Set up Conan profile
159-
run: |
160-
echo 'Installing profile.'
161-
conan config install conan/profiles/default -tf $(conan config home)/profiles/
162-
163-
echo 'Conan profile:'
164-
conan profile show
165-
- name: Set up Conan remote
166-
shell: bash
167-
run: |
168-
echo "Adding Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}."
169-
conan remote add --index 0 --force ${{ inputs.conan_remote_name }} ${{ inputs.conan_remote_url }}
170-
171-
echo 'Listing Conan remotes.'
172-
conan remote list
127+
- name: Setup Conan
128+
uses: ./.github/actions/setup-conan
173129

174130
- name: Build dependencies
175131
uses: ./.github/actions/build-deps
176132
with:
177133
build_dir: ${{ inputs.build_dir }}
178134
build_type: ${{ matrix.build_type }}
179-
conan_remote_name: ${{ inputs.conan_remote_name }}
180-
conan_remote_url: ${{ inputs.conan_remote_url }}
181-
conan_remote_username: ${{ secrets.conan_remote_username }}
182-
conan_remote_password: ${{ secrets.conan_remote_password }}
183135
force_build: ${{ inputs.dependencies_force_build }}
184-
force_upload: ${{ inputs.dependencies_force_upload }}
136+
185137
- name: Build and test binary
186138
uses: ./.github/actions/build-test
187139
with:

.github/workflows/notify-clio.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ on:
99
inputs:
1010
conan_remote_name:
1111
description: "The name of the Conan remote to use."
12-
required: true
12+
required: false
1313
type: string
14+
default: xrplf
1415
conan_remote_url:
1516
description: "The URL of the Conan endpoint to use."
16-
required: true
17+
required: false
1718
type: string
19+
default: https://conan.ripplex.io
1820
secrets:
1921
clio_notify_token:
2022
description: "The GitHub token to notify Clio about new versions."
@@ -54,12 +56,13 @@ jobs:
5456
id: conan_ref
5557
run: |
5658
echo "conan_ref=${{ steps.generate.outputs.version }}@${{ steps.generate.outputs.user }}/${{ steps.generate.outputs.channel }}" >> "${GITHUB_OUTPUT}"
57-
- name: Add Conan remote
58-
run: |
59-
echo "Adding Conan remote '${{ inputs.conan_remote_name }}' at ${{ inputs.conan_remote_url }}."
60-
conan remote add --index 0 --force ${{ inputs.conan_remote_name }} ${{ inputs.conan_remote_url }}
61-
echo 'Listing Conan remotes.'
62-
conan remote list
59+
60+
- name: Set up Conan
61+
uses: ./.github/actions/setup-conan
62+
with:
63+
conan_remote_name: ${{ inputs.conan_remote_name }}
64+
conan_remote_url: ${{ inputs.conan_remote_url }}
65+
6366
- name: Log into Conan remote
6467
run: conan remote login ${{ inputs.conan_remote_name }} "${{ secrets.conan_remote_username }}" --password "${{ secrets.conan_remote_password }}"
6568
- name: Upload package

.github/workflows/on-pr.yml

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ defaults:
2323
run:
2424
shell: bash
2525

26-
env:
27-
CONAN_REMOTE_NAME: xrplf
28-
CONAN_REMOTE_URL: https://conan.ripplex.io
29-
3026
jobs:
3127
# This job determines whether the rest of the workflow should run. It runs
3228
# when the PR is not a draft (which should also cover merge-group) or
@@ -105,40 +101,22 @@ jobs:
105101
if: needs.should-run.outputs.go == 'true'
106102
uses: ./.github/workflows/check-levelization.yml
107103

108-
# This job works around the limitation that GitHub Actions does not support
109-
# using environment variables as inputs for reusable workflows.
110-
generate-outputs:
111-
needs: should-run
112-
if: needs.should-run.outputs.go == 'true'
113-
runs-on: ubuntu-latest
114-
steps:
115-
- name: No-op
116-
run: true
117-
outputs:
118-
conan_remote_name: ${{ env.CONAN_REMOTE_NAME }}
119-
conan_remote_url: ${{ env.CONAN_REMOTE_URL }}
120-
121104
build-test:
122-
needs: generate-outputs
105+
needs: should-run
123106
uses: ./.github/workflows/build-test.yml
124107
strategy:
125108
matrix:
126109
os: [linux, macos, windows]
127110
with:
128-
conan_remote_name: ${{ needs.generate-outputs.outputs.conan_remote_name }}
129-
conan_remote_url: ${{ needs.generate-outputs.outputs.conan_remote_url }}
130111
os: ${{ matrix.os }}
131112
secrets:
132113
codecov_token: ${{ secrets.CODECOV_TOKEN }}
133114

134115
notify-clio:
135116
needs:
136-
- generate-outputs
117+
- should-run
137118
- build-test
138119
uses: ./.github/workflows/notify-clio.yml
139-
with:
140-
conan_remote_name: ${{ needs.generate-outputs.outputs.conan_remote_name }}
141-
conan_remote_url: ${{ needs.generate-outputs.outputs.conan_remote_url }}
142120
secrets:
143121
clio_notify_token: ${{ secrets.CLIO_NOTIFY_TOKEN }}
144122
conan_remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}

.github/workflows/on-trigger.yml

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -66,54 +66,18 @@ defaults:
6666
run:
6767
shell: bash
6868

69-
env:
70-
CONAN_REMOTE_NAME: xrplf
71-
CONAN_REMOTE_URL: https://conan.ripplex.io
72-
7369
jobs:
7470
check-missing-commits:
7571
if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && contains(fromJSON('["develop", "release"]'), github.ref_name) }}
7672
uses: ./.github/workflows/check-missing-commits.yml
7773

78-
# This job works around the limitation that GitHub Actions does not support
79-
# using environment variables as inputs for reusable workflows. It also sets
80-
# outputs that depend on the event that triggered the workflow.
81-
generate-outputs:
82-
runs-on: ubuntu-latest
83-
steps:
84-
- name: Check inputs and set outputs
85-
id: generate
86-
run: |
87-
if [[ '${{ github.event_name }}' == 'push' ]]; then
88-
echo 'dependencies_force_build=false' >> "${GITHUB_OUTPUT}"
89-
echo 'dependencies_force_upload=false' >> "${GITHUB_OUTPUT}"
90-
elif [[ '${{ github.event_name }}' == 'schedule' ]]; then
91-
echo 'dependencies_force_build=true' >> "${GITHUB_OUTPUT}"
92-
echo 'dependencies_force_upload=false' >> "${GITHUB_OUTPUT}"
93-
else
94-
echo 'dependencies_force_build=${{ inputs.dependencies_force_build }}' >> "${GITHUB_OUTPUT}"
95-
echo 'dependencies_force_upload=${{ inputs.dependencies_force_upload }}' >> "${GITHUB_OUTPUT}"
96-
fi
97-
outputs:
98-
conan_remote_name: ${{ env.CONAN_REMOTE_NAME }}
99-
conan_remote_url: ${{ env.CONAN_REMOTE_URL }}
100-
dependencies_force_build: ${{ steps.generate.outputs.dependencies_force_build }}
101-
dependencies_force_upload: ${{ steps.generate.outputs.dependencies_force_upload }}
102-
10374
build-test:
104-
needs: generate-outputs
10575
uses: ./.github/workflows/build-test.yml
10676
strategy:
10777
matrix:
10878
os: [linux, macos, windows]
10979
with:
110-
conan_remote_name: ${{ needs.generate-outputs.outputs.conan_remote_name }}
111-
conan_remote_url: ${{ needs.generate-outputs.outputs.conan_remote_url }}
112-
dependencies_force_build: ${{ needs.generate-outputs.outputs.dependencies_force_build == 'true' }}
113-
dependencies_force_upload: ${{ needs.generate-outputs.outputs.dependencies_force_upload == 'true' }}
11480
os: ${{ matrix.os }}
11581
strategy_matrix: "minimal"
11682
secrets:
11783
codecov_token: ${{ secrets.CODECOV_TOKEN }}
118-
conan_remote_username: ${{ secrets.CONAN_REMOTE_USERNAME }}
119-
conan_remote_password: ${{ secrets.CONAN_REMOTE_PASSWORD }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Generate strategy matrix
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
os:
7+
description: 'The operating system to use for the build ("linux", "macos", "windows").'
8+
required: true
9+
type: string
10+
strategy_matrix:
11+
# TODO: Support additional strategies, e.g. "ubuntu" for generating all Ubuntu configurations.
12+
description: 'The strategy matrix to use for generating the configurations ("minimal", "all").'
13+
required: false
14+
type: string
15+
default: "minimal"
16+
outputs:
17+
matrix:
18+
description: "The generated strategy matrix."
19+
value: ${{ jobs.generate-matrix.outputs.matrix }}
20+
21+
jobs:
22+
generate-matrix:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
matrix: ${{ steps.generate.outputs.matrix }}
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
29+
30+
- name: Set up Python
31+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
32+
with:
33+
python-version: 3.13
34+
35+
- name: Generate strategy matrix
36+
working-directory: .github/scripts/strategy-matrix
37+
id: generate
38+
run: ./generate.py ${{ inputs.strategy_matrix == 'all' && '--all' || '' }} --config=${{ inputs.os }}.json >> "${GITHUB_OUTPUT}"

0 commit comments

Comments
 (0)