-
Notifications
You must be signed in to change notification settings - Fork 13
194 lines (186 loc) · 7.19 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Formal Ledger Specs
on:
push:
branches:
- master
pull_request:
branches:
- master
permissions:
contents: write
env:
MAlonzo_branch: ${{ github.event.pull_request.head.ref }}-MAlonzo
jobs:
MAlonzo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: MAlonzo-code
- name: Create branch ${{ env.MAlonzo_branch }} for generated code
if: github.event_name == 'pull_request' && github.event.action == 'opened'
run: |
git checkout -b ${{ env.MAlonzo_branch }} origin/MAlonzo-code
git push origin ${{ env.MAlonzo_branch }}
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://cache.iog.io https://cache.nixos.org/
- name: Commit generated code at ${{ env.MAlonzo_branch }}
if: github.ref != 'refs/heads/master'
run: |
nix-build -A ledger.hsSrc -j1 -o outputs/MAlonzo
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git stash push
git fetch origin ${{ env.MAlonzo_branch }} --unshallow
git checkout ${{ env.MAlonzo_branch }}
rsync -r --exclude={'**/nix-support','**/lib'} outputs/MAlonzo/haskell/Ledger/* generated/
git add -f generated && git commit -m "Generate code for ${{ github.sha }}" || echo "Everything is up-to-date."
- name: Push ${{ env.MAlonzo_branch }}
if: github.ref != 'refs/heads/master'
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ env.MAlonzo_branch }}
force: false
directory: .
Formal-Ledger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://cache.iog.io https://cache.nixos.org/
- name: Build formalLedger
id: formalLedger
run: |
nix-build -A formalLedger -j1 -o outputs/formalLedger
rsync -r --include={'**/*.time'} outputs/formalLedger*/* docs/
- name: Upload docs
if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v4
with:
name: Docs-formalLedger
path: docs
- name: Upload typechecking times
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: Typechecking durations - FormalLedger
path: docs/*.time
Ledger-hs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://cache.iog.io https://cache.nixos.org/
- name: Build ledger
id: ledger-hs
run: |
nix-build -A ledger.hsSrc -j1 -o outputs/ledger
rsync -r --exclude={'**/nix-support','**/lib'} outputs/ledger*/* docs/
- name: Upload docs
if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v4
with:
name: Docs-ledger-hs
path: docs
Ledger-pdf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://cache.iog.io https://cache.nixos.org/
- name: Build ledger
id: ledger-pdf
run: |
echo -n html docs conway | xargs -d' ' -I{} nix-build -A ledger.{} -j1 -o outputs/ledger-{}
rsync -r --exclude={'**/nix-support','**/lib'} outputs/ledger*/* docs/
- name: Upload docs
if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v4
with:
name: Docs-ledger-pdf
path: docs
- name: Upload PDF artifacts
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: PDF specs - Ledger
path: docs/pdfs/*.pdf
Midnight:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://cache.iog.io https://cache.nixos.org/
- name: Build midnight
id: midnight
run: |
nix-build -A midnight -j1 -o outputs/midnight
rsync -r --exclude={'**/nix-support','**/lib'} outputs/midnight*/* docs/
- name: Upload docs
if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v4
with:
name: Docs-midnight
path: docs
- name: Upload PDF artifacts
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: PDF specs - Midnight
path: docs/pdfs/*.pdf
Uploads:
needs: [Formal-Ledger, Ledger-hs, Ledger-pdf, Midnight]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download docs
if: github.ref == 'refs/heads/master'
uses: actions/download-artifact@v4
with:
pattern: Docs-*
path: docs
merge-multiple: true
- name: Generate main website
if: github.ref == 'refs/heads/master'
run: |
echo "** Generated PDF files:"; find -L docs/ -name '*.pdf'
echo "** Generated HTML files:"; find -L docs/ -name '*.html'
echo "** Generated Haskell files:"; find -L docs/ -name '*.hs'
OUT_DIR=../docs/ make staticWebsite
- name: Add files
if: github.ref == 'refs/heads/master'
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add -f docs/
git commit -m "Updated for ${{ github.sha }}"
- name: Push to gh-pages
if: github.ref == 'refs/heads/master'
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
force: true
directory: .