Skip to content

Commit 6baf853

Browse files
committed
Added github actions
1 parent 7e79e7a commit 6baf853

File tree

4 files changed

+184
-0
lines changed

4 files changed

+184
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
schedule:
16+
- cron: '0 12 * * 1'
17+
18+
jobs:
19+
analyze:
20+
name: Analyze
21+
runs-on: ubuntu-latest
22+
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
language: [ 'python' ]
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v2
31+
32+
# Initializes the CodeQL tools for scanning.
33+
- name: Initialize CodeQL
34+
uses: github/codeql-action/init@v1
35+
with:
36+
languages: ${{ matrix.language }}
37+
38+
- name: Perform CodeQL Analysis
39+
uses: github/codeql-action/analyze@v2

.github/workflows/gh_pages.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish Github Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
defaults:
8+
run:
9+
working-directory: ./docs
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-20.04
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
with:
19+
submodules: true # Fetch Hugo themes (true OR recursive)
20+
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
21+
22+
23+
- name: Setup Hugo
24+
uses: peaceiris/actions-hugo@v2
25+
with:
26+
hugo-version: '0.87.0'
27+
extended: true
28+
29+
- name: Build
30+
run: hugo --minify
31+
32+
- name: Deploy
33+
uses: peaceiris/actions-gh-pages@v3
34+
if: ${{ github.ref == 'refs/heads/main' }}
35+
with:
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
publish_dir: ./docs/public
38+
publish_branch: public_docs_v1

.github/workflows/onpush.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: build
2+
on:
3+
pull_request:
4+
types: [ opened, synchronize ]
5+
push:
6+
branches: [ main ]
7+
8+
9+
jobs:
10+
test-and-results:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
max-parallel: 1
14+
matrix:
15+
python-version: ['3.9']
16+
os: [ ubuntu-latest ]
17+
18+
steps:
19+
- uses: actions/checkout@v1
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
cache: 'pip' # caching pip dependencies
26+
cache-dependency-path: setup.py
27+
28+
- name: Install pip
29+
run: python -m pip install --upgrade pip
30+
31+
- name: Install package and dependencies
32+
run: pip install -U -e ".[dev]"
33+
34+
- name: Install coverage
35+
run: pip install coverage
36+
37+
- name: Lint
38+
run: flake8
39+
40+
- name: Run Unit Tests
41+
run: python -m coverage run
42+
43+
- name: Publish test coverage
44+
if: startsWith(matrix.os,'ubuntu')
45+
uses: codecov/codecov-action@v3
46+
with:
47+
token: ${{ secrets.CODECOV_TOKEN }}
48+
env_vars: OS,PYTHON
49+
fail_ci_if_error: true
50+
flags: unittests
51+
name: codecov-umbrella
52+
path_to_write_report: ./coverage/codecov_report.txt
53+
verbose: true
54+

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # only release a versioned tag, such as v.X.Y.Z
7+
8+
jobs:
9+
release:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
max-parallel: 1
13+
matrix:
14+
python-version: [ 3.9 ]
15+
os: [ ubuntu-latest ]
16+
17+
steps:
18+
- uses: actions/checkout@v1
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
cache: 'pip' # caching pip dependencies
25+
cache-dependency-path: setup.py
26+
27+
- name: Install pip
28+
run: python -m pip install --upgrade pip
29+
30+
- name: Install dependencies
31+
run: pip install -U -e ".[dev]"
32+
33+
- name: Build dist
34+
run: pip wheel -w dist . --no-deps
35+
36+
- name: Publish a Python distribution to PyPI
37+
uses: pypa/gh-action-pypi-publish@release/v1
38+
with:
39+
user: __token__
40+
password: ${{ secrets.PYPI_API_TOKEN }}
41+
repository_url: https://test.pypi.org/legacy/
42+
43+
- name: Create Release
44+
uses: actions/create-release@v1
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions
47+
with:
48+
tag_name: ${{ github.ref }}
49+
release_name: Release ${{ github.ref }}
50+
body: |
51+
Release for version ${{ github.ref }}. Please refer to CHANGELOG.md for detailed information.
52+
draft: false
53+
prerelease: false

0 commit comments

Comments
 (0)