8000 Migrate from Travis-CI to GH Actions (#90) · srijan-deepsource/python-sasctl@fecd6f0 · GitHub
[go: up one dir, main page]

Skip to content

Commit fecd6f0

Browse files
authored
Migrate from Travis-CI to GH Actions (sassoftware#90)
* Create codeql-analysis.yml * remove travis CI. add GH build/test actions * fix package name match when installed locally * remove utf8 config * install kerberos client * kerberos dev libraries * cleanup * allow lint failure. temporarily disable testing. * lint src directory * cleanup * build documentation * fix doc build * run codecov * install codecov * build on push (temporary) * install codecov * draft build phase * build package * archive output * combined publish steps * matrix runner OS * download doc artifact
1 parent e059647 commit fecd6f0

File tree

5 files changed

+196
-100
lines changed

5 files changed

+196
-100
lines changed
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: "Test & Build"
2+
on: [push, workflow_dispatch]
3+
jobs:
4+
codeanalysis:
5+
name: "Code Quality"
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
- name: Checkout repository
10+
uses: actions/checkout@v2
11+
12+
- name: Lint
13+
uses: ricardochaves/python-lint@v1.4.0
14+
continue-on-error: true
15+
with:
16+
python-root-list: "src"
17+
18+
test:
19+
name: "Test"
20+
runs-on: ${{ matrix.os-version }}
21+
env:
22+
LANG: en_US.UTF-8
23+
strategy:
24+
matrix:
25+
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
26+
os-version: [ubuntu-latest, windows-latest, macos-latest]
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v2
31+
32+
- name: Set up Python ${{ matrix.python-version }}
33+
uses: actions/setup-python@v2
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
37+
- name: Install dependencies (Ubuntu)
38+
if: matrix.os-version == 'ubuntu-latest'
39+
run: |
40+
sudo apt-get update
41+
sudo apt-get install build-essential libkrb5-dev
42+
43+
- name: Install dependencies (Common)
44+
run: |
45+
# Setup tox
46+
pip install --upgrade pip
47+
pip install tox tox-gh-actions codecov
48+
49+
- name: Run Tests
50+
run: |
51+
tox
52+
codecov
53+
54+
55+
gh-pages:
56+
name: "Build Documentation"
57+
runs-on: ubuntu-latest
58+
needs: test
59+
if: startsWith(github.ref, 'refs/tags/') # run only on tagged commits
60+
61+
steps:
62+
- name: Checkout repository
63+
uses: actions/checkout@v2
64+
65+
- name: Set up Python
66+
uses: actions/setup-python@v2
67+
with:
68+
python-version: 3.6
69+
70+
- name: Setup environment
71+
run: |
72+
mv doc docs
73+
sudo apt-get install build-essential
74+
pip install sphinx six
75+
76+
- name: Check documentation
77+
uses: ammaraskar/sphinx-problem-matcher@master
78+
79+
- name: Build documentation
80+
run: sphinx-build -Ean -b html -j auto -D todo_include_todos=0 ./docs ./docs/_build/html
81+
82+
- name: Archive artifacts
83+
uses: actions/upload-artifact@v2
84+
with:
85+
name: html-docs
86+
path: ./docs/_build/html
87+
88+
build:
89+
name: "Build Package"
90+
runs-on: ubuntu-latest
91+
needs: test
92+
if: startsWith(github.ref, 'refs/tags/') # run only on tagged commits
93+
94+
steps:
95+
- name: Checkout repository
96+
uses: actions/checkout@v2
97+
98+
- name: Setup Python
99+
uses: actions/setup-python@v2
100+
101+
- name: Install dependencies
102+
run: |
103+
pip install --upgrade pip
104+
pip install setuptools wheel twine
105+
106+
- name: Build Package
107+
run: |
108+
python setup.py sdist bdist_wheel
109+
110+
- name: Archive artifacts
111+
# Archive distribution files for use by auto (or manual) PyPI upload
112+
uses: actions/upload-artifact@v2
113+
with:
114+
name: pypi-dist
115+
path: ./dist
116+
117+
publish:
118+
name: "Publish"
119+
runs-on: ubuntu-latest
120+
needs: [gh-pages, build]
121+
steps:
122+
- name: Create Release
123+
uses: softprops/action-gh-release@v1
124+
with:
125+
draft: true
126+
body: "Test Release"
127+
128+
- name: Download a Documentation
129+
uses: actions/download-artifact@v2
130+
with:
131+
name: html-docs
132+
133+
- name: Display structure of downloaded files
134+
run: ls -R
135+
136+
# - name: Upload Documentation
137+
# uses: crazy-max/ghaction-github-pages@v2
138+
# with:
139+
# target_branch: gh-pages
140+
# build_dir: ./docs/_build/_html
141+
142+
# - name: Publish to PyPI
143+
# uses: pypa/gh-action-pypi-publish@release/v1
144+
# with:
145+
# user: __token__
146+
# password: ${{ secrets.PYPI_API_TOKEN }}
147+
# verbose: true
148+

.github/workflows/codeql-analysis.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: "Security Scan"
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ master ]
9+
schedule:
10+
- cron: '43 20 * * 4'
11+
12+
jobs:
13+
analyze:
14+
name: Analyze
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
# Require to update security info on GH repo
19+
security-events: write
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
language: [ 'python' ]
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v2
29+
30+
# Initializes the CodeQL tools for scanning.
31+
- name: Initialize CodeQL
32+
uses: github/codeql-action/init@v1
33+
with:
34+
languages: python
35+
36+
- name: Perform CodeQL Analysis
37+
uses: github/codeql-action/analyze@v1

.travis.yml

Lines changed: 0 additions & 92 deletions
This file was deleted.

tests/unit/test_misc_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ def test_list_packages():
1313

1414
# We know that these packages should always be present
1515
assert any(re.match('requests==.*', p) for p in packages)
16-
assert any(re.match('sasctl==.*', p) for p in packages)
16+
assert any(re.match('sasctl.*', p) for p in packages) # sasctl may be installed from disk so no '=='
1717
assert any(re.match('pytest==.*', p) for p in packages)

tox.ini

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,19 @@
1212

1313

1414
[tox]
15-
envlist = py36-clean
16-
17-
py36-flake8
18-
19-
py{27,34,35,36,37}-tests
15+
envlist = py{27,34,35,36,37,38,39}-tests
2016

2117
# Allow execution even if all Python versions are not present
2218
skip_missing_interpreters = {env:TOX_SKIP_MISSING_INTERPRETERS:True}
2319

24-
20+
# Required by tox-gh-actions GH action. Maps GH Python runtime to tox envlist.
21+
[gh-actions]
22+
python =
23+
3.5: py35
24+
3.6: py36
25+
3.7: py37
26+
3.8: py38
27+
3.9: py39
2528

2629
[testenv]
2730
skip_install =
@@ -77,7 +80,7 @@ passenv =
7780

7881
commands =
7982
clean: coverage erase
80-
flake8: flake8 {posargs:src/sasctl}
83+
# flake8: flake8 {posargs:src/sasctl}
8184
tests: {posargs:py.test --cov={envsitepackagesdir}/sasctl --cov-report= }
8285
codecov: codecov -e TOXENV
8386
doc: sphinx-build -Ean -b html -j auto ./doc ./doc/_build/html

0 commit comments

Comments
 (0)
0