Build CEA Setup #258
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
name: Build CEA Setup | |
on: | |
workflow_dispatch: | |
inputs: | |
gui-branch: | |
description: 'Branch of GUI repo to build with' | |
required: true | |
type: string | |
default: 'master' | |
jobs: | |
build_win_setup: | |
runs-on: "windows-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8' | |
- name: Install CEA to python environment | |
run: pip install . | |
- name: Get CEA version | |
shell: bash | |
run: echo "CEA_VERSION=$(python -c "import cea; print(cea.__version__)")" >> "$GITHUB_ENV" | |
- name: Create sdist of CEA | |
shell: bash | |
run: | | |
python -m pip install build | |
python -m build | |
mv dist/cityenergyanalyst-*.tar.gz setup/cityenergyanalyst.tar.gz | |
- name: Cache CEA env | |
id: cache-env | |
uses: actions/cache@v4 | |
with: | |
path: | | |
setup/dependencies/cea-env.7z | |
setup/dependencies/micromamba.exe | |
key: ${{ runner.os }}-${{ hashFiles('conda-lock.yml') }}-env | |
- uses: mamba-org/setup-micromamba@v1 | |
if: steps.cache-env.outputs.cache-hit != 'true' | |
with: | |
environment-file: conda-lock.yml | |
environment-name: cea | |
cache-environment: true | |
micromamba-binary-path: setup/dependencies/micromamba.exe | |
create-args: --no-pyc | |
- name: Clean conda environment | |
if: steps.cache-env.outputs.cache-hit != 'true' | |
shell: bash -el {0} | |
run: micromamba clean -afy | |
- name: Compress conda environment | |
if: steps.cache-env.outputs.cache-hit != 'true' | |
shell: bash -el {0} | |
run: 7z a setup/dependencies/cea-env.7z $MAMBA_ROOT_PREFIX | |
- uses: actions/checkout@v4 | |
with: | |
path: gui | |
repository: architecture-building-systems/CityEnergyAnalyst-GUI | |
ref: ${{ inputs.gui-branch }} | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Enable Corepack | |
shell: bash | |
run: corepack enable | |
- name: Package CEA GUI | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GUI_GH_TOKEN }} | |
run: | | |
cd $GITHUB_WORKSPACE/gui | |
yarn install | |
yarn version $CEA_VERSION | |
yarn electron:release | |
mv "out/CityEnergyAnalyst-GUI Setup ${CEA_VERSION}.exe" $GITHUB_WORKSPACE/setup/gui_setup.exe | |
- name: Install setup plugin | |
shell: bash | |
run: | | |
cd "C:\Program Files (x86)\NSIS\Plugins\x86-unicode" | |
curl -o Nsis7z.7z https://nsis.sourceforge.io/mediawiki/images/6/69/Nsis7z_19.00.7z | |
7z e Nsis7z.7z Plugins/x86-unicode/nsis7z.dll | |
- name: Make setup | |
shell: bash | |
run: | | |
mkdir -p $GITHUB_WORKSPACE/setup/Output | |
makensis $GITHUB_WORKSPACE/setup/cityenergyanalyst.nsi | |
- name: Upload setup | |
uses: actions/upload-artifact@v4 | |
with: | |
name: setup | |
path: ${{ github.workspace }}\setup\Output | |
compression-level: 0 | |
build_mac_dmg: | |
runs-on: "macos-12" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: cea | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8' | |
- name: Install CEA to python environment | |
run: pip install ${{ github.workspace }}/cea | |
- name: Get CEA version | |
shell: bash | |
run: echo "CEA_VERSION=$(python -c "import cea; print(cea.__version__)")" >> "$GITHUB_ENV" | |
- uses: actions/checkout@v4 | |
with: | |
path: gui | |
repository: architecture-building-systems/CityEnergyAnalyst-GUI | |
ref: ${{ inputs.gui-branch }} | |
fetch-depth: 0 | |
- name: Fetch micromamba | |
run: | | |
cd gui | |
mkdir -p ./dependencies/arm64 | |
curl -Ls https://micro.mamba.pm/api/micromamba/osx-arm64/latest | tar -xvj -C ./dependencies/arm64 --strip-components=1 bin/micromamba | |
mkdir -p ./dependencies/x64 | |
curl -Ls https://micro.mamba.pm/api/micromamba/osx-64/latest | tar -xvj -C ./dependencies/x64 --strip-components=1 bin/micromamba | |
- name: Save Apple API Key secret to file | |
env: | |
APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }} | |
run: | | |
echo -n $APPLE_API_KEY_BASE64 | base64 -d -o ${{ github.workspace }}/gui/api_key.p8 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Enable Corepack | |
run: corepack enable | |
- name: Package CEA GUI | |
env: | |
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }} | |
APPLE_API_KEY: ${{ github.workspace }}/gui/api_key.p8 | |
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} | |
CSC_LINK: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | |
CSC_KEY_PASSWORD: ${{ secrets.P12_PASSWORD }} | |
GITHUB_TOKEN: ${{ secrets.GUI_GH_TOKEN }} | |
run: | | |
cd gui | |
yarn | |
yarn version $CEA_VERSION | |
yarn electron:release --arm64 --x64 |