-
Notifications
You must be signed in to change notification settings - Fork 30
140 lines (133 loc) · 4.64 KB
/
build.yaml
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
131
132
133
134
135
136
137
138
139
140
name: "Build & Test"
on:
push:
branches:
- main
- "release/*"
pull_request:
workflow_dispatch:
inputs:
override-leap-dev:
description: Override leap-dev target
type: string
override-leap-dev-prerelease:
type: choice
description: Override leap-dev prelease
options:
- default
- true
- false
permissions:
packages: write
contents: read
defaults:
run:
shell: bash
jobs:
d:
name: Discover Platforms
runs-on: ubuntu-latest
outputs:
missing-platforms: ${{steps.discover.outputs.missing-platforms}}
p: ${{steps.discover.outputs.platforms}}
steps:
- name: Discover Platforms
id: discover
uses: AntelopeIO/discover-platforms-action@v1
with:
platform-file: .cicd/platforms.json
password: ${{secrets.GITHUB_TOKEN}}
package-name: builders
build-platforms:
name: Build Platforms
needs: d
if: needs.d.outputs.missing-platforms != '[]'
strategy:
fail-fast: false
matrix:
platform: ${{fromJSON(needs.d.outputs.missing-platforms)}}
runs-on: ["self-hosted", "enf-x86-beefy"]
steps:
- name: Login to Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{github.repository_owner}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
file: ${{fromJSON(needs.d.outputs.p)[matrix.platform].dockerfile}}
versions:
name: Determine Versions
runs-on: ubuntu-latest
outputs:
leap-dev-target: ${{steps.versions.outputs.leap-dev-target}}
leap-dev-prerelease: ${{steps.versions.outputs.leap-dev-prerelease}}
steps:
- name: Setup versions from input or defaults
id: versions
env:
GH_TOKEN: ${{github.token}}
run: |
DEFAULTS_JSON=$(curl -sSfL $(gh api https://api.github.com/repos/${{github.repository}}/contents/.cicd/defaults.json?ref=${{github.sha}} --jq .download_url))
echo leap-dev-target=$(echo "$DEFAULTS_JSON" | jq -r '."leap-dev".target') >> $GITHUB_OUTPUT
echo leap-dev-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."leap-dev".prerelease') >> $GITHUB_OUTPUT
if [[ "${{inputs.override-leap-dev}}" != "" ]]; then
echo leap-dev-target=${{inputs.override-leap-dev}} >> $GITHUB_OUTPUT
fi
if [[ "${{inputs.override-leap-dev-prerelease}}" == +(true|false) ]]; then
echo leap-dev-prerelease=${{inputs.override-leap-dev-prerelease}} >> $GITHUB_OUTPUT
fi
Build:
name: Build & Test
needs: [d, build-platforms, versions]
if: always() && needs.d.result == 'success' && (needs.build-platforms.result == 'success' || needs.build-platforms.result == 'skipped')
strategy:
fail-fast: false
matrix:
platform: [ubuntu20, ubuntu22, ubuntu22-llvm]
runs-on: ["self-hosted", "enf-x86-beefy"]
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Download leap-dev.deb (Ubuntu 20 only)
if: matrix.platform == 'ubuntu20'
uses: AntelopeIO/asset-artifact-download-action@v3
with:
owner: AntelopeIO
repo: leap
file: 'leap-dev.*(x86_64|amd64).deb'
target: '${{needs.versions.outputs.leap-dev-target}}'
prereleases: ${{fromJSON(needs.versions.outputs.leap-dev-prerelease)}}
artifact-name: leap-dev-ubuntu20-amd64
container-package: experimental-binaries
- name: Install leap-dev.deb (Ubuntu 20 only)
if: matrix.platform == 'ubuntu20'
run: |
apt-get update && apt-get upgrade -y
apt install -y ./leap-dev*.deb
rm ./leap-dev*.deb
- name: Build & Test
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j $(nproc)
cd tests
ctest -j $(nproc) --output-on-failure
- name: Package (Ubuntu 20 only)
if: matrix.platform == 'ubuntu20'
run: |
cd build/packages
bash generate_package.sh deb ubuntu amd64
- name: Upload (Ubuntu 20 only)
if: matrix.platform == 'ubuntu20'
uses: actions/upload-artifact@v3
with:
name: cdt_ubuntu_package_amd64
path: build/packages/cdt*amd64.deb