-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MRG: Merge pull request #109 from octue/devops/add-code-scanning
Enable code scanning
- Loading branch information
Showing
7 changed files
with
101 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'python' ] | ||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] | ||
# Use only 'java' to analyze code written in Java, Kotlin or both | ||
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both | ||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
|
||
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs | ||
# queries: security-extended,security-and-quality | ||
|
||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v2 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun | ||
|
||
# If the Autobuild fails above, remove it and uncomment the following three lines. | ||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. | ||
|
||
# - run: | | ||
# echo "Run, Build Application using script" | ||
# ./location_of_script_within_repo/buildscript.sh | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 | ||
with: | ||
category: "/language:${{matrix.language}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,25 +9,17 @@ name: python-ci | |
on: [push] | ||
|
||
jobs: | ||
|
||
check-semantic-version: | ||
if: "!contains(github.event.head_commit.message, 'skipci')" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
# Set fetch-depth to 0 to fetch all tags (necessary for git-mkver to determine the correct semantic version). | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v2 | ||
- name: Install git-mkver | ||
run: | | ||
curl -L https://github.com/idc101/git-mkver/releases/download/v1.2.1/git-mkver-linux-amd64-1.2.1.tar.gz \ | ||
| tar xvz \ | ||
&& sudo mv git-mkver /usr/local/bin | ||
- name: Install semantic version checker | ||
run: pip install git+https://github.com/octue/conventional-commits | ||
- name: Check version | ||
run: check-semantic-version setup.py | ||
- uses: octue/[email protected] | ||
with: | ||
path: setup.py | ||
breaking_change_indicated_by: minor | ||
|
||
run-tests: | ||
if: "!contains(github.event.head_commit.message, 'skipci')" | ||
|
@@ -39,44 +31,51 @@ jobs: | |
python: [3.8] | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Install tox | ||
run: pip install tox | ||
|
||
- name: Run tests | ||
run: tox | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
file: coverage.xml | ||
files: coverage.xml | ||
fail_ci_if_error: true | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
publish: | ||
if: "!contains(github.event.head_commit.message, 'skipci')" | ||
runs-on: ubuntu-latest | ||
needs: [check-semantic-version, run-tests] | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Make package | ||
run: | | ||
python3 -m pip install --upgrade setuptools wheel | ||
python3 setup.py sdist bdist_wheel | ||
- name: Test package is publishable with PyPI test server | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
skip_existing: true | ||
|
||
- name: Publish latest package to PyPI | ||
if: contains(github.ref, 'main') | ||
uses: pypa/gh-action-pypi-publish@master | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# message headers of the commits since the last pull request merged into main. The auto generated section is enveloped | ||
# between two comments: "<!--- START AUTOGENERATED NOTES --->" and "<!--- END AUTOGENERATED NOTES --->". Anything | ||
# outside these in the description is left untouched. Auto-generated updates can be skipped for a commit if | ||
# "skip_ci_update_description" is in the commit message body. | ||
# "<!--- SKIP AUTOGENERATED NOTES --->" is added to the pull request description. | ||
|
||
name: update-pull-request | ||
|
||
|
@@ -17,19 +17,14 @@ jobs: | |
if: "!contains(github.event.pull_request.body, '<!--- SKIP AUTOGENERATED NOTES --->')" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- uses: octue/[email protected] | ||
id: pr-description | ||
with: | ||
# Set fetch-depth to 0 to fetch all commit history (necessary for compiling pull request description). | ||
fetch-depth: 0 | ||
- name: Install release note compiler | ||
run: pip install git+https://github.com/octue/conventional-commits | ||
- name: Compile new pull request description | ||
run: | | ||
echo 'PULL_REQUEST_NOTES<<EOF' >> $GITHUB_ENV | ||
echo "$(compile-release-notes PULL_REQUEST_START --pull-request-url=${{ github.event.pull_request.url }} --api-token=${{ secrets.GITHUB_TOKEN }})" >> $GITHUB_ENV | ||
echo EOF >> $GITHUB_ENV | ||
pull_request_url: ${{ github.event.pull_request.url }} | ||
api_token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Update pull request body | ||
uses: riskledger/update-pr-description@v2 | ||
with: | ||
body: ${{ env.PULL_REQUEST_NOTES }} | ||
body: ${{ steps.pr-description.outputs.pull_request_description }} | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters