Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
joamatab committed Oct 21, 2023
0 parents commit 8987344
Show file tree
Hide file tree
Showing 31 changed files with 2,020 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .changelog.d/changelog_template.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% if sections[""] %}
{% for category, val in definitions.items() if category in sections[""] %}

### {{ definitions[category]['name'] }}

{% for text, values in sections[""][category].items() %}
- {{ text }} {{ values | join(', ') }}
{% endfor %}

{% endfor %}
{% else %}
No significant changes.


{% endif %}
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/" # Location of package manifests
schedule:
interval: "daily"

- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
44 changes: 44 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
change-template: '- $TITLE [#$NUMBER](https://github.com/gdsfactory/ubc2/pull/$NUMBER)'
template: |
# What's Changed
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
categories:
- title: 'Breaking'
label: 'type: breaking'
- title: 'New'
label: 'type: feature'
- title: 'Bug Fixes'
label: 'type: bug'
- title: 'Maintenance'
label: 'type: maintenance'
- title: 'Documentation'
label: 'type: docs'
- title: 'Other changes'
- title: 'Dependency Updates'
label: 'type: dependencies'
collapse-after: 5

version-resolver:
major:
labels:
- 'type: breaking'
minor:
labels:
- 'type: feature'
patch:
labels:
- 'type: bug'
- 'type: maintenance'
- 'type: docs'
- 'type: dependencies'
- 'type: security'
default: patch

exclude-labels:
- 'skip-changelog'
46 changes: 46 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Sphinx docs to gh-pages

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build-docs:
runs-on: ubuntu-latest
name: Sphinx docs to gh-pages
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Installing the library
shell: bash -l {0}
run: |
make dev
- name: make docs
run: |
make docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: "./docs/_build/html/"
deploy-docs:
needs: build-docs
permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
35 changes: 35 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release Drafter

on:
push:
branches:
- main
# pull_request:
# types: [opened, reopened, synchronize]

permissions:
contents: read

jobs:
update_release_draft:
permissions:
# write permission is required to create a github release
contents: write
# write permission is required for autolabeler
# otherwise, read permission is required at least
pull-requests: write
runs-on: ubuntu-latest
steps:
# (Optional) GitHub Enterprise requires GHE_HOST variable set
#- name: Set GHE_HOST
# run: |
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV

# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release PyPI, installers and docker container

on:
push:
tags: "v*"

jobs:
release_pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
make build
twine upload dist/*
release_environment:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
pip install .
pip freeze > requirements.txt
- name: Publish Latest Draft
run: |
gh release edit ${{ github.ref_name }} --draft=false
gh release upload ${{ github.ref_name }} requirements.txt --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests

on:
schedule:
- cron: '22 12 * * *'

jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write

steps:
- uses: actions/stale@v8
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been inactive for 60 days. Remove stale label or comment or this will be closed in 7 days.'
stale-pr-message: 'This pull request is stale because it has been inactive for 60 days. Remove stale label or comment or this will be closed in 7 days.'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
85 changes: 85 additions & 0 deletions .github/workflows/test_code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Test pre-commit, code and docs

on:
pull_request:
push:
branches:
- main

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Test pre-commit hooks
run: |
python -m pip install --upgrade pip
pip install pre-commit
pre-commit run -a
test_code:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 12
matrix:
python-version: ["3.10"]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
make dev
- name: Test with pytest
run: pytest
test_code_coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
make dev
- name: Test with pytest
run: |
pytest --cov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
test_docs:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 12
matrix:
python-version: ['3.10']
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: "pip"
cache-dependency-path: pyproject.toml
- name: Install dependencies
run: |
make dev
- name: Test documentation
run: |
make docs
Loading

0 comments on commit 8987344

Please sign in to comment.