From 8b555afb90900572a3083a001d571e1939c1fd97 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Tue, 26 Apr 2022 11:25:10 +0200 Subject: [PATCH 1/6] Add GH Action to test build --- .github/workflows/build.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..15c28ff --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build + +on: + push: + branches: main + pull_request: + branches: '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install node + uses: actions/setup-node@v1 + with: + node-version: '12.x' + - name: Cache node modules + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Install dependencies + run: | + cd pyscriptjs + npm install + - name: Build pyscript + run: npm run dev From 694628713380a70e1cc4d41c13481a90d5197023 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Tue, 26 Apr 2022 11:26:58 +0200 Subject: [PATCH 2/6] cd to correct dir --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 15c28ff..81ea7be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,4 +33,6 @@ jobs: cd pyscriptjs npm install - name: Build pyscript - run: npm run dev + run: | + cd pyscriptjs + npm run dev From 6eea325c3aba94f0d6bdf0f386cced7ef6ebc220 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Tue, 26 Apr 2022 11:29:23 +0200 Subject: [PATCH 3/6] npm run build (not dev) --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 81ea7be..cc63a00 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,4 +35,4 @@ jobs: - name: Build pyscript run: | cd pyscriptjs - npm run dev + npm run build From c5ada6ca4f3971a092be385104b1c0d9ed65209f Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Tue, 26 Apr 2022 11:38:05 +0200 Subject: [PATCH 4/6] Do not run server on build --- pyscriptjs/rollup.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyscriptjs/rollup.config.js b/pyscriptjs/rollup.config.js index 6b6be39..6ddad41 100644 --- a/pyscriptjs/rollup.config.js +++ b/pyscriptjs/rollup.config.js @@ -8,7 +8,7 @@ import typescript from "@rollup/plugin-typescript"; import css from "rollup-plugin-css-only"; import serve from 'rollup-plugin-serve' -const production = !process.env.ROLLUP_WATCH; +const production = !process.env.ROLLUP_WATCH || (process.env.NODE_ENV === "production"); function serve_() { let server; @@ -68,7 +68,7 @@ export default { !production && serve(), !production && livereload("public"), production && terser(), - serve({ + !production && serve({ port: 8080, contentBase: 'examples'} ) From 303bb5dee35a417743ce50be815f87409b8502c4 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Tue, 26 Apr 2022 11:40:54 +0200 Subject: [PATCH 5/6] Run linter --- .github/workflows/lint.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..46bc1df --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,38 @@ +name: Lint + +on: + push: + branches: main + pull_request: + branches: '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install node + uses: actions/setup-node@v1 + with: + node-version: '12.x' + - name: Cache node modules + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Install dependencies + run: | + cd pyscriptjs + npm install + - name: Build pyscript + run: | + cd pyscriptjs + npm run lint From c78f5f18644ae2858e0dcb1133c2217852656d5d Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Tue, 26 Apr 2022 11:42:14 +0200 Subject: [PATCH 6/6] Rename task --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 46bc1df..33ac1fe 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -32,7 +32,7 @@ jobs: run: | cd pyscriptjs npm install - - name: Build pyscript + - name: Run linter run: | cd pyscriptjs npm run lint