This repository has been archived by the owner on Mar 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
107 lines (104 loc) · 3.27 KB
/
pull-request-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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Pull request test
on:
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
get-edited-notebooks:
runs-on: ubuntu-latest
name: Get edited notebooks
outputs:
edited_notebooks: ${{ steps.output.outputs.changed_files }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
with:
json: true
files: |
**/*.ipynb
- name: Set output
id: output
if: steps.changed-files.outputs.any_changed == 'true'
run: echo "changed_files=${{ steps.changed-files.outputs.all_changed_files }}" >> "$GITHUB_OUTPUT"
test-notebooks:
name: Test edited notebooks
needs: get-edited-notebooks
if: ${{ needs.get-edited-notebooks.outputs.edited_notebooks }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
notebooks: ${{ fromJSON(needs.get-edited-notebooks.outputs.edited_notebooks) }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: "pip"
cache-dependency-path: "tests/semantic_segmentation_course/requirements.txt"
- name: Install Python dependencies
uses: py-actions/py-dependency-install@v4
with:
path: "tests/semantic_segmentation_course/requirements.txt"
- name: Run notebooks
uses: nick-fields/retry@v2
with:
timeout_minutes: 20
max_attempts: 2
retry_on: timeout
command: |
echo "run ${{ matrix.notebooks }}"
ipython ${{ matrix.notebooks }}
get-edited-scripts:
runs-on: ubuntu-latest
name: Get edited scripts
outputs:
edited_scripts: ${{ steps.output.outputs.changed_files }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
with:
json: true
files: |
**/*.py
- name: Set output
id: output
if: steps.changed-files.outputs.any_changed == 'true'
run: echo "changed_files=${{ steps.changed-files.outputs.all_changed_files }}" >> "$GITHUB_OUTPUT"
test-scripts:
name: Test edited scripts
needs: get-edited-scripts
if: ${{ needs.get-edited-scripts.outputs.edited_scripts }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
scripts: ${{ fromJSON(needs.get-edited-scripts.outputs.edited_scripts) }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: "pip"
cache-dependency-path: "tests/semantic_segmentation_course/requirements.txt"
- name: Install Python dependencies
uses: py-actions/py-dependency-install@v4
with:
path: "tests/semantic_segmentation_course/requirements.txt"
- name: Run scripts
uses: nick-fields/retry@v2
with:
timeout_minutes: 40
max_attempts: 2
retry_on: timeout
command: |
echo "run ${{ matrix.scripts }}"
python ${{ matrix.scripts }}