-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (119 loc) · 5.02 KB
/
dyno.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
name: Run dyno on PR open
on:
pull_request:
types:
- opened
jobs:
run-dyno:
if: ${{ github.event.pull_request.merged == false }}
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
TARGET_REPO: ${{ secrets.TARGET_REPO }}
TARGET_NAME: ${{ secrets.TARGET_NAME }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Modify sysctl settings
run: |
echo "kernel.perf_event_paranoid=-1" | sudo tee -a /etc/sysctl.conf
echo "kernel.kptr_restrict=0" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p /etc/sysctl.conf
- name: Extract PR number
id: extract_pr_number
run: |
echo "PR_NUMBER=$(echo "${{ github.event.pull_request.url }}" | grep -o '[0-9]*$')" >> $GITHUB_ENV
- name: Fetch PR reference
run: |
git fetch origin pull/${{ env.PR_NUMBER }}/head:pr-${{ env.PR_NUMBER }}
- name: Check out PR branch
run: |
git checkout pr-${{ env.PR_NUMBER }}
- name: Extract PR hash
id: extract_pr_hash
run: |
PR_HASH=$(git rev-parse HEAD)
echo "PR_HASH=$PR_HASH" >> $GITHUB_ENV
- name: Get PR title and URL
id: get_pr_details
run: |
PR_DETAILS=$(curl -s -H "Authorization: token ${{ env.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository_owner }}/${{ github.event.pull_request.head.repo.name }}/pulls/${{ env.PR_NUMBER }}")
PR_TITLE=$(echo "$PR_DETAILS" | jq -r '.title')
PR_URL=$(echo "$PR_DETAILS" | jq -r '.html_url')
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV
echo "PR_URL=$PR_URL" >> $GITHUB_ENV
- name: Clone target repository
run: |
cd /home/runner/work/
git clone https://github.com/${{ env.TARGET_REPO }} ${{ env.TARGET_NAME }}
cd ${{ env.TARGET_NAME }}
git config user.name "github-actions"
git config user.email "github-actions@github.com"
- name: Get folder name inside site/data
id: get_folder_name
run: |
FOLDER_NAME=$(ls -d /home/runner/work/${{ env.TARGET_NAME }}/site/data/*/ | xargs -n 1 basename)
echo "FOLDER_NAME=$FOLDER_NAME" >> $GITHUB_ENV
- name: Move benchmarks data to dyno folder
id: move_benchmarks_data_to_dyno_folder
run: |
mkdir -p /home/runner/work/benchmarks
mkdir -p /home/runner/work/benchmarks/stats
mkdir -p /home/runner/work/benchmarks/runs
mkdir -p /home/runner/work/benchmarks/flamegraphs
cp -r /home/runner/work/${{ env.TARGET_NAME }}/site/data/* /home/runner/work/benchmarks/
cp -r /home/runner/work/${{ env.TARGET_NAME }}/site/data/${{ env.FOLDER_NAME }}/stats/* /home/runner/work/benchmarks/stats
cp -r /home/runner/work/${{ env.TARGET_NAME }}/site/data/${{ env.FOLDER_NAME }}/runs/* /home/runner/work/benchmarks/runs
cp -r /home/runner/work/${{ env.TARGET_NAME }}/site/data/${{ env.FOLDER_NAME }}/flamegraphs/* /home/runner/work/benchmarks/flamegraphs
- name: Build sway
run: |
cargo build --release --features profiler
- name: Install dyno tool
run: |
cd /home/runner/work/
mkdir profiler
cd profiler
git clone https://github.com/ourovoros-io/dyno.git
cd dyno
cargo build --release
cp target/release/dyno /home/runner/work/
sudo rm -rf /home/runner/work/profiler
- name: Run dyno tool
run: |
cd /home/runner/work/
./dyno -t sway/sway/test/src/sdk-harness/test_projects/ -f sway/sway/target/release/forc --flamegraph --data-only
- name: Install Dyno Site
run: |
cd /home/runner/work/
mkdir sitebuilder
cd sitebuilder
git clone https://github.com/ourovoros-io/dynosite.git
cd dynosite
cargo build --release
cp target/release/dynosite /home/runner/work/
sudo rm -rf /home/runner/work/sitebuilder
- name: Run Dyno Site
run: |
cd /home/runner/work/
./dynosite -b /home/runner/work/benchmarks -p "${{ env.PR_HASH }}" -t "${{ env.PR_TITLE }}" -l "${{ env.PR_URL }}" --data-only
- name: Copy generated files
run: |
cp -r /home/runner/work/site/data /home/runner/work/${{ env.TARGET_NAME }}/site/
cp /home/runner/work/site/error.html /home/runner/work/${{ env.TARGET_NAME }}/site
cp /home/runner/work/site/index.html /home/runner/work/${{ env.TARGET_NAME }}/site
- name: Update README
run: |
cd /home/runner/work/${{ env.TARGET_NAME }}
echo "[View the generated index.html](./site/index.html)" > README.md
- name: Commit and push changes
run: |
cd /home/runner/work/${{ env.TARGET_NAME }}
git add .
git commit -m "Update benchmarks and data for PR #${{ env.PR_NUMBER }}"
git push https://x-access-token:${{ env.GITHUB_TOKEN }}@github.com/${{ env.TARGET_REPO }}.git main