-
Notifications
You must be signed in to change notification settings - Fork 1
131 lines (111 loc) · 5.01 KB
/
regressions-template.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
name: regressions-template
on:
workflow_call:
inputs:
projects-matrix-file:
required: true
type: string
analyze-dependencies:
required: true
type: boolean
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
base-commit: ${{ steps.base-commit.outputs.base-commit }}
projects-matrix: ${{ steps.projects-matrix.outputs.projects-matrix }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# In case of `workflow_dispatch` event, `github.sha` points to latest commit of chosen branch
# So, we need to find the latest common commit for master branch and chosen one
# to calculate difference only for branch changes
- name: Calculate base commit for workflow_dispatch or push event
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
run: echo "BASE_COMMIT=$(git merge-base origin/master ${{ github.sha }})" >> $GITHUB_ENV
# For pull request event, GitHub produces additional merge commit with `master` branch and PR branch as parents
# In this case, we want to check difference between master branch and merge commit
# so emit hash of `origin/master` branch itself as base commit
- name: Calculate base commit for pull_request event
if: github.event_name == 'pull_request'
run: echo "BASE_COMMIT=$(git rev-parse origin/master)" >> $GITHUB_ENV
- name: Emit base commit
id: base-commit
run: echo "base-commit=$BASE_COMMIT" >> $GITHUB_OUTPUT
- name: Show commits
run: |
echo "current commit:"
git log ${{ github.sha }} -n 1 --pretty=short
echo "base commit:"
git log ${{ steps.base-commit.outputs.base-commit }} -n 1 --pretty=short
- name: Emit projects matrix
id: projects-matrix
run: |
projects=$(cat ${{ inputs.projects-matrix-file }})
projects=${projects//$'\n'/} # remove newline characters
echo "projects-matrix=$projects" >> $GITHUB_OUTPUT
check:
needs: [ prepare ]
name: ${{ matrix.batch.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
batch: ${{ fromJson(needs.prepare.outputs.projects-matrix) }}
env:
ORG_GRADLE_PROJECT_showStandardStreams: true
PROJECTS: ${{ toJSON(matrix.batch.projects) }}
ANALYZE_DEPENDENCIES: ${{ inputs.analyze-dependencies }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rust-src
default: true
- name: Install bevy dependencies
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev libudev-dev
- name: Checkout projects
run: python scripts/fetch_projects.py --projects $'${{ toJSON(matrix.batch.projects) }}'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-excludes: |
caches/modules-2/files-2.1/com.jetbrains.intellij.idea
caches/modules-2/files-2.1/idea
caches/transforms-*
caches/*/transforms
- name: Download
run: ./gradlew :resolveDependencies -Pkotlin.incremental=false
- name: Check with changes
run: ./gradlew clean :test --tests "org.rustPerformanceTests.CustomRealProjectAnalysisTest"
env:
RESULT_SUFFIX: _with_changes
- name: Checkout base version
run: git checkout ${{ needs.prepare.outputs.base-commit }}
- name: Check without changes
run: ./gradlew clean :test --tests "org.rustPerformanceTests.CustomRealProjectAnalysisTest"
env:
RESULT_SUFFIX: _without_changes
- name: Checkout current version
run: git checkout ${{ github.sha }}
- name: Calculate regressions
run: python scripts/calculate_regressions.py --projects $'${{ toJSON(matrix.batch.projects) }}'
- name: Upload results
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.batch.name }}
path: regressions/