Skip to content

fix: trigger github actions on pull requests #1201

fix: trigger github actions on pull requests

fix: trigger github actions on pull requests #1201

Workflow file for this run

name: Build
on:
- push
- pull_request
# Stops the running workflow of previous pushes
concurrency:
# cancel per workflow
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
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
uses: actions/checkout@v4
- name: Rust setup
uses: dtolnay/rust-toolchain@1.77
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
# if merge request, the ref_name will be e.g. `705/merge`
# so we need to recursively create these 2 folders
# create folder for release and dev builds to be published on GH pages
- run: mkdir -p ./build/${{ github.ref_name }}/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/${{ github.ref_name }}
- 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/${{ github.ref_name }}/dev
- name: Deploy gh-pages
if: ${{ github.actor != 'dependabot[bot]' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# the build directory already contains the `github.ref_name` as subfolder(s)
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/
allow_empty_commit: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'