PR: Avoid iterating over non-dict objects if conda responds with errors #2184
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
paths: | |
- 'installers-conda/**' | |
- '.github/workflows/installers-conda.yml' | |
- 'requirements/*.yml' | |
- 'MANIFEST.in' | |
- '**.bat' | |
- '**.py' | |
- '**.sh' | |
- '!**.md' | |
- '!installers/**' | |
- '!.github/workflows/installer-win.yml' | |
- '!.github/workflows/installer-macos.yml' | |
release: | |
types: | |
- created | |
workflow_dispatch: | |
inputs: | |
pre: | |
description: 'Build as release candidate' | |
required: false | |
default: true | |
type: boolean | |
concurrency: | |
group: installers-conda-${{ github.ref }} | |
cancel-in-progress: true | |
name: Nightly conda-based installers | |
env: | |
IS_STANDARD_PR: ${{ github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && ! inputs.pre) }} | |
IS_RELEASE: ${{ github.event_name == 'release' }} | |
IS_PRE: ${{ github.event_name == 'workflow_dispatch' && inputs.pre }} | |
jobs: | |
build-noarch-pkgs: | |
name: Build ${{ matrix.pkg }} | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && ! inputs.pre) | |
strategy: | |
matrix: | |
pkg: ["python-lsp-server", "qtconsole"] | |
python-version: ["3.9"] | |
defaults: | |
run: | |
shell: bash -l {0} | |
working-directory: ${{ github.workspace }}/installers-conda | |
env: | |
DISTDIR: ${{ github.workspace }}/installers-conda/dist | |
pkg: ${{ matrix.pkg }} | |
artifact_name: ${{ matrix.pkg }}_${{ matrix.python-version }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Build Environment | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: installers-conda/build-environment.yml | |
create-args: python=${{ matrix.python-version }} | |
- name: Build Conda Packages | |
run: python build_conda_pkgs.py --build $pkg | |
- name: Build Artifact | |
run: tar -a -C $CONDA_PREFIX -cf $PWD/${artifact_name}.tar.bz2 conda-bld | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ github.workspace }}/installers-conda/${{ env.artifact_name }}.tar.bz2 | |
name: ${{ env.artifact_name }} | |
build-matrix: | |
name: Determine Build Matrix | |
runs-on: ubuntu-latest | |
outputs: | |
target_platform: ${{ steps.build-matrix.outputs.target_platform }} | |
include: ${{ steps.build-matrix.outputs.include }} | |
python_version: ${{ steps.build-matrix.outputs.python_version }} | |
steps: | |
- name: Determine Build Matrix | |
id: build-matrix | |
run: | | |
target_platform="'linux-64'" | |
include="{'os': 'ubuntu-latest', 'target-platform': 'linux-64'}" | |
python_version="'3.9'" | |
echo "target_platform=[$target_platform]" >> $GITHUB_OUTPUT | |
echo "include=[$include]" >> $GITHUB_OUTPUT | |
echo "python_version=[$python_version]" >> $GITHUB_OUTPUT | |
build-installers: | |
name: Build installer for ${{ matrix.target-platform }} Python-${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
needs: | |
- build-matrix | |
- build-noarch-pkgs | |
if: ${{ ! failure() && ! cancelled() }} | |
strategy: | |
matrix: | |
target-platform: ${{fromJson(needs.build-matrix.outputs.target_platform)}} | |
python-version: ${{fromJson(needs.build-matrix.outputs.python_version)}} | |
include: ${{fromJson(needs.build-matrix.outputs.include)}} | |
defaults: | |
run: | |
shell: bash -l {0} | |
working-directory: ${{ github.workspace }}/installers-conda | |
env: | |
DISTDIR: ${{ github.workspace }}/installers-conda/dist | |
CONSTRUCTOR_TARGET_PLATFORM: ${{ matrix.target-platform }} | |
BNP_STATUS: ${{ needs.build-noarch-pkgs.result }} | |
MAT_STATUS: ${{ needs.build-matrix.result }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Build Environment | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: installers-conda/build-environment.yml | |
create-args: python=${{ matrix.python-version }} | |
- name: Env Variables | |
run: | | |
ARTIFACTS_PATH=$RUNNER_TEMP/artifacts | |
CONDA_BLD_PATH=$RUNNER_TEMP/conda-bld | |
echo "ARTIFACTS_PATH=$ARTIFACTS_PATH" >> $GITHUB_ENV | |
echo "CONDA_BLD_PATH=$CONDA_BLD_PATH" >> $GITHUB_ENV | |
[[ -d $ARTIFACTS_PATH ]] || mkdir $ARTIFACTS_PATH | |
[[ -d $CONDA_BLD_PATH ]] || mkdir $CONDA_BLD_PATH | |
env | |
- name: Download Local Conda Packages | |
if: needs.build-noarch-pkgs.result == 'success' | |
uses: actions/download-artifact@v4 | |
with: | |
path: ${{ env.ARTIFACTS_PATH }} | |
- name: Create Local Conda Channel | |
run: | | |
files=($(find $ARTIFACTS_PATH -name *.tar.bz2)) | |
echo ${files[@]} | |
cd $(dirname $CONDA_BLD_PATH) | |
for file in ${files[@]}; do | |
tar -xf $file | |
done | |
mamba index $CONDA_BLD_PATH | |
mamba search -c $CONDA_BLD_PATH --override-channels || true | |
- name: Build ${{ matrix.target-platform }} conda packages | |
run: | | |
pkgs=("spyder") | |
if [[ $IS_STANDARD_PR == "true" ]]; then | |
pkgs+=("spyder-kernels") | |
fi | |
python build_conda_pkgs.py --build ${pkgs[@]} | |
- name: Build Package Installer | |
run: | | |
python build_installers.py | |
PKG_FILE=$(python build_installers.py --artifact-name) | |
PKG_NAME=$(basename $PKG_FILE) | |
echo "PKG_FILE=$PKG_FILE" >> $GITHUB_ENV | |
echo "PKG_NAME=$PKG_NAME" >> $GITHUB_ENV | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ env.PKG_FILE }} | |
name: ${{ env.PKG_NAME }} | |
- name: Get Release | |
if: env.IS_RELEASE == 'true' | |
id: get_release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
uses: bruceadams/get-release@v1.2.0 | |
- name: Upload Release Asset | |
if: env.IS_RELEASE == 'true' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.get_release.outputs.upload_url }} | |
asset_path: ${{ env.PKG_FILE }} | |
asset_name: ${{ env.PKG_NAME }} | |
asset_content_type: application/octet-stream |