-
Notifications
You must be signed in to change notification settings - Fork 3
150 lines (147 loc) · 4.74 KB
/
pytest.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
name: Pyanodon Tests
on:
workflow_call:
inputs:
repository:
type: string
description: "Caller repository"
required: false
default: ""
ref:
type: string
description: "Ref/sha to use for the caller repository"
required: false
default: ""
test_ref:
type: string
description: "Ref/sha to use for pyanodontest"
required: false
default: "v1"
test_branch:
type: string
description: "Branch to use for pyanodontest"
required: false
default: ""
env:
GITHUB_TOKEN: ${{ secrets.TESTUSER_TOKEN }}
EVENT_REPOSITORY: ${{ inputs.repository }}
EVENT_REF: ${{ inputs.ref }}
EVENT_BRANCH: ${{ inputs.test_branch }}
jobs:
genereate_matrix:
name: "Generate strategy matrix"
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: checkout
uses: actions/checkout@v4
with:
repository: "pyanodon/pyanodontests"
token: ${{ secrets.TESTUSER_TOKEN }}
ref: ${{ inputs.test_ref }}
- name: Install PyGithub
run: |
python -m pip install --upgrade pip
python -m pip install pygithub
- id: set-matrix
run: |
echo 'matrix<<EOF' >> $GITHUB_OUTPUT
echo "$(python getrefs.py)" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
load_test:
name: ${{ format('CrashTest {0}', matrix.name) }}
needs: genereate_matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.genereate_matrix.outputs.matrix) }}
steps:
- name: "Checkout pyanodontests"
uses: actions/checkout@v4
with:
repository: "pyanodon/pyanodontests"
token: ${{ secrets.TESTUSER_TOKEN }}
ref: ${{ inputs.test_ref }}
- name: "Checkout stdlib"
uses: actions/checkout@v4
with:
repository: "Afforess/Factorio-Stdlib"
ref: v1.4.6
path: "factorio/mods/stdlib"
- name: "Checkout mods"
uses: ShadowGlass0/multi-checkout@v2
with:
repositories: ${{ toJSON(matrix.mods) }}
token: ${{ secrets.TESTUSER_TOKEN }}
- name: "Move mods"
run: ./movemods.sh
- name: "Prepare test"
run: ./tests/crashtest/pre-process.sh
- name: "TEST: Load Factorio"
uses: ShadowGlass0/factorio-docker-for-github-actions@main
- name: "Test Results"
run: ./tests/crashtest/post-process.sh
techtree_test:
name: ${{ format('TechTree {0}', matrix.name) }}
needs: [genereate_matrix, load_test]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.genereate_matrix.outputs.matrix) }}
steps:
- name: "Checkout pyanodontests"
uses: actions/checkout@v4
with:
repository: "pyanodon/pyanodontests"
token: ${{ secrets.TESTUSER_TOKEN }}
ref: ${{ inputs.test_ref }}
- name: "Checkout stdlib"
uses: actions/checkout@v4
with:
repository: "Afforess/Factorio-Stdlib"
ref: v1.4.6
path: "factorio/mods/stdlib"
- name: "Checkout mods"
uses: ShadowGlass0/multi-checkout@v2
with:
repositories: ${{ toJSON(matrix.mods) }}
token: ${{ secrets.TESTUSER_TOKEN }}
- name: "Move mods"
run: ./movemods.sh
- name: "Prepare test"
run: ./tests/techtree/pre-process.sh
- name: "TEST: Tech Tree Verification"
uses: ShadowGlass0/factorio-docker-for-github-actions@main
- name: "Test Results"
run: ./tests/techtree/post-process.sh
notify:
name: Discord Notification
runs-on: ubuntu-latest
needs: [load_test, techtree_test]
if: ${{ always() }}
steps:
- id: test_status
uses: lwhiteley/[email protected]
with:
statuses: failure
dependencies: ${{ toJSON(needs) }}
- name: Notify failure
if: ${{ fromJSON(steps.test_status.outputs.found) }}
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: failure
- name: Notify success
if: ${{ ! fromJSON(steps.test_status.outputs.found) }}
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: success
- name: Notify public commit
if: ${{ (github.head_ref || github.ref_name) == 'master' || (github.head_ref || github.ref_name) == 'main' }}
uses: Sniddl/[email protected]
with:
webhook: ${{ secrets.PUBLIC_DISCORD_WEBHOOK }}
template: "simple-link"
include-extras: false