|
1 |
| -# Description: This is a test workflow for running a Python script on a self-hosted runner |
2 |
| -# Don't chain jobs together as any failure in one job will stop the workflow |
| 1 | +# GitHub Actions workflow for automated testing |
| 2 | +# See: https://docs.github.com/en/actions |
| 3 | +# |
| 4 | +# This workflow runs Python tests on a self-hosted runner |
| 5 | +# Jobs are independent to allow partial success/failure reporting |
3 | 6 |
|
4 |
| -name: Python test |
5 |
| -run-name: python_test |
6 |
| -on: [pull_request] |
| 7 | +name: Python test |
| 8 | +run-name: python_test |
| 9 | +on: |
| 10 | + pull_request: |
| 11 | + workflow_dispatch: |
7 | 12 | jobs:
|
8 | 13 | Preamble:
|
9 | 14 | runs-on: self-hosted
|
| 15 | + concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 17 | + cancel-in-progress: true |
10 | 18 | steps:
|
11 |
| - - run: cd ~/Desktop/blech_clust |
12 | 19 | - run: pwd
|
13 | 20 | - run: which python
|
14 | 21 | - run: conda info --envs
|
15 | 22 | - name: Set up repo
|
16 | 23 | uses: actions/checkout@v4
|
| 24 | + - run: git status |
17 | 25 | - run: echo "${{ github.ref }} | ${{ github.repository }} | ${{ github.event.pull_request.title }}"
|
18 |
| - Spike-Only: |
| 26 | + - name: check labels |
| 27 | + run: echo "${{ github.event.pull_request.labels.*.name }}" |
| 28 | + - name: Copy files to working-directory |
| 29 | + run: cp -r ./* /home/exouser/Desktop/blech_clust |
| 30 | + - name: Check files in working-directory |
| 31 | + run: ls -R /home/exouser/Desktop/blech_clust |
| 32 | + - name: Setup params |
| 33 | + run: cp /home/exouser/Desktop/blech_clust/params/_templates/* /home/exouser/Desktop/blech_clust/params |
| 34 | + - name: Check params |
| 35 | + run: for f in $(find /home/exouser/Desktop/blech_clust/params/ -type f); do echo $f; cat $f; done |
| 36 | + Install: |
19 | 37 | runs-on: self-hosted
|
20 | 38 | needs: Preamble
|
| 39 | + if: ${{ contains(github.event.pull_request.labels.*.name, 'install') }} |
| 40 | + # Only run installation when PR has 'install' label |
21 | 41 | steps:
|
22 |
| - - name: Set up repo |
23 |
| - uses: actions/checkout@v4 |
24 |
| - - name: Prefect SPIKE only test |
| 42 | + - name: Clean install |
| 43 | + working-directory: /home/exouser/Desktop/blech_clust |
| 44 | + run: | |
| 45 | + echo "Running installation for tag ${{ github.ref }}" |
| 46 | + make clean |
| 47 | + - name: Install dependencies |
| 48 | + working-directory: /home/exouser/Desktop/blech_clust |
| 49 | + run: | |
| 50 | + make base |
| 51 | + - name: Install EMG |
| 52 | + working-directory: /home/exouser/Desktop/blech_clust |
| 53 | + run: | |
| 54 | + make emg |
| 55 | + - name: Install neuRecommend |
| 56 | + working-directory: /home/exouser/Desktop/blech_clust |
| 57 | + run: | |
| 58 | + make neurec |
| 59 | + - name: Install BlechRNN |
| 60 | + working-directory: /home/exouser/Desktop/blech_clust |
| 61 | + run: | |
| 62 | + make blechrnn |
| 63 | + - name: Install Prefect |
| 64 | + working-directory: /home/exouser/Desktop/blech_clust |
| 65 | + run: | |
| 66 | + make prefect |
| 67 | + - name: Patch dependencies |
| 68 | + working-directory: /home/exouser/Desktop/blech_clust |
| 69 | + run: | |
| 70 | + make patch |
| 71 | + Spike-EMG-Install: |
| 72 | + runs-on: self-hosted |
| 73 | + needs: Install |
| 74 | + concurrency: |
| 75 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 76 | + cancel-in-progress: true |
| 77 | + # Test full pipeline with both spike sorting and EMG analysis |
| 78 | + if: ${{ contains(github.event.pull_request.labels.*.name, 'install') }} |
| 79 | + steps: |
| 80 | + - name: Prefect SPIKE then EMG test |
25 | 81 | shell: bash
|
26 | 82 | working-directory: /home/exouser/Desktop/blech_clust
|
27 |
| - run: python pipeline_testing/prefect_pipeline.py -s 2>&1 | |
28 |
| - tee ~/Desktop/blech_clust/github.log; |
29 |
| - if grep -q "ERROR" ~/Desktop/blech_clust/github.log; |
30 |
| - then echo "ERROR detected by bash"; exit 1; fi |
31 |
| - EMG-Only: |
| 83 | + run: conda run -n blech_clust python pipeline_testing/prefect_pipeline.py --spike-emg 2>&1 | |
| 84 | + tee ~/Desktop/blech_clust/github.log; |
| 85 | + if grep -q "ERROR" ~/Desktop/blech_clust/github.log; then |
| 86 | + echo "ERROR detected by bash"; |
| 87 | + ./pipeline_testing/extract_traceback.sh ~/Desktop/blech_clust/github.log; |
| 88 | + exit 1; |
| 89 | + fi |
| 90 | + EMG-Only-Install: |
32 | 91 | runs-on: self-hosted
|
33 |
| - needs: Preamble |
| 92 | + needs: Spike-EMG-Install |
| 93 | + concurrency: |
| 94 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 95 | + cancel-in-progress: true |
| 96 | + # Test EMG analysis pipeline in isolation |
34 | 97 | steps:
|
35 |
| - - name: Set up repo |
36 |
| - uses: actions/checkout@v4 |
37 | 98 | - name: Prefect EMG only test
|
38 | 99 | shell: bash
|
39 | 100 | working-directory: /home/exouser/Desktop/blech_clust
|
40 |
| - run: python pipeline_testing/prefect_pipeline.py -e 2>&1 | |
41 |
| - tee ~/Desktop/blech_clust/github.log; |
42 |
| - if grep -q "ERROR" ~/Desktop/blech_clust/github.log; |
43 |
| - then echo "ERROR detected by bash"; exit 1; fi |
| 101 | + run: conda run -n blech_clust python pipeline_testing/prefect_pipeline.py -e 2>&1 | |
| 102 | + tee ~/Desktop/blech_clust/github.log; |
| 103 | + if grep -q "ERROR" ~/Desktop/blech_clust/github.log; then |
| 104 | + echo "ERROR detected by bash"; |
| 105 | + ./pipeline_testing/extract_traceback.sh ~/Desktop/blech_clust/github.log; |
| 106 | + exit 1; |
| 107 | + fi |
44 | 108 | Spike-EMG:
|
45 | 109 | runs-on: self-hosted
|
46 |
| - needs: Preamble |
| 110 | + needs: Preamble |
| 111 | + concurrency: |
| 112 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 113 | + cancel-in-progress: true |
| 114 | + # Test full pipeline with both spike sorting and EMG analysis |
| 115 | + if: ${{ !contains(github.event.pull_request.labels.*.name, 'install') }} |
47 | 116 | steps:
|
48 |
| - - name: Set up repo |
49 |
| - uses: actions/checkout@v4 |
50 | 117 | - name: Prefect SPIKE then EMG test
|
51 | 118 | shell: bash
|
52 | 119 | working-directory: /home/exouser/Desktop/blech_clust
|
53 |
| - run: python pipeline_testing/prefect_pipeline.py --spike-emg 2>&1 | |
54 |
| - tee ~/Desktop/blech_clust/github.log; |
55 |
| - if grep -q "ERROR" ~/Desktop/blech_clust/github.log; |
56 |
| - then echo "ERROR detected by bash"; exit 1; fi |
57 |
| - |
| 120 | + run: conda run -n blech_clust python pipeline_testing/prefect_pipeline.py --spike-emg 2>&1 | |
| 121 | + tee ~/Desktop/blech_clust/github.log; |
| 122 | + if grep -q "ERROR" ~/Desktop/blech_clust/github.log; then |
| 123 | + echo "ERROR detected by bash"; |
| 124 | + ./pipeline_testing/extract_traceback.sh ~/Desktop/blech_clust/github.log; |
| 125 | + exit 1; |
| 126 | + fi |
| 127 | + EMG-Only: |
| 128 | + runs-on: self-hosted |
| 129 | + needs: Spike-EMG |
| 130 | + concurrency: |
| 131 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 132 | + cancel-in-progress: true |
| 133 | + # Test EMG analysis pipeline in isolation |
| 134 | + if: ${{ !contains(github.event.pull_request.labels.*.name, 'install') }} |
| 135 | + steps: |
| 136 | + - name: Prefect EMG only test |
| 137 | + shell: bash |
| 138 | + working-directory: /home/exouser/Desktop/blech_clust |
| 139 | + run: conda run -n blech_clust python pipeline_testing/prefect_pipeline.py -e 2>&1 | |
| 140 | + tee ~/Desktop/blech_clust/github.log; |
| 141 | + if grep -q "ERROR" ~/Desktop/blech_clust/github.log; then |
| 142 | + echo "ERROR detected by bash"; |
| 143 | + ./pipeline_testing/extract_traceback.sh ~/Desktop/blech_clust/github.log; |
| 144 | + exit 1; |
| 145 | + fi |
0 commit comments