forked from HEPData/hepdata-converter
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (51 loc) · 1.62 KB
/
ci.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
name: Continuous Integration
on:
push:
pull_request:
branches: [ main ]
release:
types: [ published ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install pip dependencies
run: |
pip install --upgrade pip
pip install coveralls
- name: Run tests
env:
DOCKER_IMAGE: hepdata/hepdata-converter:latest
run: |
export CURRENT_PATH=`pwd`
docker run -v $CURRENT_PATH:$CURRENT_PATH $DOCKER_IMAGE /bin/bash -c "cd $CURRENT_PATH && pip install -e '.[tests]' && hepdata-converter -v && coverage run -m unittest discover hepdata_converter/testsuite 'test_*'"
- name: Run coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
run: |
coveralls
deploy:
needs: test
if: github.event_name == 'release'
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/hepdata-converter
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4
- name: Build PyPI package
env:
DOCKER_IMAGE: hepdata/hepdata-converter:latest
run: |
export CURRENT_PATH=`pwd`
docker run -v $CURRENT_PATH:$CURRENT_PATH $DOCKER_IMAGE /bin/bash -c "cd $CURRENT_PATH && pip install wheel && python setup.py sdist bdist_wheel"
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1