Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Lint

on:
pull_request:
push:
branches:
- master
- main
- stable
- dev
paths:
- '**.py'

jobs:
lint:
if: github.head_ref != 'stable'
# if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- run: python -m pip install --upgrade pip
- run: pip install ruff black

- run: ruff check .
- run: black --check .
104 changes: 104 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Publish

on:
pull_request:
branches:
- stable
types:
- closed

jobs:
Tag:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

outputs:
new_tag: ${{ steps.tag_version.outputs.new_tag }}

steps:
############################################################
# Checkout stable branch
############################################################
- name: Checkout stable
uses: actions/checkout@v3
with:
ref: stable
fetch-depth: 0

############################################################
# Create tag
############################################################
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v5.6
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_branches: stable
tag_prefix: ""

############################################################
# Create GitHub Release
############################################################
- name: Create Release
uses: actions/create-release@v1
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

############################################################
# Generate CHANGELOG
############################################################
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3
bundler-cache: true

- name: Generate CHANGELOG
env:
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gem install github_changelog_generator
AUTH=$(echo $GITHUB_REPOSITORY | sed -e 's/\// /g' | awk '{print "--user " $1 " --project " $2}')
github_changelog_generator $AUTH --no-unreleased

############################################################
# Update _version.py
############################################################
- name: Update _version.py
env:
TAG: ${{ steps.tag_version.outputs.new_tag }}
run: |
folder=$(dirname $(find . -name _version.py))
echo "__version__ = \"$TAG\"" > $folder/_version.py

############################################################
# Commit updated files
############################################################
- name: Commit files
run: |
git config --local user.email "joan.herisson@univ-evry.fr"
git config --local user.name "breakthewall"
git add -A
git commit -m "chore(release): update changelog and version" || echo "No changes to commit"

############################################################
# Push back to stable
############################################################
- name: Push changes to stable
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: stable

############################################################
# Update main branch
############################################################
- name: Update main branch
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
81 changes: 0 additions & 81 deletions .github/workflows/tag.yml

This file was deleted.

51 changes: 27 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,43 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Tests

on:

pull_request:
push:
branches: [ main, master, dev ]
branches:
- master
- main
- stable
paths:
- '**.py'
pull_request:
branches: [ main, master ]

jobs:
test:
if: github.head_ref != 'stable'
# if: github.actor != 'github-actions[bot]'
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

Test:

runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: ["ubuntu", "macos", "windows"]
defaults:
run:
shell: bash -l {0}
os: [ubuntu-latest, macos-latest, windows-latest]

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

- name: Deploying miniconda
uses: conda-incubator/setup-miniconda@v2
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
activate-environment: ci-env
environment-file: environment.yaml
activate-environment: test
- name: Building & Testing conda package
run: |
conda install -y python pytest
python -m pytest
auto-activate-base: false
use-mamba: true
mamba-version: "*"

- name: Add dev dependencies
shell: bash -l {0}
run: conda env update -n ci-env -f environment-dev.yaml

- name: Run tests
shell: bash -l {0}
run: python -m pytest
Loading
Loading