Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to pixi and support windows #1

Merged
merged 28 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .copier-answers.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@

*.{py,yaml,yml,sh} text eol=lf
*.bat text eol=crlf

pixi.lock linguist-language=YAML linguist-generated=true
3 changes: 0 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

5 changes: 0 additions & 5 deletions .github/assets/.condarc

This file was deleted.

8 changes: 0 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
version: 2
registries:
github:
type: git
url: https://github.com
username: x-access-token
password: ${{ secrets.DEPENDABOT_CONTENT_PAT }}
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
reviewers:
- quantco/ci
registries:
- github
groups:
gh-actions:
patterns:
Expand Down
37 changes: 9 additions & 28 deletions .github/workflows/array-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,36 @@ name: Array API coverage tests
on:
push:
branches:
- "*"
schedule:
- cron: "0 8 * * *"
- main
pull_request:

# Automatically stop old builds on the same branch/PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -el {0}

env:
QUETZ_API_KEY: ${{ secrets.QUETZ_API_KEY }}

jobs:
array-api-tests:
# Run if the commit message contains 'run array-api tests' or if the job is triggered on schedule
if: >-
contains(github.event.head_commit.message, 'run array-api tests') ||
github.event_name == 'schedule'
name: "Array API test"
name: Array API test
timeout-minutes: 90
runs-on: ubuntu-latest-16core
steps:
- name: Checkout branch
uses: actions/checkout@v4.1.1
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
submodules: "recursive"
- name: Set up Conda env
uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822
with:
condarc-file: .github/assets/.condarc
environment-file: environment.yml
create-args: >-
python=3.12
pytest-md
pytest-emoji
submodules: recursive
- name: Set up pixi
uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659
- name: Install repository
run: python -m pip install --no-build-isolation --no-deps --disable-pip-version-check -e .
run: pixi run postinstall
- name: Run Array API tests
env:
ARRAY_API_TESTS_MODULE: ndonnx
run: |
pushd api-coverage-tests
pytest --ci --max-examples 2 array_api_tests/ --json-report --json-report-file=api-coverage-tests.json -n auto -vv --skips-file=../skips.txt
pixi run pytest --ci --max-examples 2 array_api_tests/ --json-report --json-report-file=api-coverage-tests.json -n auto -vv --skips-file=../skips.txt
popd
- name: Upload Array API tests report
uses: actions/upload-artifact@v4
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build
on:
push:
branches:
- main
tags:
- "*"
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Set up pixi
uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659
with:
environments: build
- name: Build project
run: pixi run -e build build-wheel
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: artifact
path: dist/*

release:
name: Publish package
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
runs-on: ubuntu-latest
permissions:
id-token: write
environment: pypi
adityagoel4512 marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- name: Publish package on TestPyPi
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish package on PyPi
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450
Comment on lines +43 to +48
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to create a first package manually and upload it to testpypi and pypi.
Also, you need to add trusted publishers s.t. auth via OIDC works

image

84 changes: 26 additions & 58 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,88 +1,56 @@
name: CI
on: [push]
on:
push:
branches:
- main
pull_request:

# Automatically stop old builds on the same branch/PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -el {0}

env:
QUETZ_API_KEY: ${{ secrets.QUETZ_API_KEY }}

jobs:
pre-commit-checks:
name: Pre-commit Checks
timeout-minutes: 30
runs-on: ubuntu-latest
env:
PRE_COMMIT_USE_MICROMAMBA: 1
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
# needed for 'pre-commit-mirrors-insert-license'
fetch-depth: 0
- name: Run pre-commit-conda
uses: quantco/pre-commit-conda@v1
mypy-type-checks:
name: Mypy Type Checks
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up pixi
uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Set up Conda env
uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822
with:
condarc-file: .github/assets/.condarc
environment-file: environment.yml
cache-environment: true
- name: Install repository
run: python -m pip install --no-build-isolation --no-deps --disable-pip-version-check -e .
- name: Run mypy
run: mypy .
environments: default lint
- name: pre-commit
run: pixi run pre-commit-run --color=always --show-diff-on-failure

unit-tests:
name: Unit Tests - ${{ matrix.os == 'ubuntu-latest-8core' && 'Linux' || 'Windows' }} - Python ${{ matrix.python-version }}
name: pytest
timeout-minutes: 30
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
os:
- ubuntu-latest
- macos-latest
- windows-latest
adityagoel4512 marked this conversation as resolved.
Show resolved Hide resolved
environment:
- py310
- py311
- py312
steps:
- name: Checkout branch
uses: actions/checkout@v4.1.1
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Set up Conda env
uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822
- name: Set up pixi
uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659
with:
condarc-file: .github/assets/.condarc
environment-file: environment.yml
create-args: >-
python=${{ matrix.python-version }}
pytest-md
pytest-emoji
environments: ${{ matrix.environment }}
- name: Install repository
run: python -m pip install --no-build-isolation --no-deps --disable-pip-version-check -e .
- name: Checkout Quantco/pytest-action
uses: actions/checkout@v4.1.1
with:
repository: Quantco/pytest-action
ref: v2
token: ${{ secrets.FQ_GH_TOKEN }}
path: .github/pytest-action
- name: Run unittests
uses: quantco/pytest-action@v2
with:
report-title: "Unit tests Linux - Python ${{ matrix.PYTHON_VERSION }}"
run: pixi run -e ${{ matrix.environment }} postinstall
- name: Run pytest
run: pixi run -e ${{ matrix.environment }} test-coverage --color=yes
58 changes: 15 additions & 43 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
name: Documentation
on: [push]
on:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -el {0}
env:
QUETZ_API_KEY: ${{ secrets.QUETZ_API_KEY }}

jobs:
build:
Expand All @@ -20,49 +19,22 @@ jobs:
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Setup conda
uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822
- name: Set up pixi
uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659
with:
condarc-file: .github/assets/.condarc
environment-file: environment.yml
environments: docs
- name: Install package
run: python -m pip install --no-build-isolation --no-deps --disable-pip-version-check -e .
run: pixi run -e docs postinstall
- name: Build docs
run: cd docs && make html
run: pixi run docs
- name: Upload html
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/_build/html

upload:
name: Upload Docs
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Download html
uses: actions/download-artifact@v4
with:
name: docs
- name: Authenticate with GCP
uses: google-github-actions/auth@v2
- name: Publish docs
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e
with:
workload_identity_provider: projects/610600912298/locations/global/workloadIdentityPools/doqker-devel-github-actions-pool/providers/github-actions-provider
service_account: sa-github-actions@doqker-devel.iam.gserviceaccount.com
token_format: access_token
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v2
- name: Set ref (release)
if: startsWith(github.ref, 'refs/tags/')
run: echo "docs-path=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Set ref (main)
if: github.ref == 'refs/heads/main'
run: echo "docs-path=latest" >> $GITHUB_ENV
- name: Set ref (pull_request)
if: startsWith(github.ref, 'refs/heads/') && github.ref != 'refs/heads/main'
run: echo "docs-path=${{ github.ref }}" >> $GITHUB_ENV
- name: Upload to Google Cloud Storage
run: gcloud storage cp -r * gs://qc-github-artifacts/${{ github.repository }}/${{ env.docs-path }}/
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
22 changes: 0 additions & 22 deletions .github/workflows/package.yml

This file was deleted.

Loading
Loading