Skip to content

Commit 16fd501

Browse files
committed
github actions
1 parent b806a58 commit 16fd501

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed

.github/workflows/build.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '20.x'
21+
cache: 'npm'
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Build TypeScript
27+
run: npm run build
28+
29+
- name: Check if build outputs exist
30+
run: |
31+
test -f dist/index.js || (echo "dist/index.js not found" && exit 1)
32+
test -f dist/vi-editor.js || (echo "dist/vi-editor.js not found" && exit 1)
33+
test -f dist/example-files.js || (echo "dist/example-files.js not found" && exit 1)
34+
test -f dist/index.d.ts || (echo "dist/index.d.ts not found" && exit 1)
35+
echo "All build outputs present!"

.github/workflows/test.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [18.x, 20.x, 22.x]
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Run tests
31+
run: npm test
32+
33+
- name: Run tests with coverage
34+
if: matrix.node-version == '20.x'
35+
run: npm run test:coverage
36+
37+
- name: Upload coverage to Codecov
38+
if: matrix.node-version == '20.x'
39+
uses: codecov/codecov-action@v3
40+
with:
41+
files: ./coverage/lcov.info
42+
flags: unittests
43+
name: codecov-umbrella
44+
fail_ci_if_error: false

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Unix Shell JS
22

3+
[![Tests](https://github.com/hypexr/unix-shell-js/actions/workflows/test.yml/badge.svg)](https://github.com/hypexr/unix-shell-js/actions/workflows/test.yml)
4+
[![Build](https://github.com/hypexr/unix-shell-js/actions/workflows/build.yml/badge.svg)](https://github.com/hypexr/unix-shell-js/actions/workflows/build.yml)
5+
[![npm version](https://badge.fury.io/js/unix-shell-js.svg)](https://www.npmjs.com/package/unix-shell-js)
6+
37
A browser-based Unix/Linux command emulator with vi editor support.
48

59
**[Try the Live Demo](https://hypexr.github.io/unix-shell-js/)**

0 commit comments

Comments
 (0)