Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate linux build and test #5

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
17 changes: 17 additions & 0 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Setup environment'

inputs:
source-path:
description: 'OS name (linux | darwin | win32)'
required: true

runs:
using: "composite"
steps:
- uses: actions/setup-node@master
with:
node-version: 16.18.0

- name: Install npm dependencies
run: npm ci
shell: bash
91 changes: 91 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Build and test binary

on:
pull_request:

jobs:
android:
runs-on: ubuntu-20.04

timeout-minutes: 10

steps:
- uses: actions/checkout@v3

- name: Setup environment
uses: ./.github/actions/setup-env
with:
source-path: linux

- name: Setup NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r21e
add-to-path: false

- name: Build
run: npm run start-android
env:
NDK_PATH: ${{ steps.setup-ndk.outputs.ndk-path }}

- name: Compress deps
run: |
zip -r deps.zip ./deps/android

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: deps-android.zip
path: ./deps.zip

linux:
runs-on: ubuntu-20.04

timeout-minutes: 10

env:
DISPLAY: ":99.0"

steps:
- uses: actions/checkout@v3

- name: Setup environment
uses: ./.github/actions/setup-env
with:
source-path: linux

- name: Install WM
run: sudo apt install fluxbox
shell: bash

- name: Run X11
run: |
Xvfb :99 -screen 0 1920x1080x24 &
sleep 3
fluxbox &
shell: bash

- name: Build
run: npm run start-linux

- name: Prepare test
run: |
cd test
rm -rf dummy
npm i

- name: Test
run: |
cd test
npm run test

- name: Compress deps
run: |
zip -r deps.zip ./deps/linux

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: deps-linux.zip
path: ./deps.zip
1 change: 1 addition & 0 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
dummy/
Loading