Skip to content

Commit c742f47

Browse files
authored
Merge pull request pyscript#47 from anaconda/setup_build_action
Add GH Action to test build
2 parents 47d20f0 + c78f5f1 commit c742f47

File tree

3 files changed

+78
-2
lines changed

3 files changed

+78
-2
lines changed

.github/workflows/build.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: '*'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: Install node
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: '12.x'
19+
- name: Cache node modules
20+
uses: actions/cache@v3
21+
env:
22+
cache-name: cache-node-modules
23+
with:
24+
# npm cache files are stored in `~/.npm` on Linux/macOS
25+
path: ~/.npm
26+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
27+
restore-keys: |
28+
${{ runner.os }}-build-${{ env.cache-name }}-
29+
${{ runner.os }}-build-
30+
${{ runner.os }}-
31+
- name: Install dependencies
32+
run: |
33+
cd pyscriptjs
34+
npm install
35+
- name: Build pyscript
36+
run: |
37+
cd pyscriptjs
38+
npm run build

.github/workflows/lint.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: '*'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: Install node
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: '12.x'
19+
- name: Cache node modules
20+
uses: actions/cache@v3
21+
env:
22+
cache-name: cache-node-modules
23+
with:
24+
# npm cache files are stored in `~/.npm` on Linux/macOS
25+
path: ~/.npm
26+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
27+
restore-keys: |
28+
${{ runner.os }}-build-${{ env.cache-name }}-
29+
${{ runner.os }}-build-
30+
${{ runner.os }}-
31+
- name: Install dependencies
32+
run: |
33+
cd pyscriptjs
34+
npm install
35+
- name: Run linter
36+
run: |
37+
cd pyscriptjs
38+
npm run lint

pyscriptjs/rollup.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import typescript from "@rollup/plugin-typescript";
88
import css from "rollup-plugin-css-only";
99
import serve from 'rollup-plugin-serve'
1010

11-
const production = !process.env.ROLLUP_WATCH;
11+
const production = !process.env.ROLLUP_WATCH || (process.env.NODE_ENV === "production");
1212

1313
function serve_() {
1414
let server;
@@ -68,7 +68,7 @@ export default {
6868
!production && serve(),
6969
!production && livereload("public"),
7070
production && terser(),
71-
serve({
71+
!production && serve({
7272
port: 8080,
7373
contentBase: 'examples'}
7474
)

0 commit comments

Comments
 (0)