Skip to content

dev build CI

dev build CI #32

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: dev build CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events
push:
branches:
- '*'
pull_request:
branches:
- '*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
test:
# The type of runner that the job will run on
strategy:
matrix:
python-versions: ['3.7', '3.8', '3.9', '3.10']
# github action doesn't goes well with windows due to docker support
# github action doesn't goes well with macos due to `no docker command`
#os: [ubuntu-20.04, windows-latest, macos-latest]
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-versions }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions poetry
- name: test with tox
run: tox
publish_dev_build:
# if test failed, we should not publish
needs: test
# you may need to change os below
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry tox tox-gh-actions
# declare env.package_version, env.package_version, env.package_name, env.repo_owner, env.repo_name, so you may use it in web hooks.
- name: Declare variables for convenient use
run: |
echo "package_version=`poetry version --short`.DEV.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
echo "package_name=`poetry version | awk '{print $1}'`" >> $GITHUB_ENV
echo "repo_owner=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV
echo "repo_name=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
shell: bash
- name: build documentation
run: |
poetry install -E doc
poetry run mkdocs build
git config --global user.name Docs deploy
git config --global user.email [email protected]
poetry run mike deploy -p -f --ignore "`poetry version --short`.dev"
poetry run mike set-default -p "`poetry version --short`.dev"
- uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
files: coverage.xml
- name: Build wheels and source tarball
run: |
poetry version $(poetry version --short)-dev.$GITHUB_RUN_NUMBER
poetry lock
poetry build
- name: publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN}}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: Dingtalk Robot Notify
if: always()
uses: leafney/[email protected]
env:
DINGTALK_ACCESS_TOKEN: ${{ secrets.DINGTALK_ACCESS_TOKEN }}
DINGTALK_SECRET: ${{ secrets.DINGTALK_SECRET }}
with:
msgtype: markdown
title: CI Notification | Success
text: |
### Build Success
${{ env.package_name }}.${{ env.package_version }} built successfully and published to test pypi
### Change History
Please check change history at https://${{ env.repo_owner }}.github.io/${{ env.repo_name }}/history
### Package Download
Please download the package at: https://test.pypi.org/project/${{ env.repo_name }}/