Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyasvinaya committed Jan 22, 2024
1 parent ee73c39 commit 392e5ce
Show file tree
Hide file tree
Showing 38 changed files with 1,035 additions and 321 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Test for build scripts
on:
push: # ci work when pushing master branch
branches:
- master
paths:
- "scripts/install_qtsit_conda.ps1"
- "scripts/install_qtsit_conda.sh"
- "requirements/**"
pull_request: # ci work when creating a PR to master branch
branches:
- master
paths:
- "scripts/install_qtsit_conda.ps1"
- "scripts/install_qtsit_conda.sh"
- "requirements/**"
jobs:
bash-build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.9']
steps:
- uses: actions/checkout@v4
- name: Cache pip modules for Linux
if: runner.os == 'Linux'
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/**') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache pip modules for MacOS
if: runner.os == 'macOS'
uses: actions/cache@v3
with:
path: ~/Library/Caches/pip
key: ${{ matrix.os }}-pip-${{ hashFiles('requirements/**') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- name: Install dependencies (failure check)
continue-on-error: true
shell: bash -l {0}
run: |
source scripts/install_qtsit_conda.sh
- name: Install all dependencies
shell: bash -l {0}
run: |
source scripts/install_qtsit_conda.sh ${{ matrix.python-version }} cpu
- name: Import Checks
shell: bash -l {0}
run: |
conda activate qtsit
python -V
python -c 'import qtsit; print("qtsit version %s" % qtsit.__version__)'
powershell-build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.9']
steps:
- uses: actions/checkout@v3
- name: Cache pip packages for Windows
uses: actions/cache@v3
with:
path: ~\AppData\Local\pip\Cache
key: ${{ matrix.os }}-pip-${{ hashFiles('env.*.yml') }}
- name: Install miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- name: Install dependencies (failure check)
continue-on-error: true
shell: pwsh
run: |
. .\scripts\install_qtsit_conda.ps1
- name: Install dependencies
shell: pwsh
run: |
. .\scripts\install_qtsit_conda.ps1 ${{ matrix.python-version }} cpu
- name: Import Checks
shell: pwsh
run: |
conda activate qtsit
python -V
python -c "import qtsit; print('qtsit version %s' % qtsit.__version__)"
46 changes: 46 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Test for documents
on:
push: # ci work when pushing master branch
branches:
- master
pull_request: # ci work when creating a PR to master branch
branches:
- master
jobs:
docs-build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.9']
steps:
- uses: actions/checkout@v3
- name: Cache pip packages for Linux
uses: actions/cache@v3
with:
path: ~/.cache/pip
# the key is used to search for cache
# hashFile(paths) return a single hash for the set of files that matches the path pattern
key: ${{ runner.os }}-pip-${{ hashFiles('**/**/docs/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies (docs)
shell: bash -l {0}
working-directory: ./docs
run: pip install -r requirements.txt
- name: Build docs
shell: bash -l {0}
working-directory: ./docs
run: make clean html
# - name: DocTest (Tutorials)
# shell: bash -l {0}
# working-directory: ./docs
# run: make doctest_tutorials
# - name: DocTest (Examples)
# shell: bash -l {0}
# working-directory: ./docs
# run: make doctest_examples
89 changes: 89 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Code Formatting

on:
push: # ci work when pushing master branch
branches:
- master
pull_request: # ci work when creating a PR to master branch
branches:
- master


jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set commit range (push to the master branch, e.g. merge)
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: echo "COMMIT_RANGE=${{ github.event.before }}.." >> $GITHUB_ENV

- name: Set commit range (pull request)
if: github.event_name == 'pull_request'
run: |
git fetch origin master
echo "COMMIT_RANGE=origin/master..." >> $GITHUB_ENV
- name: Cache pip packages for Linux
if: runner.os == 'Linux'
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/**') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Create env.yml
shell: bash
run: |
python -m pip install --upgrade pip;
pip install conda-merge;
cd requirements
conda-merge env_base.yml env_test.yml > env.yml
cd ..
cp requirements/env.yml env.yml
- name: Install all dependencies using micromamba
uses: mamba-org/setup-micromamba@main
with:
environment-file: env.yml
environment-name: qtsit
create-args: python=${{ matrix.python-version }}

- name: Install qtsit
id: install
shell: bash -l {0}
run: pip install -e .

- name: Show files modified
run: |
CHANGED_FILES=`git diff --name-only $COMMIT_RANGE || true`
echo "changed files are $CHANGED_FILES"
- name: Yapf (version 0.40.0)
id: yapf
shell: bash -l {0}
run: |
CHANGED_FILES=`git diff --name-only $COMMIT_RANGE | grep .py$ || true`
if [ -n "$CHANGED_FILES" ]; then
yapf -d $CHANGED_FILES
fi
- name: Flake8
if: ${{ (success() || failure()) && (steps.install.outcome == 'failure' || steps.install.outcome == 'success') }}
shell: bash -l {0}
run: source scripts/flake8_for_ci.sh

- name: Mypy
if: ${{ (success() || failure()) && (steps.install.outcome == 'failure' || steps.install.outcome == 'success') }}
shell: bash -l {0}
run: |
mypy -p qtsit
139 changes: 139 additions & 0 deletions .github/workflows/mini_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Test for Build
on:
push: # ci work when pushing master branch
branches:
- master
pull_request: # ci work when creating a PR to master branch
branches:
- master
jobs:
core-build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.9', '3.10', '3.11']
include:
- os: windows-latest
python-version: ['3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
# using cached dependencies to speed up workflow
# ref: https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows
- name: Cache pip modules for Linux
uses: actions/cache@v3
with:
path: ~/.cache/pip
# the key is used to search for cache
# hashFile(paths) return a single hash for the set of files that matches the path pattern
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/**') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Build qtsit
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Import checking
run: python -c "import qtsit"

test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.9', '3.10', '3.11']
include:
- os: windows-latest
python-version: ['3.9', '3.10', '3.11']
env:
OS: ${{ matrix.os }}
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set commit range (push to the master branch, e.g. merge)
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: echo "COMMIT_RANGE=${{ github.event.before }}.." >> $GITHUB_ENV
- name: Set commit range (pull request)
if: github.event_name == 'pull_request'
run: |
git fetch origin master
echo "COMMIT_RANGE=origin/master..." >> $GITHUB_ENV
- name: Cache pip packages for Linux
if: runner.os == 'Linux'
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/**') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache pip packages for MacOS
if: runner.os == 'macOS'
uses: actions/cache@v3
with:
path: ~/Library/Caches/pip
key: ${{ matrix.os }}-pip-${{ hashFiles('requirements/**') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache pip packages for Windows
if: runner.os == 'Windows'
uses: actions/cache@v3
with:
path: ~\AppData\Local\pip\Cache
key: ${{ matrix.os }}-pip-${{ hashFiles('requirements/**') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Create env.yml for python
shell: bash
run: |
python -m pip install --upgrade pip;
pip install conda-merge;
cd requirements
if [ "$(uname)" == 'Linux' ]; then
conda-merge env_base.yml env_test.yml env_ubuntu.yml > env.yml
elif [ "$(uname)" == 'Darwin' ]; then
conda-merge env_base.yml env_test.yml env_mac.yml yml > env.yml
elif [[ "$(uname)" == "MINGW64_NT"* ]]; then
conda-merge env_base.yml env_test.yml > env.yml
fi;
cd ..
cp requirements/env.yml env.yml
- name: Install all dependencies using micromamba
uses: mamba-org/setup-micromamba@main
with:
environment-file: env.yml
environment-name: qtsit
create-args: python=${{ matrix.python-version }}

pypi-build:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [core-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Publish (Nightly)
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
Loading

0 comments on commit 392e5ce

Please sign in to comment.