mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-04 18:57:44 +00:00
add code security check CI and dependbot (#3)
* update code * init structure * add requirements and fix CI --------- Co-authored-by: xuyang1 <xuyang1@microsoft.com>
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
concurrency:
|
||||
cancel-in-progress: true
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
jobs:
|
||||
ci:
|
||||
if: ${{ !cancelled() && ! failure() }}
|
||||
needs: dependabot
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
cache: pip
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- run: env | sort
|
||||
- run: make dev
|
||||
- env:
|
||||
AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT: ${{ secrets.AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT }}
|
||||
AZURE_DOCUMENT_INTELLIGENCE_KEY: ${{ secrets.AZURE_DOCUMENT_INTELLIGENCE_KEY }}
|
||||
CHAT_AZURE_API_BASE: ${{ secrets.CHAT_AZURE_API_BASE }}
|
||||
CHAT_AZURE_API_VERSION: ${{ secrets.CHAT_AZURE_API_VERSION }}
|
||||
CHAT_MAX_TOKENS: ${{ secrets.CHAT_MAX_TOKENS }}
|
||||
CHAT_MODEL: ${{ secrets.CHAT_MODEL }}
|
||||
CHAT_OPENAI_API_KEY: ${{ secrets.CHAT_OPENAI_API_KEY }}
|
||||
CHAT_TEMPERATURE: ${{ secrets.CHAT_TEMPERATURE }}
|
||||
CONTINOUS_MODE: ${{ secrets.CONTINOUS_MODE }}
|
||||
EMBEDDING_AZURE_API_BASE: ${{ secrets.CHAT_AZURE_API_BASE }}
|
||||
EMBEDDING_AZURE_API_VERSION: ${{ secrets.CHAT_AZURE_API_VERSION }}
|
||||
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||
EMBEDDING_OPENAI_API_KEY: ${{ secrets.CHAT_OPENAI_API_KEY }}
|
||||
MAX_RETRY: ${{ secrets.MAX_RETRY }}
|
||||
RETRY_WAIT_SECONDS: ${{ secrets.RETRY_WAIT_SECONDS }}
|
||||
USE_AZURE: ${{ secrets.USE_AZURE }}
|
||||
name: lint test docs and build
|
||||
run: make lint test docs build
|
||||
strategy:
|
||||
matrix:
|
||||
python-version:
|
||||
- '3.8'
|
||||
- '3.9'
|
||||
- '3.10'
|
||||
- '3.11'
|
||||
dependabot:
|
||||
if: ${{ github.actor == 'dependabot[bot]' && startsWith(github.head_ref, 'dependabot/pip/') }}
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.head_ref }}
|
||||
- name: Set up Git
|
||||
run: |
|
||||
git config --global user.name github-actions
|
||||
git config --global user.email github-actions@github.com
|
||||
- name: Set up Python with multiple versions.
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
cache: pip
|
||||
python-version: |
|
||||
3.8
|
||||
3.9
|
||||
3.10
|
||||
3.11
|
||||
- name: Install pipenv using pipx
|
||||
run: pipx install pipenv
|
||||
- name: Generate constraints for all supported Python versions
|
||||
run: |
|
||||
CI= PYTHON_VERSION=3.8 make constraints
|
||||
CI= PYTHON_VERSION=3.9 make constraints
|
||||
CI= PYTHON_VERSION=3.10 make constraints
|
||||
CI= PYTHON_VERSION=3.11 make constraints
|
||||
- name: Push changes if applicable
|
||||
run: |
|
||||
if [[ -n `git status --porcelain` ]]; then
|
||||
git commit -a -m "build: Update constraints for dependabot."
|
||||
git push
|
||||
fi
|
||||
name: CI
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
@@ -0,0 +1,17 @@
|
||||
concurrency:
|
||||
cancel-in-progress: true
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
jobs:
|
||||
documentation-links:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: readthedocs/actions/preview@v1
|
||||
with:
|
||||
project-slug: fincov2
|
||||
name: Read the Docs Pull Request Preview
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- opened
|
||||
permissions:
|
||||
pull-requests: write
|
||||
@@ -0,0 +1,91 @@
|
||||
jobs:
|
||||
package:
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
cache: pip
|
||||
python-version: '3.8'
|
||||
- run: env | sort
|
||||
- run: make dev-package
|
||||
- run: make build
|
||||
- env:
|
||||
TWINE_NON_INTERACTIVE: true
|
||||
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
|
||||
TWINE_USERNAME: ${{ vars.TWINE_USERNAME != '' && vars.TWINE_USERNAME || '__token__' }}
|
||||
run: make upload
|
||||
pages-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
cache: pip
|
||||
python-version: '3.8'
|
||||
- run: env | sort
|
||||
- run: make dev-docs
|
||||
- run: make docs
|
||||
- name: Upload changelog
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: changelog
|
||||
path: docs/changelog.md
|
||||
- name: Upload pages artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: public
|
||||
pages-deploy:
|
||||
needs: release
|
||||
permissions:
|
||||
id-token: write
|
||||
pages: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- id: deployment
|
||||
name: Deploy to GitHub Pages
|
||||
uses: actions/deploy-pages@v4
|
||||
release:
|
||||
needs: pages-build
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install git-changelog using pipx
|
||||
run: pipx install git-changelog
|
||||
- name: Remove changelog to avoid file already exists error
|
||||
run: rm -v docs/changelog.md
|
||||
- name: Download changelog
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: changelog
|
||||
path: docs/
|
||||
- name: Prepare release notes
|
||||
run: make release-notes > release-notes.md
|
||||
- id: prerelease
|
||||
name: Determine prerelease
|
||||
run: |
|
||||
if [[ "${{ github.ref }}" =~ (a|b|rc)(0|[1-9][0-9]*)?$ ]]; then
|
||||
echo "is_prerelease=true" > $GITHUB_OUTPUT
|
||||
else
|
||||
echo "is_prerelease=false" > $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Create GitHub release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
body_path: release-notes.md
|
||||
prerelease: ${{ steps.prerelease.outputs.is_prerelease }}
|
||||
name: Release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v?[0-9]+.[0-9]+.[0-9]+
|
||||
- v?[0-9]+.[0-9]+.[0-9]+-?a[0-9]*
|
||||
- v?[0-9]+.[0-9]+.[0-9]+-?b[0-9]*
|
||||
- v?[0-9]+.[0-9]+.[0-9]+-?rc[0-9]*
|
||||
Reference in New Issue
Block a user