-
Notifications
You must be signed in to change notification settings - Fork 456
80 lines (78 loc) · 3.12 KB
/
ci-build.yml
File metadata and controls
80 lines (78 loc) · 3.12 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
name: CI Build Job
on:
workflow_call:
inputs:
script:
description: CI script to run (relative to repo root)
required: true
type: string
jobs:
build:
strategy:
fail-fast: false
matrix:
platform: >-
${{ github.event_name == 'push' && github.ref == 'refs/heads/main'
&& fromJSON('["self-hosted","windows-latest","macos-latest"]')
|| fromJSON('["self-hosted"]') }}
toolchain: >-
${{ github.event_name == 'push' && github.ref == 'refs/heads/main'
&& fromJSON('["stable","beta","1.75.0"]')
|| fromJSON('["1.75.0"]') }}
exclude:
- platform: windows-latest
toolchain: 1.75.0
- platform: windows-latest
toolchain: beta
- platform: macos-latest
toolchain: beta
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Rust ${{ matrix.toolchain }} toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
- name: Use rust-lld linker on Windows
if: matrix.platform == 'windows-latest'
shell: bash
run: echo "RUSTFLAGS=-C linker=rust-lld" >> "$GITHUB_ENV"
- name: Set RUSTFLAGS to deny warnings
if: "matrix.toolchain == '1.75.0'"
run: echo "RUSTFLAGS=-D warnings" >> "$GITHUB_ENV"
- name: Install no-std-check dependencies for ARM Embedded
if: matrix.platform == 'self-hosted'
run: |
rustup target add thumbv7m-none-eabi
- name: Enable caching for bitcoind
if: matrix.platform != 'windows-latest'
id: cache-bitcoind
uses: actions/cache@v4
with:
path: bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
key: bitcoind-${{ runner.os }}-${{ runner.arch }}
- name: Enable caching for electrs
if: matrix.platform != 'windows-latest'
id: cache-electrs
uses: actions/cache@v4
with:
path: bin/electrs-${{ runner.os }}-${{ runner.arch }}
key: electrs-${{ runner.os }}-${{ runner.arch }}
- name: Download bitcoind/electrs
if: >-
matrix.platform != 'windows-latest'
&& (steps.cache-bitcoind.outputs.cache-hit != 'true'
|| steps.cache-electrs.outputs.cache-hit != 'true')
run: |
source ./contrib/download_bitcoind_electrs.sh
mkdir bin
mv "$BITCOIND_EXE" bin/bitcoind-${{ runner.os }}-${{ runner.arch }}
mv "$ELECTRS_EXE" bin/electrs-${{ runner.os }}-${{ runner.arch }}
- name: Set bitcoind/electrs environment variables
if: matrix.platform != 'windows-latest'
run: |
echo "BITCOIND_EXE=$( pwd )/bin/bitcoind-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
echo "ELECTRS_EXE=$( pwd )/bin/electrs-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_ENV"
- name: Run CI script
shell: bash
run: CI_ENV=1 CI_MINIMIZE_DISK_USAGE=1 ./${{ inputs.script }}