Skip to content

Commit 774f8d6

Browse files
committed
🚀 CI v6
1 parent 989b5e5 commit 774f8d6

8 files changed

Lines changed: 691 additions & 150 deletions

File tree

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Copyright 2024 - 2025 Khalil Estell and the libhal contributors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: 📦 Conan Package & Upload
16+
17+
on:
18+
workflow_call:
19+
inputs:
20+
library:
21+
type: string
22+
default: ${{ github.event.repository.name }}
23+
repo:
24+
type: string
25+
default: ${{ github.repository }}
26+
conan_version:
27+
type: string
28+
default: "2.18.0"
29+
version:
30+
type: string
31+
default: "latest" # "latest" means (do not upload)
32+
runner_os:
33+
type: string
34+
required: true
35+
arch:
36+
type: string
37+
required: true
38+
os:
39+
type: string
40+
required: true
41+
compiler_profile: # can be "arm-gcc" or "llvm"
42+
type: string
43+
required: true
44+
dir: # Directory where the conan package exists
45+
type: string
46+
default: "."
47+
remote_url: # Path to conan package repo
48+
type: string
49+
default: ""
50+
51+
secrets:
52+
conan_remote_user:
53+
required: false
54+
conan_remote_password:
55+
required: false
56+
jobs:
57+
📦 Conan Package & Upload:
58+
runs-on: ${{ inputs.runner_os }}
59+
env:
60+
VERBOSE: 1
61+
CONAN_REMOTE_USER: ${{ secrets.conan_remote_user }}
62+
CONAN_REMOTE_PASSWORD: ${{ secrets.conan_remote_password }}
63+
steps:
64+
- uses: actions/checkout@v4.1.1
65+
if: ${{ inputs.version != 'latest' }}
66+
with:
67+
submodules: true
68+
repository: ${{ inputs.repo }}
69+
ref: ${{ inputs.version }}
70+
71+
- uses: actions/checkout@v4.1.1
72+
if: ${{ inputs.version == 'latest' }}
73+
with:
74+
submodules: true
75+
repository: ${{ inputs.repo }}
76+
77+
- name: 📥 Clone CI repo for scripts
78+
uses: actions/checkout@v4.1.1
79+
with:
80+
repository: libhal/ci
81+
path: ci
82+
83+
- name: 📥 Install Conan ${{ inputs.conan_version }}
84+
run: pipx install conan==${{ inputs.conan_version }}
85+
86+
- name: 📡 Add conan libhal remote
87+
run: conan remote add libhal https://libhal.jfrog.io/artifactory/api/conan/trunk-conan
88+
89+
- name: 📡 Add conan user remote-package-repo
90+
if: ${{ inputs.remote_url != '' }}
91+
run: conan remote add --force remote-package-repo ${{ inputs.remote_url }}
92+
# We use --force to allow the remote-package-repo to also be the libhal
93+
# repo.
94+
95+
- name: 📡 Install libhal settings_user.yml
96+
run: conan config install -sf profiles/baremetal/v2 https://github.com/libhal/conan-config.git
97+
98+
- name: 📦 Create `Debug` package for ${{ inputs.profile }}
99+
run: conan create ${{ inputs.dir }} -s:h build_type=Debug -pr:h ci/${{ inputs.compiler_profile }} -s:h os=${{ inputs.os }} -s:h arch=${{ inputs.arch }} --version=${{ inputs.version }}
100+
101+
- name: 📦 Create `MinSizeRel` package for ${{ inputs.profile }}
102+
run: conan create ${{ inputs.dir }} -s:h build_type=MinSizeRel -pr:h ci/${{ inputs.compiler_profile }} -s:h os=${{ inputs.os }} -s:h arch=${{ inputs.arch }} --version=${{ inputs.version }}
103+
104+
- name: 📦 Create `Release` package for ${{ inputs.profile }}
105+
run: conan create ${{ inputs.dir }} -s:h build_type=Release -pr:h ci/${{ inputs.compiler_profile }} -s:h os=${{ inputs.os }} -s:h arch=${{ inputs.arch }} --version=${{ inputs.version }}
106+
107+
- name: 📡 Sign into Conan Package Repository
108+
if: ${{ inputs.version != 'latest' && inputs.remote_url != '' && env.CONAN_REMOTE_USER != '' && env.CONAN_REMOTE_PASSWORD != '' }}
109+
run: conan remote login -p ${{ secrets.conan_remote_password }} remote-package-repo ${{ secrets.conan_remote_user }}
110+
111+
- name: 🆙 Upload package version ${{ inputs.version }} to conan repo
112+
if: ${{ inputs.version != 'latest' && inputs.remote_url != '' }}
113+
run: conan upload "${{ inputs.library }}/${{ inputs.version }}" --confirm -r=remote-package-repo

0 commit comments

Comments
 (0)