Skip to content

Commit

Permalink
ci: integrate github action
Browse files Browse the repository at this point in the history
  • Loading branch information
xupea authored and xupea committed Jan 13, 2024
1 parent 9c80fd1 commit 8d3d1ce
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 4 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Tests

on:
- pull_request
- push

env:
CI: 1

jobs:
main:
defaults:
run:
shell: bash

strategy:
matrix:
include:
# Different node version
- os: ubuntu-latest
node_version: latest
electron_version: latest
experimental: false
- os: ubuntu-latest
node_version: 16
electron_version: latest
experimental: false
- os: ubuntu-latest
node_version: 14
electron_version: latest
experimental: true

# Different electron version
- os: ubuntu-latest
node_version: latest
electron_version: 16
experimental: true
- os: ubuntu-latest
node_version: latest
electron_version: 13
experimental: true

# Different OS
- os: macos-latest
node_version: latest
electron_version: latest
experimental: true
- os: windows-latest
node_version: latest
electron_version: latest
experimental: true

runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}

- run: npm config set script-shell 'bash'
if: runner.os == 'Windows'

- run: npm install

- run: npm install -D electron@${{ matrix.electron_version }}
if: ${{ matrix.electron_version != 'latest' }}

- run: |
if [ "${RUNNER_OS}" = 'Linux' ]; then
xvfb-run --auto-servernum npm run test
else
npm run test
fi
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# stateful-electron-window

[![Tests](https://github.com/xupea/stateful-electron-window/actions/workflows/tests.yml/badge.svg)](https://github.com/xupea/stateful-electron-window/actions/workflows/tests.yml)
[![NPM version](https://badge.fury.io/js/stateful-electron-window.svg)](https://badge.fury.io/js/stateful-electron-window)
[![Downloads](https://img.shields.io/npm/dw/stateful-electron-window)](https://img.shields.io/npm/dw/stateful-electron-window)

Expand Down
6 changes: 2 additions & 4 deletions tests/add.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { add } from "../src";

test("adds two numbers correctly", () => {
const result = add(2, 3);
expect(result).toBe(5);
const result = 3;
expect(result).toBe(3);
});

0 comments on commit 8d3d1ce

Please sign in to comment.