added pypi publication CI and remove formatting CI

pull/394/head
FrankLeeeee 2022-02-28 07:17:37 +00:00 committed by Frank Lee
parent b105371ace
commit 115bcc0b41
2 changed files with 26 additions and 39 deletions

View File

@ -49,42 +49,3 @@ jobs:
pytest tests pytest tests
env: env:
DATA: /data/scratch/cifar-10 DATA: /data/scratch/cifar-10
format_check:
name: Format Check
if: github.event.pull_request.draft == false && github.base_ref == 'main' && github.head_ref == 'develop' && github.event.pull_request.base.repo.full_name == 'hpcaitech/ColossalAI'
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: autoyapf
id: autoyapf
uses: mritunjaysharma394/autoyapf@v2
with:
args: --style google --recursive --in-place .
- name: Check for modified files
id: git-check
run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)
- name: Push changes
if: steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "Automated autoyapf fixes"
- name: Create Pull Request
# if: steps.format.outputs.has-changes == 'true'
uses: peter-evans/create-pull-request@v3
with:
title: '[Bot] Automated PR to fix formatting errors'
body: |
Automated PR to fix formatting errors
committer: GitHub <noreply@github.com>
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
assignees: ${{ github.actor }}
reviewers: frankleeeee

26
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Publish to PyPI
on: workflow_dispatch
jobs:
build-n-publish:
if: (github.base_ref == 'main' || github.base_ref == 'develop') && github.repository == 'hpcaitech/ColossalAI' && contains('["FrankLeeeee", "ver217", "feifeibear", "kurisusnowdeng"]', github.actor)
name: Build and publish Python 🐍 distributions 📦 to PyPI or Test PyPI
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
# publish to PyPI if executed on the main branch
# publish to Test PyPI if executed on the develop branch
- name: Publish package to Test PyPI
if: github.base_ref == 'develop'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
- name: Publish package to PyPI
if: github.base_ref == 'main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}