Skip to content

Commit

Permalink
Fix releasing flow (#584)
Browse files Browse the repository at this point in the history
* Fix releasing flow

* Fixed typo

* Make electon-builder more explicit
  • Loading branch information
roll authored Oct 15, 2024
1 parent 28c69a1 commit f6f396d
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 52 deletions.
89 changes: 49 additions & 40 deletions .github/workflows/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- main

jobs:
# Test
# Unit Testing

test:
strategy:
Expand All @@ -36,52 +36,58 @@ jobs:
- name: Test software
run: make test

# End to End testing
# End to End Testing

# It is powered by WebdriverIO, it requires an application binary path in our dist folder.
# See wdio.conf.ts capabilities attribute for more info.

test-e2e:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Prepare environment
run: pip3 install hatch
- name: Install dependencies
run: make install
- name: Build the application
run: make build
- name: Generate bundle file
run: make dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Make AppImage executable
run: |
chmod a+x ./dist/*.AppImage
ls -l ./dist
- name: Check chrome version
run: google-chrome --version
- name: Run headless test
uses: coactions/setup-xvfb@v1
with:
run: npm run wdio
# Build
- name: Checkout
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Prepare environment
run: pip3 install hatch
- name: Install dependencies
run: make install
- name: Build the application
run: make build
- name: Generate bundle file
run: make dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Make AppImage executable
run: |
chmod a+x ./dist/*.AppImage
ls -l ./dist
- name: Check chrome version
run: google-chrome --version
- name: Run headless test
uses: coactions/setup-xvfb@v1
with:
run: npm run wdio

# Building Previews (on created pull requests)

# For GNU/Linux we need to build our application in the oldest version we want to support.
# https://pyinstaller.org/en/stable/usage.html?highlight=glibc#making-gnu-linux-apps-forward-compatible
#

# The reason we chose macos-13 as the minimum version:
# https://forums.developer.apple.com/forums/thread/739988
# "macOS 14 introduced a new container data protection feature. To learn more about that,
# see the link in Trusted Execution Resources.The solution here is to sign your code with a stable signing identity.
# "macOS 14 introduced a new container data protection feature. To learn more about that,
# see the link in Trusted Execution Resources.The solution here is to sign your code with a stable signing identity.
# For day-to-day development, that should be your Apple Development signing identity."

build:
if: github.event_name == 'pull_request'
strategy:
matrix:
os: [ubuntu-20.04, macos-13, windows-latest]
Expand Down Expand Up @@ -118,10 +124,13 @@ jobs:
dist/*.dmg
retention-days: 14

# Release
# Releasing a Draft on Github (on merged pull requests)

# It will create or update a draft release on Github with all the artifacts we have built.
# The version in `package.json` needs to be updated to activate this action.

release:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
if: github.event_name == 'push'
strategy:
matrix:
os: [ubuntu-20.04, macos-13, windows-latest]
Expand All @@ -144,7 +153,7 @@ jobs:
run: make install
- name: Build software
run: make build
- name: Dist software
run: make dist
- name: Release software
run: make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all build client dist docs format install lint preview release server start test type version
.PHONY: all build client desktop dist docs format install lint preview release server start test type version


VERSION := $(shell node -p -e "require('./package.json').version")
Expand All @@ -15,6 +15,10 @@ build:
client:
npm run start

## Runs the Electron application with live reload (requires a running server).
desktop:
npm run desktop

## Runs electron-builder to package and build a ready for distribution app.
dist:
npm run dist
Expand Down Expand Up @@ -42,12 +46,9 @@ lint:
preview:
npm run preview

## Runs electron-builder to release the app.
release:
git checkout main && git pull origin && git fetch -p
@git log --pretty=format:"%C(yellow)%h%Creset %s%Cgreen%d" --reverse -20
@echo "\nReleasing v$(VERSION) in 10 seconds. Press <CTRL+C> to abort\n" && sleep 10
make test && git tag -a v$(VERSION) -m 'v$(VERSION)'
git push --follow-tags --no-verify
npm run release

## Runs the FastAPI server in isolation (:4040).
server:
Expand Down
2 changes: 1 addition & 1 deletion electron-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ artifactName: opendataeditor-${os}-${version}.${ext}
publish:
provider: github
owner: okfn
releaseType: release
releaseType: draft
files:
- 'build/client/**/*'
- 'build/desktop/**/*'
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@
"build": "electron-vite build",
"dist": "electron-builder",
"coverage": "sensible-browser coverage/index.html",
"desktop": "electron-vite dev",
"format": "prettier --write \"client/**/*.ts*\" && eslint --fix \"client/**/*.ts*\"",
"lint": "prettier --check \"client/**/*.ts*\" && eslint \"client/**/*.ts*\"",
"prepare": "husky install",
"preview": "electron-vite dev",
"release": "electron-builder --publish always",
"start": "vite --open --port 8080",
"spec": "vitest run",
"test": "npm run lint && npm run type && npm run spec",
Expand Down
16 changes: 11 additions & 5 deletions portal/content/docs/contributing/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ hatch run start <data-folder> # optionally provide a data folder path

### Client

> It requires the server to be running
Running the client in isolation:

```bash
Expand All @@ -87,12 +89,14 @@ npm run start

### Desktop

Previewing descript application:
> It requires the server to be running
Running desktop application:

```bash
make preview
make desktop
# OR
npm run preview
npm run desktop
```

## Documentation
Expand All @@ -110,5 +114,7 @@ It will be automatically published on CloudFlare when merged to the `main` branc
> You need to be a maintainer to release a new version
- Update the version in `package.json` according to SemVer
- Create a pull request with the changes and get it approved and merged
- Run `make release` locally to create a new release
- Create a pull request with the change and get it approved and merged
- GitHub Actions will automatically create a [release draft](https://github.com/okfn/opendataeditor/releases) with build artifacts to be tested and published
- Until the draft realease is published, every new pull request merged will update the draft with new artifacts
- Review, edit, and publish the draft release when it is ready

0 comments on commit f6f396d

Please sign in to comment.