Repository navigation
130 lines (119 loc) · 5.11 KB
/
Copy pathstage.yml
File metadata and controls
130 lines (119 loc) · 5.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Build MQTT module stagings
on:
schedule:
- cron: '0 2 * * 1'
workflow_dispatch:
inputs:
opendaq-ref:
description: "openDAQ commit, branch or tag. If empty, uses the opendaq_ref file from the repo."
default: ""
jobs:
resolve:
name: Resolve the core commit
runs-on: ubuntu-latest
outputs:
opendaq-ref: ${{ steps.core.outputs.ref }}
channel: ${{ steps.channel.outputs.channel }}
jobs: ${{ steps.stagings.outputs.jobs }}
staging-pull: ${{ steps.stagings.outputs.staging-pull }}
opendaq-artifacts: ${{ steps.stagings.outputs.opendaq-artifacts }}
steps:
- uses: actions/checkout@v4
- uses: openDAQ/openDAQ-CI/.github/actions/resolve-channel@v4
id: channel
# the input, or else opendaq_ref; a branch or a tag is resolved to the commit, which is
# what the core staging is found by and what this staging records
- name: Resolve the core commit
id: core
shell: bash
env:
REF: ${{ inputs.opendaq-ref }}
run: |
ref="${REF:-$(cat opendaq_ref)}"
sha="$ref"
if ! [[ "$ref" =~ ^[0-9a-f]{40}$ ]]; then
sha=$(git ls-remote https://github.com/openDAQ/openDAQ "$ref" "$ref^{}" | sort -k2 | tail -1 | cut -f1)
fi
[ -n "$sha" ] || { echo "::error::$ref names no openDAQ commit"; exit 1; }
echo "core: $ref -> $sha"
echo "ref=$sha" >> "$GITHUB_OUTPUT"
# the jobs to build, and the openDAQ staging each of them builds against
- name: Request the openDAQ stagings
id: stagings
shell: python3 {0}
env:
CHANNEL: ${{ steps.channel.outputs.channel }}
OPENDAQ_REF: ${{ steps.core.outputs.ref }}
run: |
import json, os
# job -> the openDAQ staging it builds against, by triplet
opendaq = {
"windows-2022-x86_64-msvs-v143-release": "x86_64-windows-msvc-143-release",
"windows-2022-x86-msvs-v143-release": "x86-windows-msvc-143-release",
"manylinux_2_28-x86_64-ninja-gcc-14-release": "x86_64-manylinux_2_28-gcc-14-release",
"manylinux_2_28-armv8-ninja-gcc-14-release": "armv8-manylinux_2_28-gcc-14-release",
"ubuntu-22.04-x86_64-ninja-gcc-release": "x86_64-linux-gcc-11-release",
"ubuntu-22.04-armv8-ninja-gcc-release": "armv8-linux-gcc-11-release",
"macos-26-x86_64-ninja-appleclang-21-release": "x86_64-macos-apple-clang-21-release",
"macos-26-armv8-ninja-appleclang-21-release": "armv8-macos-apple-clang-21-release",
}
# each staging, of the resolved commit, as an artifact of its own ...
pull = [{"artifact": f"opendaq-{triplet}", "packages": [{
"path": f"ghcr.io/openDAQ/{os.environ['CHANNEL']}/staging/opendaq",
"annotations": {"org.opencontainers.image.revision": os.environ["OPENDAQ_REF"],
"com.opendaq.package.triplet": triplet}}]}
for triplet in opendaq.values()]
# ... which its job unpacks into staging-deps
artifacts = [{"match-jobs": [job], "artifacts": [{"name": f"opendaq-{triplet}", "dir": "staging-deps"}]}
for job, triplet in opendaq.items()]
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
f.write(f"jobs={json.dumps(list(opendaq))}\n")
f.write(f"staging-pull={json.dumps(pull)}\n")
f.write(f"opendaq-artifacts={json.dumps(artifacts)[1:-1]}\n") # no brackets: it goes inside packages
stage:
needs: resolve
name: MQTTModulesModule
permissions:
contents: read
packages: write
uses: openDAQ/openDAQ-CI/.github/workflows/stage.yml@v4
with:
timeout: '[{"timeout-minutes": 180}]'
include-jobs: ${{ needs.resolve.outputs.jobs }}
staging-pull: ${{ needs.resolve.outputs.staging-pull }}
packages: '[ ${{ needs.resolve.outputs.opendaq-artifacts }} ]'
cmake-presets: >-
[
{
"match-jobs": ["*"],
"configure-preset": "stage",
"cache-variables":
{
"CMAKE_PREFIX_PATH": "${sourceDir}/staging-deps;${sourceDir}/staging-deps/opt/opendaq",
"CPACK_OPENDAQ_META_FIELDS": "dependencies/opendaq/revision=${{ needs.resolve.outputs.opendaq-ref }}"
}
},
{
"match-jobs": ["macos-*-x86_64-*"],
"cache-variables": {"CMAKE_OSX_DEPLOYMENT_TARGET": "10.15"}
},
{
"match-jobs": ["macos-*-armv8-*"],
"cache-variables": {"CMAKE_OSX_DEPLOYMENT_TARGET": "11.0"}
}
]
cpack-presets: >-
[
{
"match-jobs": ["*"],
"stagings": [{"name": "mqtt"}]
}
]
staging-push: >-
[
{
"path": "ghcr.io/${{ github.repository_owner }}/${{ needs.resolve.outputs.channel }}/staging/mqtt-module",
"artifacts": ["staging-*/mqtt"],
"tags": ["latest"]
}
]