Repository navigation
151 lines (129 loc) · 4.83 KB
/
Copy pathrun_pytest.yml
File metadata and controls
151 lines (129 loc) · 4.83 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
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
name: Run pytest
on:
# Run on any pushes to the main branch which releases are generated from
push:
branches:
- develop
- 'prep-release/**'
pull_request:
branches:
- develop
- 'prep-release/**'
# If taking a PR out of draft mode, run the workflow on the PR event as well
types: [opened, synchronize, reopened, ready_for_review]
# Cancel any running jobs for this same branch if a new commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
install_and_test:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
defaults:
run:
shell: bash
container:
image: ghcr.io/dune-daq/nightly-release-alma9:development_v5
steps:
- name: Check URLs
run: |
echo https://github.com/${{ github.event.pull_request.head.repo.owner.login }}/druncschema.git
echo https://github.com/${{ github.event.pull_request.head.repo.owner.login }}/drunc.git
- name: Install SSH and run the daemon
run: |
dnf install -y openssh-server
dnf install -y openssh-clients
ssh-keygen -A
mkdir -p /root/.ssh
ssh-keygen -t rsa -N "" -f /root/.ssh/id_rsa
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
chmod 600 /root/.ssh/id_rsa
# Create SSH config file in the correct location
cat > /root/.ssh/config << 'EOF'
Host localhost
HostName 127.0.0.1
User root
IdentityFile /root/.ssh/id_rsa
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
EOF
# Start SSH daemon
/usr/sbin/sshd
# Test SSH connection
ssh localhost echo "SSH is working"
- name: Set up dev nightly
if: ${{ !cancelled() }}
run: |
mkdir nightly
cd nightly
source /cvmfs/dunedaq.opensciencegrid.org/setup_dunedaq.sh
setup_dbt latest_v5
dbt-create -n last_fddaq
cd NFD_DEV*
source env.sh
dbt-build
dbt-workarea-env
- name: Install druncschema and drunc
if: success()
run: |
cd nightly/NFD_DEV* || true
source env.sh
python -m pip install --upgrade pip
cd sourcecode
git clone https://github.com/${{ github.event.pull_request.head.repo.owner.login }}/druncschema.git -b ${{ github.head_ref }} || git clone https://github.com/DUNE-DAQ/druncschema.git
git clone https://github.com/${{ github.event.pull_request.head.repo.owner.login }}/drunc.git -b ${{ github.head_ref }} || git clone https://github.com/DUNE-DAQ/drunc.git
cd druncschema
pip install .[test]
cd -
cd drunc
pip install .[test]
echo "DRUNC_DIR=$(pwd)" >> $GITHUB_ENV
- name: Test with pytest/pytest-cov
if: success()
run: |
cd nightly/NFD_DEV* || true
source env.sh
cd sourcecode/drunc || true
pip install pytest pytest-cov
pytest --junitxml=junit/test-results.xml --cov=drunc --cov-report=html
- name: Publish JUnit test report
uses: mikepenz/action-junit-report@v5
if: ${{ !cancelled() }}
with:
report_paths: '${{ env.DRUNC_DIR }}/junit/test-results.xml'
# - name: Deploy HTML coverage to GitHub Pages
# if: ${{ !cancelled() }}
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ${{ env.DRUNC_DIR }}/htmlcov/
# destination_dir: coverage/${{ github.ref_name }} # This adds the branch name to the URL
# publish_branch: gh-pages
# - name: Comment on PR
# if: ${{ !cancelled() }}
# uses: actions/github-script@v7
# with:
# script: |
# github.rest.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: 'Coverage report: https://dune-daq.github.io/drunc/coverage/${{ github.ref_name }}/index.html'
# })
# - name: Upload JUnit test report
# if: ${{ !cancelled() }}
# uses: actions/upload-artifact@v4
# with:
# name: junit-report
# path: ${{ env.DRUNC_DIR }}/junit/test-results.xml
# if-no-files-found: error
# retention-days: 7
- name: Upload coverage report (HTML)
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: html-coverage-report
path: ${{ env.DRUNC_DIR }}/htmlcov/
if-no-files-found: error
retention-days: 7