Skip to content

Commit

Permalink
Sync workflow to workflow-sandbox latest, use conda-forge for build
Browse files Browse the repository at this point in the history
Build from the base environment (with its default Python version,
whatever version that is) targeting the build target Python version

This allows building for with newer Python versions sooner, since
conda-build may not yet be available for the newer Python versions, but
is not actually needed in the build environment.

Drop Windows 32-bit as miniforge doesn't exist
  • Loading branch information
chrisjbillington committed Nov 28, 2024
1 parent b56404d commit f34b02c
Showing 1 changed file with 31 additions and 26 deletions.
57 changes: 31 additions & 26 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ on:
push:
branches:
- master
create:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
pull_request:

env:
SCM_LOCAL_SCHEME: no-local-version
Expand All @@ -20,67 +18,69 @@ jobs:
strategy:
matrix:
include:
- { os: ubuntu-latest, python: '3.13', arch: x64 }
- { os: ubuntu-latest, python: '3.12', arch: x64 }
- { os: ubuntu-latest, python: '3.11', arch: x64 }
- { 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.9', arch: x64 }
- { os: ubuntu-latest, python: '3.8', arch: x64 }

- { os: macos-13, python: '3.13', arch: x64 }
- { os: macos-13, python: '3.12', arch: x64 }
- { os: macos-13, python: '3.11', arch: x64 }
- { os: macos-13, python: '3.10', arch: x64 }
- { os: macos-13, python: '3.9', arch: x64 }
- { os: macos-13, python: '3.8', arch: x64 }
- { os: macos-13, python: '3.9', arch: x64 }
- { os: macos-13, python: '3.8', arch: x64 }

- { os: macos-latest, python: '3.13', arch: arm64 }
- { os: macos-latest, python: '3.12', arch: arm64 }
- { os: macos-latest, python: '3.11', arch: arm64 }
- { os: macos-latest, python: '3.10', arch: arm64 }
- { os: macos-latest, python: '3.9', arch: arm64 }
- { os: macos-latest, python: '3.9', arch: arm64 }

- { os: windows-latest, python: '3.13', arch: x64 }
- { os: windows-latest, python: '3.12', arch: x64 }
- { os: windows-latest, python: '3.11', 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.9', arch: x64 }
- { os: windows-latest, python: '3.8', arch: x64 }

# - { os: windows-latest, python: '3.11', arch: x86 } # Not (yet?) available
- { os: windows-latest, python: '3.10', arch: x86 }
- { os: windows-latest, python: '3.9', arch: x86 }
- { os: windows-latest, python: '3.8', arch: x86 }

if: github.repository == 'chrisjbillington/setuptools-conda' && (github.event_name != 'create' || github.event.ref_type != 'branch')
if: github.repository == 'chrisjbillington/setuptools-conda'
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Ignore Tags
if: github.event.ref_type != 'tag'
if: github.event.ref_type == 'push' && contains(github.ref, '/tags')
run: git tag -d $(git tag --points-at HEAD)

- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
architecture: ${{ matrix.arch }}
miniconda-version: "latest"
miniforge-version: "latest"
conda-remove-defaults: true
auto-activate-base: true
activate-environment: ""

- name: Conda package (Unix)
if: runner.os != 'Windows'
shell: bash -l {0}
run: python -m setuptools_conda build .
run: python -m setuptools_conda --pythons=${{ matrix.python }} build .

- name: Conda Package (Windows)
if: runner.os == 'Windows'
shell: cmd /C CALL {0}
run: python -m setuptools_conda build .
run: python -m setuptools_conda --pythons=${{ matrix.python }} build .

- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: conda_packages
name: conda_packages-${{ matrix.os }}-py${{ matrix.python }}-${{ matrix.arch }}
path: ./conda_packages

release:
Expand All @@ -90,22 +90,27 @@ jobs:
needs: build
steps:
- name: Download Artifact
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v4
with:
name: conda_packages
path: ./conda_packages
merge-multiple: true

- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
miniforge-version: "latest"
conda-remove-defaults: true
auto-activate-base: true
activate-environment: ""

- name: Install Anaconda cloud client
shell: bash -l {0}
run: conda install anaconda-client

- name: Publish to Anaconda test label
if: github.event.ref_type != 'tag'
if: contains(github.ref, '/tags')
shell: bash -l {0}
run: |
anaconda \
Expand All @@ -117,7 +122,7 @@ jobs:
- name: Publish to Anaconda main label
shell: bash -l {0}
if: github.event.ref_type == 'tag'
if: contains(github.ref, '/tags')
run: |
anaconda \
--token ${{ secrets.ANACONDA_API_TOKEN }} \
Expand Down

0 comments on commit f34b02c

Please sign in to comment.