Skip to content

Commit

Permalink
Merge pull request #694 from Stremio/feat/move-stremio-core-web
Browse files Browse the repository at this point in the history
Feat/move `stremio-core-web`
  • Loading branch information
elpiel authored Jul 5, 2024
2 parents 9f5b46a + c9b492e commit 85fcd88
Show file tree
Hide file tree
Showing 47 changed files with 9,865 additions and 20 deletions.
88 changes: 85 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ concurrency:
cancel-in-progress: true

jobs:
build:
name: Lint, test and build
build-core:
name: "stremio-core-*: Lint, test and build"
runs-on: ubuntu-latest

steps:
Expand All @@ -33,4 +33,86 @@ jobs:
run: cargo test

- name: Build
run: cargo build
run: cargo build

build-stremio-core-web:
name: "stremio-core-web: test (wasm) and build"

env:
NODE_VERSION: 12
WASM_PACK_VERSION: 0.12.1
# No need to check core-web if core itself is not passing
needs: build-core
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Rust setup
uses: dtolnay/[email protected]
with:
components: rustfmt, clippy
targets: wasm32-unknown-unknown

- uses: Swatinem/rust-cache@v2

- uses: taiki-e/install-action@v2
with:
tool: wasm-pack@${{ env.WASM_PACK_VERSION }}

- name: Setup chromedriver
uses: nanasess/setup-chromedriver@v2

- name: Run wasm tests (Chrome)
working-directory: stremio-core-web
run: wasm-pack test --chromedriver "$(which chromedriver)" --chrome --headless

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
registry-url: https://registry.npmjs.org/
cache-dependency-path: stremio-core-web/package-lock.json

- name: Install NPM dependencies
working-directory: stremio-core-web
run: npm ci

- name: Build (release)
working-directory: stremio-core-web
run: npm run build

# create folder for release and dev builds to be published on GH pages
- run: mkdir -p ./build/dev
working-directory: stremio-core-web

- name: Package (release)
working-directory: stremio-core-web
run: npm pack

- name: Copy release package archive
working-directory: stremio-core-web
run: cp ./*.tgz ./build

- name: Build (dev)
working-directory: stremio-core-web
run: npm run build-dev

- name: Package (dev)
working-directory: stremio-core-web
run: npm pack

- name: Copy dev package archive
working-directory: stremio-core-web
run: cp ./*.tgz ./build/dev

- name: Deploy gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./stremio-core-web/build
# in stremio, we use `feat/features-name` or `fix/this-bug`
# so we need a recursive creation of the destination dir
destination_dir: ./stremio-core-web/${{ github.ref_name }}
allow_empty_commit: true
55 changes: 55 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Prerelease

on:
release:
types: [prereleased]

env:
NODE_VERSION: 12
WASM_PACK_VERSION: 0.12.1

jobs:
prerelease-stremio-core-web:
if: ${{ ! startsWith(github.ref, 'refs/tags/stremio-core-web') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
registry-url: https://registry.npmjs.org/
cache-dependency-path: stremio-core-web/package-lock.json

- name: Rust setup
uses: dtolnay/[email protected]
with:
targets: wasm32-unknown-unknown

- uses: taiki-e/install-action@v2
with:
tool: wasm-pack@${{ env.WASM_PACK_VERSION }}

- name: Install NPM dependencies
working-directory: stremio-core-web
run: npm ci

- name: Build
working-directory: stremio-core-web
run: npm run build

- name: Package
working-directory: stremio-core-web
run: npm pack

- name: Upload build artifact to GitHub release assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./stremio-core-web/*.tgz
tag: ${{ github.ref }}
overwrite: true
file_glob: true
48 changes: 48 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish

on:
release:
types: [released]

env:
NODE_VERSION: 12
WASM_PACK_VERSION: 0.12.1

jobs:
publish-stremio-core-web:
if: ${{ ! startsWith(github.ref, 'refs/tags/stremio-core-web') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
registry-url: https://registry.npmjs.org/
cache-dependency-path: stremio-core-web/package-lock.json

# For releasing we always use stable
- name: Rust setup
uses: dtolnay/[email protected]
with:
targets: wasm32-unknown-unknown
- uses: taiki-e/install-action@v2
with:
tool: wasm-pack@${{ env.WASM_PACK_VERSION }}

- name: Install NPM dependencies
working-directory: stremio-core-web
run: npm ci

- name: Build
working-directory: stremio-core-web
run: npm run build

- name: Publish to NPM
working-directory: stremio-core-web
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: npm publish --access public
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/target
*/target
**/*.rs.bk

**/node_modules
**/wasm_build
**/stremio_core_web.js
**/bridge.js
**/worker.js
**/stremio_core_web_bg.wasm
Loading

0 comments on commit 85fcd88

Please sign in to comment.