Skip to content

Commit

Permalink
Merge pull request #6 from Kitware/configure-ci
Browse files Browse the repository at this point in the history
Configure ci and tests and fix formats
  • Loading branch information
finetjul authored Nov 27, 2024
2 parents 8e36edc + 324324a commit f3f2ee7
Show file tree
Hide file tree
Showing 21 changed files with 11,508 additions and 23,592 deletions.
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[codespell]
skip = trame_gwc/module/serve/**
skip = **/package-lock.json
9 changes: 9 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[flake8]

# Just assume black did a good job with the line lengths
ignore =
E501

per-file-ignores =
# These directories will always contain "from ... import *"
trame/*:F401,F403
137 changes: 137 additions & 0 deletions .github/workflows/test_and_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Test and Release

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: "3.10"

- uses: actions/setup-node@v3
with:
node-version: "16"

- name: Install Node.js dependencies
run: npm install
working-directory: ./vue-components

# Install and run pre-commit
- run: |
pip install pre-commit
pre-commit install
pre-commit run --all-files
pytest:
name: Pytest ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
config:
- {
name: "Linux",
os: ubuntu-latest
}
- {
name: "MacOSX",
os: macos-latest
}
- {
name: "Windows",
os: windows-latest
}

defaults:
run:
shell: bash

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install and Run Tests
run: |
pip install ".[dev]"
pytest -s ./tests
test-npm-build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set Up Node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Build Vue Components
run: |
cd vue-components
npm ci
npm run build
release:
needs: [
pre-commit,
pytest,
test-npm-build,
]
runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set Up Node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Build Vue Components
run: |
cd vue-components
npm ci
npm run build
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel build python-semantic-release
- name: Python Semantic Release
id: release
uses: relekang/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
with:
password: ${{ secrets.PYPI_API_TOKEN }}

- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@main
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
entry: black --check

- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8

- repo: local
hooks:
- id: npm-lint
name: Run NPM Lint in vue-components
files: ^vue-components/*
entry: sh -c 'cd vue-components && npm run lint'
language: system
Loading

0 comments on commit f3f2ee7

Please sign in to comment.