diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index aaa0203..ab0162b 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -5,16 +5,27 @@ on: push: branches: [main] +defaults: + run: + shell: bash -l {0} + jobs: pre-commit: runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/checkout@v2 + + - name: Install Conda environment with Micromamba + uses: mamba-org/provision-with-micromamba@main with: - python-version: 3.7 + environment-name: ipywebrtc-dev + environment-file: dev_environment.yml + python-version: ${{ matrix.python-version }} + mamba-version: "*" + auto-activate-base: false + channels: conda-forge + - name: Install dependencies run: | pip install ".[dev]" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c93d69a..c4e0e24 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,9 +36,6 @@ jobs: auto-activate-base: false channels: conda-forge - - name: Test flake8 - run: flake8 ipywebrtc --ignore=E501,F405 - - name: Install ipywebrtc run: pip install . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c6b58af..7eb4ee0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,6 +3,7 @@ repos: rev: "v3.1.0" hooks: - id: prettier + types: [javascript] stages: [commit] - repo: https://github.com/charliermarsh/ruff-pre-commit rev: "v0.1.9" diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..b56605b --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +node_modules +**/node_modules +**/lib +**/package.json \ No newline at end of file diff --git a/dev_environment.yml b/dev_environment.yml index 93c24fe..362ce92 100644 --- a/dev_environment.yml +++ b/dev_environment.yml @@ -3,7 +3,7 @@ channels: - conda-forge dependencies: - pip - - nodejs=14.* + - nodejs=16.* - yarn - jupyter-packaging - jupyterlab=3 @@ -15,4 +15,4 @@ dependencies: - sphinx_rtd_theme - pygments==2.6.1 - jupyter-sphinx - - precommit + - pre-commit diff --git a/js/webpack.config.js b/js/webpack.config.js index cfd30d6..16b5dad 100644 --- a/js/webpack.config.js +++ b/js/webpack.config.js @@ -1,5 +1,7 @@ var version = require("./package.json").version; var webpack = require("webpack"); +var crypto = require("crypto"); + // // Custom webpack loaders are generally the same for all webpack bundles, hence // // stored in a separate local variable. // var loaders = [ @@ -8,6 +10,11 @@ var webpack = require("webpack"); const path = require("path"); +// Workaround for loaders using "md4" by default, which is not supported in FIPS-compliant OpenSSL +var cryptoOrigCreateHash = crypto.createHash; +crypto.createHash = (algorithm) => + cryptoOrigCreateHash(algorithm == "md4" ? "sha256" : algorithm); + var rules = [ // { test: /\.json$/, use: "json-loader" }, ]; diff --git a/js/webpack.config.lab3.js b/js/webpack.config.lab3.js index 3efdb84..bc96e5b 100644 --- a/js/webpack.config.lab3.js +++ b/js/webpack.config.lab3.js @@ -1,5 +1,6 @@ var path = require("path"); var webpack = require("webpack"); +const crypto = require("crypto"); var plugins = [ new webpack.ProvidePlugin({ @@ -10,3 +11,8 @@ var plugins = [ module.exports = { plugins: plugins, }; + +// Workaround for loaders using "md4" by default, which is not supported in FIPS-compliant OpenSSL +const cryptoOrigCreateHash = crypto.createHash; +crypto.createHash = (algorithm) => + cryptoOrigCreateHash(algorithm == "md4" ? "sha256" : algorithm); diff --git a/setup.py b/setup.py index 2ab80ec..7a896b8 100644 --- a/setup.py +++ b/setup.py @@ -77,6 +77,7 @@ install_require=[ "ipywidgets>=7.4.0", ], + extras_require={"dev": ["pre-commit"]}, packages=find_packages(), zip_safe=False, cmdclass=cmdclass,