-
Notifications
You must be signed in to change notification settings - Fork 15
96 lines (93 loc) · 4.48 KB
/
job-bundle-carl.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
name: bundle-carl
on:
workflow_call: # allow this workflow to be called from other workflows
inputs:
runs-on:
default: "['ubuntu-latest']"
required: false
type: string
# https://docs.github.com/en/actions/using-workflows/reusing-workflows#using-outputs-from-a-reusable-workflow
outputs:
OPENDUT_CARL_VERSION:
description: "The version of the CARL build"
value: ${{ jobs.bundle-carl.outputs.OPENDUT_CARL_VERSION }}
jobs:
bundle-carl:
strategy:
matrix:
package:
- name: opendut-carl
target: x86_64-unknown-linux-gnu
name: "Bundle ${{ matrix.package.name }}-${{ matrix.package.target }}"
runs-on: ${{ fromJson(inputs.runs-on) }}
outputs:
OPENDUT_CARL_VERSION: ${{ steps.extract_carl_version.outputs.OPENDUT_CARL_VERSION }}
steps:
- name: Checkout Sources
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b #4.1.5
- name: Rust setup
uses: ./.github/actions/rust-setup
with:
cargo-cross: true
- name: Extract carl version
id: extract_carl_version
working-directory: ./opendut-carl
run: |
VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')
echo "OPENDUT_CARL_VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Download opendut-carl
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935
with:
name: "${{ matrix.package.name }}-${{ matrix.package.target }}-${{ github.sha }}"
path: "./target/ci/distribution/${{ matrix.package.target }}/${{ matrix.package.name }}/"
- name: Download opendut-cleo
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935
with:
pattern: "opendut-cleo-*-${{ github.sha }}.tar.gz"
path: "./target/ci/distribution/${{ matrix.package.target }}/${{ matrix.package.name }}/opendut-cleo"
- name: Move cleo tarballs and remove parent directory
run: |
TARGET_DIR="./target/ci/distribution/${{ matrix.package.target }}/${{ matrix.package.name }}/opendut-cleo"
for file in $( echo $TARGET_DIR/* ) #`find` rather than `ls` to get relative paths
do
mv $file/* $TARGET_DIR
rm -r $file
done
- name: Download opendut-edgar
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935
with:
pattern: "opendut-edgar-*-${{ github.sha }}.tar.gz"
path: "./target/ci/distribution/${{ matrix.package.target }}/${{ matrix.package.name }}/opendut-edgar"
- name: Remove SHA-1 hash from end of file name for EDGAR artifacts
run: |
TARGET_DIR="./target/ci/distribution/${{ matrix.package.target }}/${{ matrix.package.name }}/opendut-edgar"
for file in $( echo $TARGET_DIR/* ) #`find` rather than `ls` to get relative paths
do
mv $file/* $TARGET_DIR
rm -r $file
done
- name: Download opendut-lea
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935
with:
name: "opendut-lea-${{ github.sha }}"
path: "./target/ci/distribution/${{ matrix.package.target }}/${{ matrix.package.name }}/opendut-lea"
- name: Download licenses
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935
with:
name: "licenses-${{ github.sha }}"
path: "./target/ci/licenses"
- name: Prepare Licenses
run: cargo ci opendut-carl distribution-copy-license-json --skip-generate --target=${{ matrix.package.target }}
- name: Prepare Executables
run: chmod +x ./target/ci/distribution/${{ matrix.package.target }}/${{ matrix.package.name }}/${{ matrix.package.name }}
- name: Bundle
run: cargo ci opendut-carl distribution-bundle-files --target=${{ matrix.package.target }}
- name: Validate distribution contents
run: cargo ci opendut-carl distribution-validate-contents --target=${{ matrix.package.target }}
- name: "Upload CARL bundle artifact ${{ matrix.package.name }}-${{ matrix.package.target }}"
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8
with:
name: "${{ matrix.package.name }}-${{ matrix.package.target }}-${{ github.sha }}.tar.gz"
path: "./target/ci/distribution/${{ matrix.package.target }}/"
if-no-files-found: error
retention-days: 1