-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #600 from Chronial/feature/installer
Add github workflow for windows installer creation
- Loading branch information
Showing
4 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Build installer | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Build installer for version (e.g. "1.0.4")' | ||
required: true | ||
type: string | ||
release: | ||
description: 'Upload as release artifact' | ||
required: true | ||
type: boolean | ||
|
||
jobs: | ||
build: | ||
name: ActivitySim-${{ matrix.OS_NAME }}-${{ matrix.ARCH }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: windows-latest | ||
ARCH: x86_64 | ||
TARGET_PLATFORM: win-64 | ||
OS_NAME: "Windows" | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- uses: conda-incubator/setup-miniconda@35d1405e78aa3f784fe3ce9a2eb378d5eeb62169 | ||
with: | ||
miniconda-version: "latest" | ||
if: contains(matrix.OS_NAME, 'Windows') | ||
|
||
- name: Build installer | ||
env: | ||
ARCH: ${{ matrix.ARCH }} | ||
OS_NAME: ${{ matrix.OS_NAME }} | ||
TARGET_PLATFORM: ${{ matrix.TARGET_PLATFORM }} | ||
run: | | ||
export ACTIVITYSIM_VERSION=${{ inputs.version }} | ||
export EXT=exe | ||
source /c/Miniconda3/Scripts/activate; | ||
source other_resources/installer/build_win.sh; | ||
ls -alh build | ||
shell: bash | ||
|
||
- name: Upload installer to Github artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: build/Activitysim-${{ inputs.version }}-${{ matrix.OS_NAME }}-${{ matrix.ARCH }}* | ||
name: Activitysim-${{ inputs.version }}-${{ matrix.OS_NAME }}-${{ matrix.ARCH }} | ||
|
||
- name: Upload installer to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: build/Activitysim* | ||
tag: v${{ inputs.version }} | ||
overwrite: true | ||
file_glob: true | ||
if: inputs.release |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -xe | ||
|
||
env | sort | ||
|
||
echo "***** Start: Building Activitysim installer *****" | ||
CONSTRUCT_ROOT="${CONSTRUCT_ROOT:-${PWD}}" | ||
|
||
cd "${CONSTRUCT_ROOT}" | ||
|
||
# Constructor should be latest for non-native building | ||
# See https://github.com/conda/constructor | ||
echo "***** Install constructor *****" | ||
conda install -y "constructor>=3.3.1" jinja2 curl libarchive -c conda-forge --override-channels | ||
|
||
if [[ "$(uname)" == "Darwin" ]]; then | ||
conda install -y coreutils -c conda-forge --override-channels | ||
fi | ||
# shellcheck disable=SC2154 | ||
if [[ "${TARGET_PLATFORM}" == win-* ]]; then | ||
conda install -y "nsis=3.01" -c conda-forge --override-channels | ||
fi | ||
# pip install git+git://github.com/conda/constructor@3.3.1#egg=constructor --force --no-deps | ||
conda list | ||
|
||
echo "***** Make temp directory *****" | ||
TEMP_DIR=$(mktemp -d --tmpdir=C:/Users/RUNNER~1/AppData/Local/Temp/); | ||
|
||
echo "***** Copy file for installer construction *****" | ||
cp -R other_resources/installer "${TEMP_DIR}/" | ||
cp LICENSE.txt "${TEMP_DIR}/installer/" | ||
|
||
ls -al "${TEMP_DIR}" | ||
|
||
echo "***** Construct the installer *****" | ||
# Transmutation requires the current directory is writable | ||
cd "${TEMP_DIR}" | ||
# shellcheck disable=SC2086 | ||
constructor "${TEMP_DIR}/installer/" --output-dir "${TEMP_DIR}" | ||
cd - | ||
|
||
cd "${TEMP_DIR}" | ||
|
||
# This line will break if there is more than one installer in the folder. | ||
INSTALLER_PATH=$(find . -name "Activitysim*.${EXT}" | head -n 1) | ||
|
||
echo "***** Move installer to build folder *****" | ||
mkdir -p "${CONSTRUCT_ROOT}/build" | ||
mv "${INSTALLER_PATH}" "${CONSTRUCT_ROOT}/build/" | ||
|
||
echo "***** Done: Building ActivitySim installer *****" | ||
cd "${CONSTRUCT_ROOT}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
conda install posix --yes | ||
source other_resources/installer/build.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{% set version = os.environ.get("ACTIVITYSIM_VERSION", "0.42.0-0") %} | ||
|
||
name: Activitysim | ||
version: {{ version }} | ||
|
||
initialize_by_default: false | ||
register_python_default: false | ||
|
||
license_file: LICENSE.txt | ||
|
||
menu_packages: [] | ||
|
||
installer_type: exe | ||
|
||
channels: | ||
- conda-forge | ||
|
||
specs: | ||
- python 3.9.* | ||
- conda | ||
- activitysim {{ version }} | ||
- pip |