Skip to content

Commit

Permalink
Merge branch 'development' into latest-stremio-core-web
Browse files Browse the repository at this point in the history
Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>
  • Loading branch information
elpiel committed Jul 9, 2024
2 parents 84eca4d + 85fcd88 commit aaad3c1
Show file tree
Hide file tree
Showing 244 changed files with 31,680 additions and 370 deletions.
9 changes: 5 additions & 4 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

[build]
# for `--enable-index-page` it is required to pass `-Z unstable-options` to rustdocs
# rustdocflags = ["--cfg", "docsrs", "-Z", "unstable-options", "--enable-index-page"]

[alias]
# Requires cargo-watch
ww = ["watch-wasm"]
watch-wasm = ["watch", "--shell", "./scripts/build.sh --dev"]
build-docs = "doc --no-deps --workspace --document-private-items"

97 changes: 77 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,48 @@
name: Build

on:
push:
branches:
- '**'
tags-ignore:
- '**'
on: [push]

# Stops the running workflow of previous pushes
concurrency:
group: ${{ github.ref }}
# cancel per workflow
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
NODE_VERSION: 12
WASM_PACK_VERSION: 0.12.1

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

steps:

- name: Checkout
uses: actions/checkout@v4

- name: Rust setup (stable)
uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- name: Lint - rustfmt
run: cargo fmt --all -- --check

- name: Lint - clippy
run: cargo clippy --all --no-deps -- -D warnings

- name: Test
run: cargo test

- name: 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
Expand All @@ -31,19 +56,15 @@ jobs:

- uses: Swatinem/rust-cache@v2

- name: Lint - rustfmt
run: cargo fmt --all -- --check

- name: Lint - clippy
run: cargo clippy --all --no-deps -- -D warnings

- 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
Expand All @@ -52,10 +73,46 @@ jobs:
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
- 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
38 changes: 38 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy docs

on:
push:
branches:
- development

jobs:
deploy-docs:
name: Deploy docs on gh-pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Rust setup (nightly)
uses: dtolnay/rust-toolchain@master
with:
# Use nightly to build the docs with `--cfg docsrs`
toolchain: nightly
components: rust-docs

- name: Build docs
# Building locally:
# for `--enable-index-page` it is required to pass `-Z unstable-options` to rustdocs
run: RUSTDOCFLAGS="--cfg docsrs -Z unstable-options --enable-index-page" cargo +nightly build-docs

- name: Prepare /docs
run: |
rm -rf ./docs
mv target/doc ./docs
- name: Deploy gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
38 changes: 38 additions & 0 deletions .github/workflows/msrv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: MSRV build

on:
push:
# will checkout the default branch `development`
schedule:
# run every Friday at 17:00
- cron: '00 17 * * 5'
# Or ran manually
workflow_dispatch:

# Stops the running workflow of previous pushes
concurrency:
# cancel per workflow
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
RUST_MSRV_VERSION: '1.67.1'

jobs:
build:
name: Test and build
runs-on: ubuntu-latest

steps:
- name: Rust setup (MSRV)
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_MSRV_VERSION }}

- uses: Swatinem/rust-cache@v2

- name: Checkout
uses: actions/checkout@v4

- run: cargo check
- run: cargo test
20 changes: 13 additions & 7 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ env:
WASM_PACK_VERSION: 0.12.1

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

- name: Setup NodeJS
uses: actions/setup-node@v3
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/rust-toolchain@1.77
Expand All @@ -31,19 +34,22 @@ jobs:
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: ./*.tgz
file: ./stremio-core-web/*.tgz
tag: ${{ github.ref }}
overwrite: true
file_glob: true
13 changes: 9 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ env:
WASM_PACK_VERSION: 0.12.1

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

- name: Setup NodeJS
uses: actions/setup-node@v3
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
Expand All @@ -32,12 +34,15 @@ jobs:
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
run: npm publish --access public
working-directory: stremio-core-web
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: npm publish --access public
15 changes: 9 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/target
/node_modules
/wasm_build
stremio_core_web.js
bridge.js
worker.js
stremio_core_web_bg.wasm
*/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 aaad3c1

Please sign in to comment.