-
Notifications
You must be signed in to change notification settings - Fork 47
118 lines (103 loc) · 3.32 KB
/
upstream-dev-ci.yml
File metadata and controls
118 lines (103 loc) · 3.32 KB
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
name: CI Upstream
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Daily “At 00:00”
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
upstream-dev:
name: upstream-dev
runs-on: ubuntu-latest
continue-on-error: true
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
python-version: [ "3.13" ]
outputs:
testresults: ${{ steps.tests.outcome }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
token: ${{ github.token }}
- name: Set up environment
uses: mamba-org/setup-micromamba@v3
with:
environment-file: ci/environment.yml
create-args: >-
python=${{ matrix.python-version }}
- name: conda list
run: |
conda list
- name: Install upstream versions
run: |
bash ci/install-upstream.sh
- name: Install uxarray
run: |
python -m pip install . --no-deps
- name: conda list
run: |
conda list
- name: Running Tests
id: tests
run: |
python -m pytest test -v --cov=./uxarray --cov-report=xml
failure-issue:
name: failure-issue
needs: [upstream-dev]
if: |
needs.upstream-dev.testresults != 'success'
&& github.repository == 'UXARRAY/uxarray'
&& github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: checkout
uses: actions/checkout@v6.0.2
- name: Create or update failure issue
shell: bash
run: |
# Read the template
template=$(cat .github/upstream-failure-issue-template.md)
# Replace placeholders
issue_body="${template//\{\{WORKFLOW\}\}/${{ github.workflow }}}"
issue_body="${issue_body//\{\{RUN_ID\}\}/${{ github.run_id }}}"
issue_body="${issue_body//\{\{RUN_URL\}\}/${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}}"
issue_body="${issue_body//\{\{DATE\}\}/$(date -u)}"
# Check for existing open issue with same title
issue_title="🤖 Upstream testing failure"
existing_issue=$(gh issue list --state open --label "CI" --search "\"$issue_title\" in:title" --json number --jq '.[0].number // empty')
if [ -n "$existing_issue" ]; then
echo "Found existing open issue #$existing_issue, updating it..."
echo "$issue_body" | gh issue edit "$existing_issue" --body-file -
echo "Updated existing issue #$existing_issue"
else
echo "No existing open issue found, creating new one..."
echo "$issue_body" | gh issue create \
--title "$issue_title" \
--body-file - \
--label "CI"
echo "Created new issue"
fi
env:
GH_TOKEN: ${{ github.token }}
report-failed:
name: report-failed
needs: [ upstream-dev, failure-issue ]
if: ${{needs.upstream-dev.outputs.testresults != 'success'}}
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: make sure to report a failed workflow
shell: bash
run: |
exit 1;