-
Notifications
You must be signed in to change notification settings - Fork 16
135 lines (117 loc) · 4.17 KB
/
build.yml
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
name: Build
on:
push:
branches:
- main
paths-ignore:
- "**.md"
- "src/**/**.md"
- "Makefiles/**"
- "nix/**"
- "book/**"
pull_request:
branches:
- main
paths-ignore:
- "**.md"
- "book/**"
- "src/**/**.md"
- "Makefiles/**"
- "nix/**"
- "book/**"
env:
RUST_LATEST_STABLE_VERSION: 1.71
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
CARGO_FLAGS: --verbose --locked
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 15
jobs:
cancel:
name: "Cancel Previous Runs"
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
build_on_linux:
name: Build Catalyst Core on Linux
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{env.RUST_LATEST_STABLE_VERSION}}
- name: Cache rust
uses: Swatinem/rust-cache@v2
with:
shared-key: "build_cache"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install deps
run: sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config
- name: Free disk space
# https://github.com/actions/virtual-environments/issues/709
run: |
sudo apt-get clean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Build on Linux
run: cargo build --all-features ${{env.CARGO_FLAGS}}
build_on_windows:
name: Build Catalyst Core on Windows
runs-on: windows-latest
env:
CARGO_FLAGS: --verbose --locked
steps:
- name: Checkout code on PR
# Workaround for the running out of disk space issue. See https://github.com/actions/runner-images/issues/1341
run: |
mkdir C:\\${{ github.event.repository.name }}
git clone -n -v --progress https://github.com/input-output-hk/${{ github.event.repository.name }}.git C:\\${{ github.event.repository.name }}
cd C:\\${{ github.event.repository.name }}
git checkout ${{ github.event.pull_request.head.sha }}
if: ${{ github.event_name == 'pull_request' }}
- name: Checkout code on push
run: |
mkdir C:\\${{ github.event.repository.name }}
git clone -v --progress https://github.com/input-output-hk/${{ github.event.repository.name }}.git C:\\${{ github.event.repository.name }}
cd C:\\${{ github.event.repository.name }}
if: ${{ github.event_name == 'push' }}
- name: Allow long paths on Windows
working-directory: "C:\\${{ github.event.repository.name }}"
shell: powershell
run: |
reg add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f
git config --system core.longpaths true
- name: Cache rust
uses: Swatinem/rust-cache@v2
with:
workspaces: "C:\\${{ github.event.repository.name }}"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Set default linker
working-directory: "C:\\${{ github.event.repository.name }}"
run: rustup default stable-x86_64-pc-windows-msvc
- name: Install dependencies
working-directory: "C:\\${{ github.event.repository.name }}"
run: choco install -y protoc openssl sqlite postgresql14
- name: Set PostgreSQL env variables
working-directory: "C:\\${{ github.event.repository.name }}"
shell: powershell
run: |
"PQ_LIB_DIR=${env:PROGRAMFILES}\PostgreSQL\14\lib" >> $env:GITHUB_ENV
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{env.RUST_LATEST_STABLE_VERSION}}
- name: Build on Windows
working-directory: "C:\\${{ github.event.repository.name }}"
run: cargo build --all-features ${{env.CARGO_FLAGS}}