-
-
Notifications
You must be signed in to change notification settings - Fork 57
117 lines (98 loc) · 3.57 KB
/
nightly.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
name: Nightly build
# on:
# workflow_dispatch: {}
# schedule:
# - cron: '0 0 * * *'
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
# check_changes:
# runs-on: ubuntu-latest
# name: Check latest commit
# outputs:
# should_run: ${{steps.should_run.outputs.should_run}}
# steps:
# - uses: actions/checkout@v2
# - name: print latest_commit
# run: echo ${{github.sha}}
# - id: should_run
# continue-on-error: true
# name: check latest commit is less than a day
# if: ${{ github.event_name == 'schedule' }}
# run: test -z $(git rev-list --after="24 hours" ${{github.sha}}) && echo "::set-output name=should_run::false"
optimize:
name: PGO Build
strategy:
matrix:
os: [
{ os: ubuntu-latest, arch: x86_64-unknown-linux-gnu },
{ os: macos-latest, arch: aarch64-apple-darwin },
{ os: windows-latest, arch: x86_64-pc-windows-msvc }
]
# needs: check_changes
# if: ${{needs.check_changes.outputs.should_run != 'false'}}
runs-on: ${{ matrix.os.os }}
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: llvm-tools-preview
- name: Set the STEEL_HOME environment variable
run: echo STEEL_HOME=${PWD}/.steel-sync >> $GITHUB_ENV
- name: Install cargo-pgo
run: cargo install cargo-pgo
- uses: Swatinem/rust-cache@v2
with:
shared-key: "build"
- name: Build instrumented binary
# Use `cargo pgo build -- --bin foo` if you have multiple binaries
run: cargo pgo build
- name: install steel dylib installer
env:
STEEL_HOME: ${{ env.STEEL_HOME }}
run: mkdir -p $STEEL_HOME/native && cd crates/cargo-steel-lib && cargo install --path .
- name: Install cogs
env:
STEEL_HOME: ${{ env.STEEL_HOME }}
run: |
echo $STEEL_HOME
mkdir -p .steel/cogs
cd cogs/
cargo run -- install.scm
- name: Gather PGO profiles
env:
STEEL_HOME: ${{ env.STEEL_HOME }}
run: |
./target/${{ matrix.os.arch }}/release/steel r7rs-benchmarks/scheme.scm
./target/${{ matrix.os.arch }}/release/steel r7rs-benchmarks/simplex.scm
./target/${{ matrix.os.arch }}/release/steel r7rs-benchmarks/array1.scm
./target/${{ matrix.os.arch }}/release/steel r7rs-benchmarks/triangl.scm
./target/${{ matrix.os.arch }}/release/steel benchmarks/fib/fib.scm
- name: Build optimized binary
run: cargo pgo optimize
- name: Archive pgo optimized binary
if: ${{ runner.os != 'windows' }}
uses: actions/upload-artifact@v4
with:
name: pgo-nightly-build-${{ matrix.os.arch }}
path: ${{ github.workspace }}/target/${{ matrix.os.arch }}/release/steel
retention-days: 30
- name: Archive pgo optimized binary
if: ${{ runner.os == 'windows' }}
uses: actions/upload-artifact@v2
with:
name: pgo-nightly-build-${{ matrix.os.arch }}
path: ${{ github.workspace }}\target\${{ matrix.os.arch }}\release\steel
retention-days: 30
# Now do something with the PGO optimized binary at `./target/x86_64-unknown-linux-gnu/release/foo` :)