mirror of
https://github.com/ryanvolz/radioconda.git
synced 2024-12-22 02:31:03 -05:00
Add Github action to build radioconda.
This commit is contained in:
parent
03c5db0fb7
commit
a22ed08f7f
121
.github/workflows/build_radioconda.yml
vendored
Normal file
121
.github/workflows/build_radioconda.yml
vendored
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
name: Build radioconda
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
env:
|
||||||
|
DISTNAME: radioconda
|
||||||
|
SOURCE: github.com/ryanvolz/radioconda
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: ${{ matrix.PLATFORM }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
PLATFORM: linux-64
|
||||||
|
OS_NAME: Linux
|
||||||
|
ARCH: x86_64
|
||||||
|
- os: macos-latest
|
||||||
|
PLATFORM: osx-64
|
||||||
|
OS_NAME: MacOSX
|
||||||
|
ARCH: x86_64
|
||||||
|
- os: windows-latest
|
||||||
|
PLATFORM: win-64
|
||||||
|
OS_NAME: Windows
|
||||||
|
ARCH: x86_64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install python environment
|
||||||
|
uses: mamba-org/provision-with-micromamba@main
|
||||||
|
with:
|
||||||
|
environment-file: buildenv.yaml
|
||||||
|
|
||||||
|
- name: Build installer (bash)
|
||||||
|
if: runner.os != 'Windows'
|
||||||
|
shell: bash -l {0}
|
||||||
|
env:
|
||||||
|
PLATFORM: ${{ matrix.PLATFORM }}
|
||||||
|
run: |
|
||||||
|
python build_installer.py -v
|
||||||
|
|
||||||
|
- name: Build installer (cmd.exe)
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
shell: powershell
|
||||||
|
env:
|
||||||
|
PLATFORM: ${{ matrix.PLATFORM }}
|
||||||
|
run: |
|
||||||
|
$Env:Path = "$Env:CONDA_PREFIX\NSIS;$Env:Path"
|
||||||
|
echo $Env:Path
|
||||||
|
python build_installer.py -v
|
||||||
|
|
||||||
|
- name: List built installers
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
ls -lh dist
|
||||||
|
|
||||||
|
- name: Test installer (sh)
|
||||||
|
if: contains(matrix.OS_NAME, 'Linux') || contains(matrix.OS_NAME, 'MacOSX')
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
OS_NAME: ${{ matrix.OS_NAME }}
|
||||||
|
ARCH: ${{ matrix.ARCH }}
|
||||||
|
INSTALL_PATH: ${{ github.workspace }}/test_installation
|
||||||
|
run: |
|
||||||
|
bash dist/$DISTNAME-*-$OS_NAME-$ARCH.sh -b -p $INSTALL_PATH
|
||||||
|
eval "$($INSTALL_PATH/bin/conda shell.bash hook)"
|
||||||
|
conda info
|
||||||
|
conda list
|
||||||
|
|
||||||
|
- name: Test installer (pkg)
|
||||||
|
if: contains(matrix.OS_NAME, 'MacOSX')
|
||||||
|
continue-on-error: true # this test doesn't work yet
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
OS_NAME: ${{ matrix.OS_NAME }}
|
||||||
|
ARCH: ${{ matrix.ARCH }}
|
||||||
|
TARGET_VOLUME: CurrentUserHomeDirectory
|
||||||
|
INSTALL_PATH: ~/Applications/${{ env.DISTNAME }}
|
||||||
|
run: |
|
||||||
|
installer -verbose -pkg dist/$DISTNAME-*-$OS_NAME-$ARCH.pkg -target $TARGET_VOLUME
|
||||||
|
eval "$($INSTALL_PATH/bin/conda shell.bash hook)"
|
||||||
|
conda info
|
||||||
|
conda list
|
||||||
|
|
||||||
|
- name: Test installer (exe)
|
||||||
|
if: contains(matrix.OS_NAME, 'Windows')
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
OS_NAME: ${{ matrix.OS_NAME }}
|
||||||
|
ARCH: ${{ matrix.ARCH }}
|
||||||
|
INSTALL_PATH_W: ${{ github.workspace }}\test_installation
|
||||||
|
run: |
|
||||||
|
INSTALL_PATH=$(cygpath -u $INSTALL_PATH_W)
|
||||||
|
INSTALLER_EXE="dist/$DISTNAME-*-$OS_NAME-$ARCH.exe"
|
||||||
|
INSTALLER_EXE_W=$(cygpath -w $INSTALLER_EXE)
|
||||||
|
echo "start /wait \"\" $INSTALLER_EXE_W /InstallationType=JustMe /RegisterPython=0 /S /D=$INSTALL_PATH_W" > install.bat
|
||||||
|
cmd.exe /c install.bat
|
||||||
|
source $INSTALL_PATH/Scripts/activate
|
||||||
|
conda info
|
||||||
|
conda list
|
||||||
|
|
||||||
|
- name: Upload to Github artifact
|
||||||
|
if: ${{ (success() || failure()) && !startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
path: dist/*
|
||||||
|
name: ${{ matrix.OS_NAME }}-${{ matrix.ARCH }}
|
||||||
|
|
||||||
|
- name: Upload to release
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
with:
|
||||||
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
file: dist/*
|
||||||
|
tag: ${{ github.ref }}
|
||||||
|
overwrite: true
|
||||||
|
file_glob: true
|
@ -20,14 +20,16 @@ def spec_dir_extract_platform(installer_spec_dir: pathlib.Path) -> str:
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from constructor import main as constructor_main
|
from constructor import main as constructor_main
|
||||||
|
|
||||||
platform = constructor_main.cc_platform
|
|
||||||
cwd = pathlib.Path(".").absolute()
|
cwd = pathlib.Path(".").absolute()
|
||||||
here = pathlib.Path(__file__).parent.absolute().relative_to(cwd)
|
here = pathlib.Path(__file__).parent.absolute().relative_to(cwd)
|
||||||
|
distname = os.getenv("DISTNAME", "radioconda")
|
||||||
|
platform = os.getenv("PLATFORM", constructor_main.cc_platform)
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description=(
|
description=(
|
||||||
@ -39,7 +41,7 @@ if __name__ == "__main__":
|
|||||||
"installer_spec_dir",
|
"installer_spec_dir",
|
||||||
type=pathlib.Path,
|
type=pathlib.Path,
|
||||||
nargs="?",
|
nargs="?",
|
||||||
default=here / "installer_specs" / f"radioconda-{platform}",
|
default=here / "installer_specs" / f"{distname}-{platform}",
|
||||||
help=(
|
help=(
|
||||||
"Installer specification directory (containing construct.yaml)"
|
"Installer specification directory (containing construct.yaml)"
|
||||||
" for a particular platform (name ends in the platform identifier)."
|
" for a particular platform (name ends in the platform identifier)."
|
||||||
@ -61,6 +63,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
platform = spec_dir_extract_platform(args.installer_spec_dir)
|
platform = spec_dir_extract_platform(args.installer_spec_dir)
|
||||||
|
|
||||||
|
args.output_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
constructor_cmdline = [
|
constructor_cmdline = [
|
||||||
"constructor",
|
"constructor",
|
||||||
args.installer_spec_dir,
|
args.installer_spec_dir,
|
||||||
|
5
buildenv.yaml
Normal file
5
buildenv.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
name: buildenv
|
||||||
|
channels:
|
||||||
|
- conda-forge
|
||||||
|
dependencies:
|
||||||
|
- constructor
|
10
rerender.py
10
rerender.py
@ -109,8 +109,12 @@ def render_constructor_specs(
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import argparse
|
import argparse
|
||||||
import datetime
|
import datetime
|
||||||
|
import os
|
||||||
|
|
||||||
here = pathlib.Path(__file__).parent.relative_to("")
|
cwd = pathlib.Path(".").absolute()
|
||||||
|
here = pathlib.Path(__file__).parent.absolute().relative_to(cwd)
|
||||||
|
distname = os.getenv("DISTNAME", "radioconda")
|
||||||
|
source = os.getenv("SOURCE", "github.com/ryanvolz/radioconda")
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description=(
|
description=(
|
||||||
@ -122,7 +126,7 @@ if __name__ == "__main__":
|
|||||||
"environment_file",
|
"environment_file",
|
||||||
type=pathlib.Path,
|
type=pathlib.Path,
|
||||||
nargs="?",
|
nargs="?",
|
||||||
default=here / "radioconda.yaml",
|
default=here / f"{distname}.yaml",
|
||||||
help=(
|
help=(
|
||||||
"YAML file defining an installer distribution, with a 'name' string and"
|
"YAML file defining an installer distribution, with a 'name' string and"
|
||||||
" 'channels', 'platforms', and 'dependencies' lists."
|
" 'channels', 'platforms', and 'dependencies' lists."
|
||||||
@ -132,7 +136,7 @@ if __name__ == "__main__":
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--company",
|
"--company",
|
||||||
type=str,
|
type=str,
|
||||||
default="github.com/ryanvolz/radioconda",
|
default=source,
|
||||||
help=(
|
help=(
|
||||||
"Name of the company/entity who is responsible for the installer."
|
"Name of the company/entity who is responsible for the installer."
|
||||||
" (default: %(default)s)"
|
" (default: %(default)s)"
|
||||||
|
Loading…
Reference in New Issue
Block a user