diff --git a/.github/workflows/merge_PR.yml b/.github/workflows/merge_PR.yml new file mode 100644 index 0000000..9c3f360 --- /dev/null +++ b/.github/workflows/merge_PR.yml @@ -0,0 +1,17 @@ +name: Pull Request Merged +on: + pull_request: + types: [closed] + +jobs: + autoupdate_minor: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install dependencies + run: | + python -c "import eos; print(eos.__version__)" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c941c7b..f55c42e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,8 +27,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.12'] - fail-fast: false + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + fail-fast: true steps: - name: Checkout LFS objects @@ -46,8 +46,32 @@ jobs: - name: Test with pytest run: | + export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest tests + release: + if: ${{ (github.event_name != 'workflow_dispatch') || (contains(fromJson('["all_incl_release"]'), github.event.inputs.build-items)) }} + runs-on: ubuntu-latest + needs: [test] + steps: + - uses: actions/checkout@v4 + - name: get latest version tag and release note + run: | + git fetch --depth=500 + this_tag=$(python -c "import eos;print('v'+eos.__version__)") + prev_tag=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) + echo "Relese tag $this_tag with changes since $prev_tag" + echo "Changes: + " > git_changes.log + git log $prev_tag..HEAD --pretty=format:"* %s" >> git_changes.log + cat git_changes.log + echo "RELEASE_TAG=$this_tag" >> $GITHUB_ENV + - name: Create Release + uses: actions/gitea-release-action@v1 + with: + name: "Amor-Eos ${{ env.RELEASE_TAG }}" + tag_name: "${{ env.RELEASE_TAG }}" + body_path: git_changes.log build-ubuntu-latest: needs: [test] @@ -69,63 +93,45 @@ jobs: - 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 + this_tag=$(python -c "import eos;print('v'+eos.__version__)") + echo "RELEASE_TAG=$this_tag" >> $GITHUB_ENV + - name: Update Release + if: ${{ (github.event_name != 'workflow_dispatch') || (contains(fromJson('["all_incl_release"]'), github.event.inputs.build-items)) }} + uses: actions/gitea-release-action@v1 + with: + name: "Amor-Eos ${{ env.RELEASE_TAG }}" + tag_name: "${{ env.RELEASE_TAG }}" + files: |- + dist/amor*.tar.gz - 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 }} +# 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: Update Release +# if: ${{ (github.event_name != 'workflow_dispatch') || (contains(fromJson('["all_incl_release"]'), github.event.inputs.build-items)) }} +# uses: actions/gitea-release-action@v1 +# with: +# name: "Amor-Eos ${{ env.RELEASE_TAG }}" +# tag_name: "${{ env.RELEASE_TAG }}" +# files: |- +# eos.zip diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 05395e5..5a85a7f 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.12'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] fail-fast: false steps: @@ -35,4 +35,5 @@ jobs: - name: Test with pytest run: | + export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest tests diff --git a/eos/__init__.py b/eos/__init__.py index 8d1c3a1..6cd02b8 100644 --- a/eos/__init__.py +++ b/eos/__init__.py @@ -2,5 +2,5 @@ Package to handle data redction at AMOR instrument to be used by __main__.py script. """ -__version__ = '3.2.2' +__version__ = '3.2.4' __date__ = '2026-02-27' diff --git a/update.md b/update.md index e7f3c6a..f058786 100644 --- a/update.md +++ b/update.md @@ -1,16 +1,16 @@ -Make new release -================ - -- Update revision in `eos/__init__.py` -- Commit changes `git commit -a -m "your message here"` -- Tag version `git tag v3.x.y` -- Push changes `git push` and `git push --tags` -- This should trigger the **Release** action on GitHub that builds a new version and uploads it to PyPI. - - -Update on AMOR -============== - -- Login via SSH using the **amor** user. -- Activate eos virtual environment `source /home/software/virtualenv/eosenv/bin/activate` -- Update eos packge `pip install --upgrade amor-eos` +Make new release +================ + +- Update revision in `eos/__init__.py` +- Commit changes `git commit -a -m "your message here"` +- Push changes `git push` +- Use the workflow dispatch for [**Release**](https://gitea.psi.ch/sinq-reflectometry/eos/actions?workflow=release.yml&actor=0&status=0) action + on Gitea with option "all_incl_release", that builds a new version, releases it and uploads it to PyPI. + + +Update on AMOR-DR +================= + +- Login via SSH using the **amor-dr** user. +- Activate eos virtual environment `source /home/software/virtualenv/eosenv/bin/activate` +- Update eos packge `pip install --upgrade amor-eos`