Skip to content

Commit 5f75208

Browse files
authored
chore: workflows (#2)
Added GitHub actions workflows to implement CI, check PRs against standards, scan for security vulnerabilities and to release to PyPI. Also setup dependabot to automatically update Python and GitHub actions dependencies.
1 parent dca42a5 commit 5f75208

7 files changed

Lines changed: 219 additions & 0 deletions

File tree

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# global code owners
2+
3+
* @FactSet/enterprise-sdk

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: '/'
5+
schedule:
6+
interval: daily
7+
- package-ecosystem: github-actions
8+
directory: '/'
9+
schedule:
10+
interval: daily

.github/pull_request_template.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
### Description
2+
3+
<!--
4+
Replace this comment block with detailed description detailed description
5+
of **what** is being changed and **why**.
6+
7+
Here's an example of a good change description:
8+
9+
Added the ability to notify users when a new blog post is made
10+
so that users can be made aware of new features as they become
11+
available.
12+
13+
Used the subscription module to allow users to subscribe to
14+
the various product categories that they are interested in. Emails
15+
are being sent using the smtp module, configured to use FactSet's
16+
standard smtp server.
17+
-->
18+
19+
### Links
20+
21+
<!--
22+
Replace this comment block with relevant links to project trackers,
23+
like Jira, RPD or GitHub here. Example:
24+
25+
* Fixes #1
26+
* Fixes #2
27+
-->
28+
29+
### Testing
30+
31+
<!--
32+
Replace this comment block with any testing instructions for reviewers. This is in
33+
addition to any acceptance criteria in an associated issue.
34+
-->
35+
36+
### Checklist
37+
38+
Ensure the following things have been met before requesting a review:
39+
40+
* [ ] Follows all project developer guide and coding standards.
41+
* [ ] Tests have been written for the change, when applicable.
42+
* [ ] Confidential information (credentials, auth tokens, etc...) is not included.

.github/workflows/ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
push:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-20.04
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v2
17+
18+
- name: Setup Python
19+
uses: actions/setup-python@v3
20+
with:
21+
python-version: '3.9'
22+
23+
- name: Install Poetry
24+
uses: snok/install-poetry@v1
25+
26+
- name: Install dependencies
27+
run: poetry install
28+
29+
- name: Lint
30+
run: poetry run black --check .
31+
32+
- name: Build
33+
run: poetry build
34+
35+
# the `coverage xml -i` command is needed to re-write the
36+
# coverage report with relative paths
37+
- name: Test
38+
run: |
39+
poetry run pytest --cov src --cov-report xml tests
40+
poetry run coverage xml -i
41+
42+
test:
43+
name: Test
44+
runs-on: ubuntu-20.04
45+
strategy:
46+
matrix:
47+
python-version: [3.6, 3.7, 3.8, 3.9]
48+
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@v2
52+
53+
- name: Setup python
54+
uses: actions/setup-python@v3
55+
with:
56+
python-version: '${{ matrix.python-version }}'
57+
58+
- name: Install Poetry
59+
uses: snok/install-poetry@v1
60+
61+
- name: Install dependencies
62+
run: poetry install
63+
64+
- name: Build
65+
run: poetry build
66+
67+
- name: Test
68+
run: poetry run tox
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ main ]
9+
schedule:
10+
- cron: '15 18 * * 5'
11+
12+
jobs:
13+
analyze:
14+
name: Analyze
15+
runs-on: ubuntu-20.04
16+
permissions:
17+
actions: read
18+
contents: read
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: ${{ matrix.language }}
35+
36+
- name: Autobuild
37+
uses: github/codeql-action/autobuild@v1
38+
39+
- name: Perform CodeQL Analysis
40+
uses: github/codeql-action/analyze@v1

.github/workflows/pr-checks.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Pull request checks
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
- reopened
10+
11+
jobs:
12+
check-title:
13+
name: Check title
14+
runs-on: ubuntu-20.04
15+
16+
steps:
17+
- uses: naveenk1223/action-pr-title@v1.0.0
18+
with:
19+
regex: '^(chore|demo|deprecate|docs|feat|fix|perf|refactor|revert|style|test)(\(.+\))?: .+$'
20+
max_length: 60

.github/workflows/publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
deploy:
9+
name: Deploy to package index
10+
runs-on: ubuntu-20.04
11+
env:
12+
REPOSITORY_USERNAME: ${{ secrets.PYPI_USERNAME }}
13+
REPOSITORY_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
14+
REPOSITORY_URL: ${{ secrets.PYPI_PUBLISH_URL }}
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v2
19+
20+
- name: Setup Python
21+
uses: actions/setup-python@v3
22+
with:
23+
python-version: '3.9'
24+
25+
- name: Configure Poetry
26+
run: |
27+
poetry config repositories.publish $REPOSITORY_URL
28+
poetry config http-basic.publish $REPOSITORY_USERNAME $REPOSITORY_PASSWORD
29+
30+
- name: Build
31+
run: |
32+
poetry build
33+
34+
- name: Publish
35+
run: |
36+
poetry publish -r publish

0 commit comments

Comments
 (0)