Skip to content

Commit

Permalink
Merge pull request #5 from cindytsai/fixCI
Browse files Browse the repository at this point in the history
Fix Workflow and Packaging
  • Loading branch information
cindytsai authored Feb 19, 2024
2 parents a293b85 + 2ac48aa commit f6577db
Show file tree
Hide file tree
Showing 43 changed files with 861 additions and 999 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ insert_final_newline = true
charset = utf-8
end_of_line = lf

[*.{yaml,yml}]
indent_size = 2

[*.bat]
indent_style = tab
end_of_line = crlf
Expand Down
16 changes: 14 additions & 2 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
* libyt frontend for yt version:
* yt_libyt version:
* libyt version:
* Python version:
* Operating System:

### Description
### Summary

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

### What I Did

#### Input

```
Paste the command(s) you ran and the output.
```

#### Actual Outcome

```
If there was a crash, please include the traceback here.
```

#### Expected Outcome


20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
day: "monday"
time: "09:00"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
62 changes: 36 additions & 26 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,43 @@
name: Run tests
name: Run Tests

on: [push, pull_request]
on:
- push
- pull_request
- workflow_dispatch
- workflow_call

jobs:
build:

test:
name: Test (pytest)
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8]

python:
- version: "3.7"
toxenv: "py37"
- version: "3.8"
toxenv: "py38"
- version: "3.9"
toxenv: "py39"
- version: "3.10"
toxenv: "py310"
- version: "3.11"
toxenv: "py311"
- version: "3.12"
toxenv: "py312"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f tests/test_requirements.txt ]; then python -m pip install -r tests/test_requirements.txt; fi
- name: Setup yt_idv
run: |
python -m pip install -e .
- name: Run Tests
run: pytest --html=report.html --self-contained-html
- uses: actions/upload-artifact@v2
name: Upload pytest report
with:
name: pytest-report
path: report.html
- uses: actions/checkout@v3
- uses: actions/[email protected]
with:
python-version: ${{ matrix.python.version }}
- name: Install tox
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Run pytest
run: tox -e ${{ matrix.python.toxenv }} -- --html=report.html --self-contained-html
- name: Upload pytest report
uses: actions/upload-artifact@v3
with:
name: pytest-report-${{ matrix.python.toxenv }}
path: report.html
26 changes: 0 additions & 26 deletions .github/workflows/check-manifest.yml

This file was deleted.

82 changes: 82 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '0 9 * * 1' # at 09:00am on monday

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
30 changes: 0 additions & 30 deletions .github/workflows/create-release.yml

This file was deleted.

97 changes: 68 additions & 29 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,75 @@
name: Publish Python distributions to PyPI and TestPyPI
name: Release and Publish

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
- 'v*' # ex: "v1.0"

jobs:
build-and-publish:
name: Build and Publish
runs-on: ubuntu-18.04
style_check:
name: Style Check
uses: ./.github/workflows/style-check.yml

run_tests:
name: Run Tests
uses: ./.github/workflows/build-test.yml

build_source:
name: Build Sources
runs-on: ubuntu-latest
needs:
- style_check
- run_tests
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
with:
python-version: "3.10"
- name: Install build
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Build source tarball
run: python -m build --sdist --outdir dist
- name: Upload source tarball
uses: actions/upload-artifact@v3
with:
path: ./dist/*.tar.gz

build_wheels:
name: Build Wheels
runs-on: ubuntu-latest
needs:
- style_check
- run_tests
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
with:
python-version: "3.10"
- run: python -m pip install --upgrade pip
- name: Build pure Python wheels
run: pip wheel . -w wheels/ --no-deps
- name: Upload builds
uses: actions/upload-artifact@v3
with:
path: ./wheels/*.whl

publish_to_pypi:
name: Publish to PyPI
if: startsWith(github.event.ref, 'refs/tags/v')
needs:
- build_source
- build_wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build source tarball
run: >-
python -m
build
--sdist
--outdir dist/
.
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Download source tarball and builds
uses: actions/download-artifact@v3
with:
name: artifact
path: ./dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }} # TODO: Add token in github settings
Loading

0 comments on commit f6577db

Please sign in to comment.