-
Notifications
You must be signed in to change notification settings - Fork 1
108 lines (85 loc) · 2.95 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
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
name: CI
on:
pull_request:
push:
branches:
- main
- 'push-action/**'
jobs:
pre-commit:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version}}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version}}
- name: Install dependencies
run: |
python -m pip install -U pip
pip install -U setuptools
pip install pre-commit
- name: Set PY env var
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Test with pre-commit
run: pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
build-package:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ['10', '13']
python-version: ["3.7", "3.9"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Python requirements
run: |
python -m pip install -U pip
pip install -U setuptools wheel
pip install -r requirements.txt
- name: Check build and installation of PyPI source distribution
env:
SDIST_DIR: sdist_action
BDIST_DIR: bdist_action
run: |
python setup.py -v sdist -d ${SDIST_DIR} bdist_wheel -d ${BDIST_DIR}
SDIST_FILE=$( ls ${SDIST_DIR}/ )
echo "BDIST_FILE=$( ls ${BDIST_DIR}/ )" >> $GITHUB_ENV
ORIGINAL_PWD=$(pwd)
mkdir -p /tmp/installation_dir
cd /tmp/installation_dir
pip install ${ORIGINAL_PWD}/${SDIST_DIR}/${SDIST_FILE}
- name: Assert nbextension installed correctly
run: ./.github/static/check_nbextensions.py
- name: Remove installation again
run: pip uninstall -y ipywidgets-extended
- name: Ensure it was removed as an nbextension
run: ./.github/static/check_nbextensions.py && exit 1 || ( echo "Failed as expected" ; exit 0 )
- name: Re-install wheel
env:
BDIST_DIR: bdist_action
run: |
ORIGINAL_PWD=$(pwd)
if [ "${ORIGINAL_PWD}" == "/tmp/installation_dir" ]; then echo "Wrong original dir: ${ORIGINAL_PWD}"; exit 1; fi
mkdir -p /tmp/installation_dir
cd /tmp/installation_dir
pip install ${ORIGINAL_PWD}/${BDIST_DIR}/${{ env.BDIST_FILE }}
- name: Assert nbextension installed correctly
run: ./.github/static/check_nbextensions.py