-
Notifications
You must be signed in to change notification settings - Fork 73
85 lines (73 loc) · 2.43 KB
/
large-scale-test.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
name: Measure Diff Across Multiple Repos
on:
workflow_dispatch:
inputs:
prId:
description: "PR #"
required: true
type: number
type:
description: "Diff computation type"
required: true
default: "diffAfterMainFormat"
type: choice
options:
- diffAfterMainFormat # format using main branch first, then apply PR changes ontop of that
- diffMainVsChangeFormat # format using main branch, store. Reset to original then format using PR branch. Compute differences
jobs:
build-latest:
name: Build Pull Request (#${{ github.event.inputs.prId }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout Pull Request
run: gh pr checkout ${{ github.event.inputs.prId }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build (All features)
run: cargo build --verbose --locked --release --all-features
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: stylua-latest
path: target/release/stylua
build-main:
name: Build Main
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: "main"
- name: Build (All features)
run: cargo build --verbose --locked --release --all-features
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: stylua-main
path: target/release/stylua
run-comparison:
runs-on: ubuntu-latest
needs: ["build-main", "build-latest"]
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Set up artifacts
run: |
mv ./artifacts/stylua-main/stylua ./stylua-main
mv ./artifacts/stylua-latest/stylua ./stylua-latest
- name: Run comparison tool
id: run_comparison
run: |
body="$(python ./.github/run_comparisons.py ${{ github.event.inputs.type }})"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=body::$body"
- name: Create comment
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.inputs.prId }}
body: ${{ steps.run_comparison.outputs.body }}