forked from bluesky/ophyd
-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (122 loc) · 4.4 KB
/
Copy pathcode.yml
File metadata and controls
146 lines (122 loc) · 4.4 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
name: Code CI
on:
push:
pull_request:
schedule:
- cron: "00 4 * * *" # daily at 4AM
jobs:
lint:
# pull requests are a duplicate of a branch push if they are from within the
# same repo. Skip these
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Lint
run: pip install --user .[dev] && tox -e pre-commit
build:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # So we get history for version numbers
- name: Create Sdist and Wheel
# Set SOURCE_DATE_EPOCH from git commit for reproducible build
# https://reproducible-builds.org/
run: SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) pipx run build --sdist --wheel
- name: Upload Wheel and Sdist as artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
- name: Install wheel and check cli works
run: pip install dist/*.whl && python -m ophyd --version
test:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
prerelease: [false]
# Add one more job that runs on prereleases
include:
- python-version: "3.12"
prerelease: true
runs-on: ubuntu-latest
env:
TEST_CL: pyepics
defaults:
run:
shell: bash -leo pipefail {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # So we get history for version number
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade setuptools && pip install -e .[dev] && pipdeptree
- name: Install prereleases of certain dependencies.
run: |
pip install --upgrade --pre bluesky event-model
if: ${{ matrix.prerelease }}
- name: Start Docker
run: |
sudo systemctl start docker
docker version
docker compose --version
- name: Create AD data directories
run: |
mkdir -p /tmp/ophyd_AD_test/
python scripts/create_directories.py /tmp/ophyd_AD_test/data1
- name: Clone epics-services-for-ophyd
run: |
git clone https://github.com/bluesky/epics-services-for-ophyd.git ~/epics-services-for-ophyd
- name: Start docker containers
run: |
source ~/epics-services-for-ophyd/environment.sh
docker compose -f ~/epics-services-for-ophyd/compose.yaml up -d
- name: Wait for docker containers to start
run: |
sleep 20
- name: Test with pytest
run: |
source ~/epics-services-for-ophyd/environment.sh
pytest -k "${TEST_CL}"
- name: Print Docker Compose Logs
if: always()
run: |
docker compose -f ~/epics-services-for-ophyd/compose.yaml logs
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
name: ${{ matrix.python }}
files: cov.xml
release:
needs: [build]
runs-on: ubuntu-latest
permissions:
id-token: write
# upload to PyPI and make a release on every tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Github Release
# We pin to the SHA, not the tag, for security reasons.
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1 (2025-01-07)
with:
files: dist/*
generate_release_notes: true
token: ${{ secrets.RELEASE_ON_GH_TOKEN }}
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ./dist/