-
Notifications
You must be signed in to change notification settings - Fork 3
121 lines (114 loc) · 4.42 KB
/
python-package.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
109
110
111
112
113
114
115
116
117
118
119
120
121
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [3.6]
# python-version: [3.6, 3.7]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Check config
run: |
cat > sshd_config <<EOF
SyslogFacility AUTHPRIV
PermitRootLogin yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication yes
ChallengeResponseAuthentication no
UsePAM yes
UseDNS no
X11Forwarding no
PrintMotd no
EOF
sudo mv sshd_config /etc/ssh/sshd_config
sudo systemctl restart ssh
- name: Create ssh key
run: >
ssh-keygen -t rsa -b 4096 -N '' -f ~/.ssh/id_rsa
- name: Add key to auth file
run: >
cat ~/.ssh/id_rsa.pub | tee -a ~/.ssh/authorized_keys
- name: Ensure the owner of the key is correct
run: |
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
sudo chmod -c 0755 ~/
ls -la ~/.ssh
- name: Test SSH connection to localhost
run: >
ssh -vvv -i ~/.ssh/id_rsa -o BatchMode=yes -o StrictHostKeyChecking=no $(whoami)@localhost
- name: Install dependencies
run: |
sudo apt update && sudo apt install ecflow-server ecflow-client python3-ecflow python3-setuptools python3-nose python3-nose-cov python3-nose-timer
# Start the server manually
ecflow_start
ecflow_client --port $(( `id -u` + 1500 )) --ping
python -m pip install --upgrade pip
pip install flake8 pytest
pip install sphinx
pip install coverage==4.5.4
pip install coveralls
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
#- name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install package
run: |
pip install -e .[test]
- name: Test with nosetests
run: |
ls -l /usr/bin/start_ecflow.sh || echo "/usr/bin/start_ecflow.sh not found"
ls -l /usr/sbin/ecflow_start || echo "/usr/sbin/ecflow_start not found"
ls -l /usr/lib/python3/dist-packages/ecflow
ls -ltr /usr/lib/python3/dist-packages/
export PYTHONPATH="/usr/lib/python3/dist-packages/:$PYTHONPATH"
python -c "import ecflow; print(ecflow.__file__)"
export PATH=$PWD/test/bin:/usr/bin/:$PATH; export PYTHONPATH=/usr/lib/python3/dist-packages/:$PYTHONPATH; nosetests
- name: Coveralls
if: ${{ matrix.python-version == 3.6 }}
run: |
./create_coverage.sh
type coveralls
which coveralls
COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} coveralls
- name: Create documentation
if: ${{ matrix.python-version == 3.6 }}
run: |
export PYTHONPATH="/usr/lib/python3/dist-packages/:$PYTHONPATH"
python -c "import ecflow; print(ecflow.__file__)"
cd docs
make html
- name: Commit documentation changes
if: ${{ matrix.python-version == 3.6 }}
run: |
git clone https://github.com/metno/pysurfex-scheduler.git --branch gh-pages --single-branch gh-pages
cp -r docs/build/html/* gh-pages/
cd gh-pages
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update documentation" -a || true
# The above command will fail if no changes were present, so we ignore
# the return code.
- name: Push changes
if: ${{ matrix.python-version == 3.6 }}
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}