132 lines
3.7 KiB
YAML
132 lines
3.7 KiB
YAML
name: Release
|
|
|
|
# Controls when the action will run.
|
|
on:
|
|
# Triggers the workflow on push or pull request events but only for the master branch
|
|
push:
|
|
tags:
|
|
- "*"
|
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
inputs:
|
|
build-items:
|
|
description: 'Items to be build'
|
|
required: true
|
|
default: 'all'
|
|
type: choice
|
|
options:
|
|
- all
|
|
- windows
|
|
- linux
|
|
- all_incl_release
|
|
|
|
jobs:
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: ['3.8', '3.9', '3.10', '3.12']
|
|
fail-fast: false
|
|
|
|
steps:
|
|
- name: Checkout LFS objects
|
|
run: git clone https://${{secrets.GITHUB_TOKEN}}@gitea.psi.ch/${{ github.repository }}.git .
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install pytest
|
|
pip install -r requirements.txt
|
|
|
|
- name: Test with pytest
|
|
run: |
|
|
python -m pytest tests
|
|
|
|
|
|
build-ubuntu-latest:
|
|
needs: [test]
|
|
runs-on: ubuntu-latest
|
|
if: ${{ (github.event_name != 'workflow_dispatch') || (contains(fromJson('["all", "linux", "all_incl_release"]'), github.event.inputs.build-items)) }}
|
|
permissions:
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install build
|
|
pip install -r requirements.txt
|
|
pip install wheel build twine
|
|
- name: Build PyPI package
|
|
run: |
|
|
python3 -m build
|
|
# - name: Archive distribution
|
|
# uses: actions/upload-artifact@v3
|
|
# with:
|
|
# name: linux-dist
|
|
# path: |
|
|
# dist/*.tar.gz
|
|
- name: Upload to PyPI
|
|
run: |
|
|
twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }} --skip-existing
|
|
|
|
build-windows:
|
|
needs: [test]
|
|
runs-on: windows-latest
|
|
if: ${{ (github.event_name != 'workflow_dispatch') || (contains(fromJson('["all", "windows", "all_incl_release"]'), github.event.inputs.build-items)) }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: 3.12
|
|
- name: Install dependencies
|
|
run: |
|
|
C:\Miniconda\condabin\conda.bat env update --file conda_windows.yml --name base
|
|
C:\Miniconda\condabin\conda.bat init powershell
|
|
- name: Build with pyinstaller
|
|
run: |
|
|
pyinstaller windows_build.spec
|
|
cd dist\eos
|
|
Compress-Archive -Path .\* -Destination ..\..\eos.zip
|
|
- name: Archive distribution
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: windows-dist
|
|
path: |
|
|
eos.zip
|
|
|
|
release:
|
|
if: ${{ (github.event_name != 'workflow_dispatch') || (contains(fromJson('["all_incl_release"]'), github.event.inputs.build-items)) }}
|
|
runs-on: ubuntu-latest
|
|
needs: [build-ubuntu-latest, build-windows]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
fetch-tags: true
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: linux-dist
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: windows-dist
|
|
- name: get latest version tag
|
|
run: echo "RELEASE_TAG=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV
|
|
- uses: ncipollo/release-action@v1
|
|
with:
|
|
artifacts: "amor*.tar.gz,*.zip"
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
allowUpdates: true
|
|
tag: ${{ env.RELEASE_TAG }}
|