Skip to content

Commit

Permalink
CI: Improve build scripts
Browse files Browse the repository at this point in the history
 * Use latest kolibri stable (0.15.0)
 * Remove kolibri modifications, not needed for 0.15.0
 * Use yarn cache
 * Create a ZIP file and upload to tag if it's a release

The electron app fails to build on windows with large paths and that's
hapenning if we copy the Kolibri folder inside the resources of the
electron app before the build.

This patch does the copy of the Kolibri folder built with kapew after
the electron is built so it won't fail.

The zip compression before uploading as artifact is also a good practice
because when there are a lot of files it could fail, and we can also
upload the zip file automatically to the release if it's a tag.

https://phabricator.endlessm.com/T32867
  • Loading branch information
danigm committed Dec 22, 2021
1 parent fb743fd commit 0085e7a
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:

jobs:
Expand All @@ -27,30 +23,22 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: Install requirements
- name: Install python requirements
run: |
pip install wheel
pip install -r requirements.txt
pip install -r requirements-win.txt
npm install -g yarn
yarn global add @electron-forge/cli
- name: Prep kolibri dist
run: |
python kapew.py prep-kolibri-dist --exclude-prereleases --skip-preseed
- name: Update kolibri.dist.le_utils for kolibri-zim-plugin
run: |
pip install git+https://github.com/learningequality/le-utils.git@v0.1.34 --target="src\kolibri\dist" --upgrade
- name: Update kolibri.dist.morango for improved performance on Windows
run: |
pip install morango==0.5.6 --target="src\kolibri\dist" --upgrade
python kapew.py prep-kolibri-dist --skip-preseed --exclude-prereleases
- name: Add kolibri_zim_plugin to Kolibri's dist packages
run: |
pip install kolibri-zim-plugin==1.1.2 --target="src\kolibri\dist"
pip install kolibri-zim-plugin --target="src\kolibri\dist"
- name : Patch Kolibri's server code to avoid Windows firewall prompts
run: |
Expand All @@ -60,22 +48,36 @@ jobs:
run: |
python kapew.py build
- name: Add package data files to dist
run: |
mv src/kolibri dist/win/Kolibri
mv dist/win/Kolibri kolibri-electron/src/
- name: Install electron-forge
working-directory: kolibri-electron
run: yarn global add @electron-forge/cli

- name: Install electron dependencies
working-directory: kolibri-electron
run: |
yarn install
yarn make --arch=ia32
run: yarn install

- name: Build electron app
working-directory: kolibri-electron
run: yarn make --arch=ia32

- name: Create kolibri-windows
run: |
mv kolibri-electron/out/kolibri-electron-win32-ia32 kolibri-windows
mv src/kolibri dist/win/Kolibri
mv dist/win/Kolibri kolibri-windows/resources/app/src/
- name: Compress
run: Compress-Archive -Path kolibri-windows\* -DestinationPath kolibri-windows.zip
shell: pwsh

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: kolibri-windows.zip

- uses: actions/upload-artifact@v2
with:
name: "kolibri-windows"
path: "kolibri-windows"
name: "kolibri-windows.zip"
path: "kolibri-windows.zip"

0 comments on commit 0085e7a

Please sign in to comment.