Skip to content

Commit

Permalink
add build and pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhiyuanChen committed Mar 23, 2024
1 parent 0db1adb commit 1080588
Show file tree
Hide file tree
Showing 7 changed files with 748 additions and 0 deletions.
1 change: 1 addition & 0 deletions .codespell-whitelist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
datas
7 changes: 7 additions & 0 deletions .github/merge_rules.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- name: merge
patterns:
- chanfig/**
approved_by:
- ZhiyuanChen
mandatory_checks_name:
- push
137 changes: 137 additions & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: push
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
cache: "pip"
- uses: pre-commit/[email protected]
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install dependencies
run: pip install -r requirements.txt && pip install -e .
- name: Install dependencies for testing
run: pip install pytest pytest-cov torch
- name: pytest
run: pytest --cov=materialx --cov-report=xml --cov-report=html .
- name: Upload coverage report for documentation
uses: actions/upload-artifact@v3
with:
name: coverage
path: htmlcov
retention-days: 5
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage reports to Codacy
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.xml
pages:
if: startsWith(github.event.ref, 'refs/tags/v') || contains(fromJson('["refs/heads/master", "refs/heads/main"]'), github.ref)
needs: [test]
environment: github-pages
runs-on: ubuntu-latest
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- uses: actions/cache@v3
with:
key: ${{ github.ref }}
path: .cache
- run: pip install -r docs/requirements.txt
- name: Download coverage report
uses: actions/download-artifact@v3
with:
name: coverage
path: htmlcov
- run: mkdocs build -v -f docs/mkdocs.yml
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/master' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/site
release:
if: startsWith(github.event.ref, 'refs/tags/v')
needs: [lint, test]
environment: pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
cache: "pip"
- name: Install dependencies for building
run: pip install wheel setuptools_scm
- name: build package
run: python setup.py sdist bdist_wheel
- name: create release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
dist/*
- name: publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
develop:
if: contains(fromJson('["refs/heads/master", "refs/heads/main"]'), github.ref)
needs: [lint, test]
environment: pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.x
cache: "pip"
- name: Install dependencies for building
run: pip install wheel setuptools_scm
- name: build package
run: python setup.py sdist bdist_wheel
- name: create release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
files: |
dist/*
# - name: publish to Test PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
Loading

0 comments on commit 1080588

Please sign in to comment.