Skip to content

Sync workflow #98

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

Merged
merged 1 commit into from
Apr 12, 2023
Merged
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
89 changes: 41 additions & 48 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,29 @@ jobs:
strategy:
matrix:
include:
# - { os: ubuntu-latest, python: '3.10', arch: x64 }
# - { os: ubuntu-latest, python: '3.9', arch: x64 }
- { os: ubuntu-latest, python: '3.8', arch: x64 }
# - { os: ubuntu-latest, python: '3.7', arch: x64 }

# - { os: macos-latest, python: '3.10', arch: x64 }
# - { os: macos-latest, python: '3.9', arch: x64 }
# - { os: macos-latest, python: '3.8', arch: x64 }
# - { os: macos-latest, python: '3.7', arch: x64 }

# - { os: windows-latest, python: '3.10', arch: x64 }
# - { os: windows-latest, python: '3.9', arch: x64 }
# - { os: windows-latest, python: '3.8', arch: x64 }
# - { os: windows-latest, python: '3.7', arch: x64 }

# - { os: windows-latest, python: '3.10', arch: x86 }
# - { os: windows-latest, python: '3.9', arch: x86 }
# - { os: windows-latest, python: '3.8', arch: x86 }
# - { os: windows-latest, python: '3.7', arch: x86 }
- { os: ubuntu-latest, python: '3.11', arch: x64, conda: true}
# - { os: ubuntu-latest, python: '3.10', arch: x64, conda: true }
# - { os: ubuntu-latest, python: '3.9', arch: x64, conda: true }
# - { os: ubuntu-latest, python: '3.8', arch: x64, conda: true }
# - { os: ubuntu-latest, python: '3.7', arch: x64, conda: true }

# - { os: macos-11, python: '3.11', arch: x64, conda: true }
# - { os: macos-11, python: '3.10', arch: x64, conda: true }
# - { os: macos-11, python: '3.9', arch: x64, conda: true }
# - { os: macos-11, python: '3.8', arch: x64, conda: true }
# - { os: macos-11, python: '3.7', arch: x64, conda: true }

# - { os: windows-latest, python: '3.11', arch: x64, conda: true }
# - { os: windows-latest, python: '3.10', arch: x64, conda: true }
# - { os: windows-latest, python: '3.9', arch: x64, conda: true }
# - { os: windows-latest, python: '3.8', arch: x64, conda: true }
# - { os: windows-latest, python: '3.7', arch: x64, conda: true }

# - { os: windows-latest, python: '3.11', arch: x86, conda: false } # conda not yet available
# - { os: windows-latest, python: '3.10', arch: x86, conda: true }
# - { os: windows-latest, python: '3.9', arch: x86, conda: true }
# - { os: windows-latest, python: '3.8', arch: x86, conda: true }
# - { os: windows-latest, python: '3.7', arch: x86, conda: true }

if: github.repository == 'labscript-suite/labscript-utils' && (github.event_name != 'create' || github.event.ref_type != 'branch')
steps:
Expand Down Expand Up @@ -95,6 +99,7 @@ jobs:
path: ./dist

- name: Set Variables for Conda Build
if: matrix.conda
shell: bash
run: |
if [ $NOARCH == true ]; then
Expand All @@ -105,37 +110,36 @@ jobs:
echo "CONDA_BUILD_ARGS=$CONDA_BUILD_ARGS" >> $GITHUB_ENV

- name: Install Miniconda
# We need https://github.com/conda-incubator/setup-miniconda/pull/189 in order
# to be able to install 32-bit miniconda on Windows. Once setup-miniconda 2.1.2
# is released with this fix, can change to @v2.
uses: conda-incubator/setup-miniconda@1a875d105ac03256664b54c882c8c374ce617ef6
if: matrix.conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
architecture: ${{ matrix.arch }}
miniconda-version: "latest"

- name: Workaround conda-build incompatibility with xcode >12
- name: Workaround conda-build incompatibility with xcode 12+
if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 11.7

- name: Conda package (Unix)
if: runner.os != 'Windows'
if: (matrix.conda && runner.os != 'Windows')
shell: bash -l {0}
run: |
conda install -c labscript-suite setuptools-conda
setuptools-conda build $CONDA_BUILD_ARGS .

- name: Conda Package (Windows)
if: runner.os == 'Windows'
if: (matrix.conda && runner.os == 'Windows')
shell: cmd /C CALL {0}
run: |
conda install -c labscript-suite setuptools-conda && ^
setuptools-conda build %CONDA_BUILD_ARGS% --croot ${{ runner.temp }}\cb .

- name: Upload Artifact
if: matrix.conda
uses: actions/upload-artifact@v3
with:
name: conda_packages
Expand All @@ -161,7 +165,7 @@ jobs:
if: env.PURE == 'false'
uses: RalfG/python-wheels-manylinux-build@v0.4.2
with:
python-versions: 'cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310'
python-versions: 'cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311'
pre-build-command: 'git config --global --add safe.directory "*"'

- name: Upload Artifact
Expand Down Expand Up @@ -189,45 +193,34 @@ jobs:
name: conda_packages
path: ./conda_packages

- name: Publish on TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.testpypi }}
repository_url: https://test.pypi.org/legacy/

- name: Get Version Number
if: github.event.ref_type == 'tag'
run: |
VERSION="${GITHUB_REF/refs\/tags\/v/}"
echo "VERSION=$VERSION" >> $GITHUB_ENV

- name: Create GitHub Release
- name: Create GitHub Release and Upload Release Asset
if: github.event.ref_type == 'tag'
id: create_release
uses: actions/create-release@latest
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.ref }}
release_name: ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}
name: ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}
draft: true
prerelease: ${{ contains(github.event.ref, 'rc') }}
files: ./dist/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz

- name: Upload Release Asset
if: github.event.ref_type == 'tag'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish on TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz
asset_name: ${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz
asset_content_type: application/gzip
user: __token__
password: ${{ secrets.testpypi }}
repository-url: https://test.pypi.org/legacy/

- name: Publish on PyPI
if: github.event.ref_type == 'tag'
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi }}
Expand Down