Skip to content

Commit 41d0068

Browse files
authored
Merge pull request #600 from Chronial/feature/installer
Add github workflow for windows installer creation
2 parents bd07316 + ad38173 commit 41d0068

4 files changed

Lines changed: 144 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build installer
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: 'Build installer for version (e.g. "1.0.4")'
7+
required: true
8+
type: string
9+
release:
10+
description: 'Upload as release artifact'
11+
required: true
12+
type: boolean
13+
14+
jobs:
15+
build:
16+
name: ActivitySim-${{ matrix.OS_NAME }}-${{ matrix.ARCH }}
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- os: windows-latest
23+
ARCH: x86_64
24+
TARGET_PLATFORM: win-64
25+
OS_NAME: "Windows"
26+
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v3
30+
31+
- uses: conda-incubator/setup-miniconda@35d1405e78aa3f784fe3ce9a2eb378d5eeb62169
32+
with:
33+
miniconda-version: "latest"
34+
if: contains(matrix.OS_NAME, 'Windows')
35+
36+
- name: Build installer
37+
env:
38+
ARCH: ${{ matrix.ARCH }}
39+
OS_NAME: ${{ matrix.OS_NAME }}
40+
TARGET_PLATFORM: ${{ matrix.TARGET_PLATFORM }}
41+
run: |
42+
export ACTIVITYSIM_VERSION=${{ inputs.version }}
43+
export EXT=exe
44+
source /c/Miniconda3/Scripts/activate;
45+
source other_resources/installer/build_win.sh;
46+
ls -alh build
47+
shell: bash
48+
49+
- name: Upload installer to Github artifact
50+
uses: actions/upload-artifact@v3
51+
with:
52+
path: build/Activitysim-${{ inputs.version }}-${{ matrix.OS_NAME }}-${{ matrix.ARCH }}*
53+
name: Activitysim-${{ inputs.version }}-${{ matrix.OS_NAME }}-${{ matrix.ARCH }}
54+
55+
- name: Upload installer to release
56+
uses: svenstaro/upload-release-action@v2
57+
with:
58+
repo_token: ${{ secrets.GITHUB_TOKEN }}
59+
file: build/Activitysim*
60+
tag: v${{ inputs.version }}
61+
overwrite: true
62+
file_glob: true
63+
if: inputs.release

other_resources/installer/build.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bash
2+
3+
set -xe
4+
5+
env | sort
6+
7+
echo "***** Start: Building Activitysim installer *****"
8+
CONSTRUCT_ROOT="${CONSTRUCT_ROOT:-${PWD}}"
9+
10+
cd "${CONSTRUCT_ROOT}"
11+
12+
# Constructor should be latest for non-native building
13+
# See https://github.com/conda/constructor
14+
echo "***** Install constructor *****"
15+
conda install -y "constructor>=3.3.1" jinja2 curl libarchive -c conda-forge --override-channels
16+
17+
if [[ "$(uname)" == "Darwin" ]]; then
18+
conda install -y coreutils -c conda-forge --override-channels
19+
fi
20+
# shellcheck disable=SC2154
21+
if [[ "${TARGET_PLATFORM}" == win-* ]]; then
22+
conda install -y "nsis=3.01" -c conda-forge --override-channels
23+
fi
24+
# pip install git+git://github.com/conda/constructor@3.3.1#egg=constructor --force --no-deps
25+
conda list
26+
27+
echo "***** Make temp directory *****"
28+
TEMP_DIR=$(mktemp -d --tmpdir=C:/Users/RUNNER~1/AppData/Local/Temp/);
29+
30+
echo "***** Copy file for installer construction *****"
31+
cp -R other_resources/installer "${TEMP_DIR}/"
32+
cp LICENSE.txt "${TEMP_DIR}/installer/"
33+
34+
ls -al "${TEMP_DIR}"
35+
36+
echo "***** Construct the installer *****"
37+
# Transmutation requires the current directory is writable
38+
cd "${TEMP_DIR}"
39+
# shellcheck disable=SC2086
40+
constructor "${TEMP_DIR}/installer/" --output-dir "${TEMP_DIR}"
41+
cd -
42+
43+
cd "${TEMP_DIR}"
44+
45+
# This line will break if there is more than one installer in the folder.
46+
INSTALLER_PATH=$(find . -name "Activitysim*.${EXT}" | head -n 1)
47+
48+
echo "***** Move installer to build folder *****"
49+
mkdir -p "${CONSTRUCT_ROOT}/build"
50+
mv "${INSTALLER_PATH}" "${CONSTRUCT_ROOT}/build/"
51+
52+
echo "***** Done: Building ActivitySim installer *****"
53+
cd "${CONSTRUCT_ROOT}"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
conda install posix --yes
6+
source other_resources/installer/build.sh
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{% set version = os.environ.get("ACTIVITYSIM_VERSION", "0.42.0-0") %}
2+
3+
name: Activitysim
4+
version: {{ version }}
5+
6+
initialize_by_default: false
7+
register_python_default: false
8+
9+
license_file: LICENSE.txt
10+
11+
menu_packages: []
12+
13+
installer_type: exe
14+
15+
channels:
16+
- conda-forge
17+
18+
specs:
19+
- python 3.9.*
20+
- conda
21+
- activitysim {{ version }}
22+
- pip

0 commit comments

Comments
 (0)