Skip to content

Disable webpack production mode in packaging to fix issue in linux #1321

Disable webpack production mode in packaging to fix issue in linux

Disable webpack production mode in packaging to fix issue in linux #1321

Workflow file for this run

name: Build and Publish RPE
on:
push:
tags:
- '*'
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- ubuntu-22.04 # This is CentOS 7 under the hood
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
env:
MODE: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Bring in device.xml
uses: actions/checkout@v4
with:
repository: os-fpga/Raptor
path: Raptor
sparse-checkout: 'etc'
- name: Setup Node.js ${{ matrix.os }}
if: ${{ matrix.os != 'ubuntu-22.04' }}
uses: actions/setup-node@v4
with:
node-version: 20.11 # if update this then also update in Dockerfile for centos
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8 # if update this then also update in Dockerfile for centos
- name: Login to the Container registry
if: ${{ matrix.os == 'ubuntu-22.04' }}
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull the CentOS image
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: docker pull ghcr.io/${{ github.repository_owner }}/rapid_power_estimator:centos7latest
- name: Shell configuration on ${{ matrix.os }}
if: ${{ matrix.os != 'ubuntu-22.04' }}
run: |
node --version
python3 -V
- name: Shell configuration on CentOS 7
if: ${{ matrix.os == 'ubuntu-22.04' }}
uses: addnab/docker-run-action@v3
with:
shell: bash
image: ghcr.io/${{ github.repository_owner }}/rapid_power_estimator:centos7latest
run: |
source /opt/rh/devtoolset-11/enable
cmake --version
node --version
python3 -V
- name: Install Dep. packages Linux latest & windows & MacOS
if: ${{ matrix.os != 'ubuntu-22.04' }}
run: |
npm install
python3 -m pip install -r requirements.txt
npx playwright install --with-deps
- name: Unit Pytest Linux latest & windows & MacOS
if: ${{ matrix.os != 'ubuntu-22.04' }}
run: python3 -m pytest
- name: Unit Jtest Linux latest & windows & MacOS
if: ${{ matrix.os != 'ubuntu-22.04' }}
run: npm test
- name: E2E Playwright tests on Linux latest & MacOS
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
cp -rf Raptor/etc backend
npm run compile && xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npx playwright test
- name: cat RPE log
if: matrix.os == 'ubuntu-latest' && always()
run: find $HOME -type f -name "rpe.log" -exec cat {} +
- name: Run ESLint only on ubuntu-latest
if: ${{ matrix.os == 'ubuntu-latest' }}
run: npx eslint src/
- name: Install packages CentOS 7 & Run pytest & frontend test
if: ${{ matrix.os == 'ubuntu-22.04' }}
uses: addnab/docker-run-action@v3
with:
shell: bash
image: ghcr.io/${{ github.repository_owner }}/rapid_power_estimator:centos7latest
options: -v ${{ github.workspace }}:/work
run: |
cd /work
npm install
python3 -m pip install -r requirements.txt
python3 -m pytest
npm test
publish:
needs: test
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04 # This is CentOS 7 under the hood
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
permissions:
contents: write
packages: read
env:
MODE: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.os }}
if: ${{ matrix.os != 'ubuntu-22.04' }}
uses: actions/setup-node@v4
with:
node-version: 20.11 # if update this then also update in Dockerfile for centos
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8 # if update this then also update in Dockerfile for centos
- name: Login to the Container registry
if: ${{ matrix.os == 'ubuntu-22.04' }}
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull the CentOS image
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: docker pull ghcr.io/${{ github.repository_owner }}/rapid_power_estimator:centos7latest
- name: Shell configuration on ${{ matrix.os }}
if: ${{ matrix.os != 'ubuntu-22.04' }}
run: |
node --version
python3 -V
- name: Shell configuration on CentOS 7
if: ${{ matrix.os == 'ubuntu-22.04' }}
uses: addnab/docker-run-action@v3
with:
shell: bash
image: ghcr.io/${{ github.repository_owner }}/rapid_power_estimator:centos7latest
run: |
source /opt/rh/devtoolset-11/enable
cmake --version
node --version
python3 -V
- name: Install packages ${{ matrix.os }}
if: ${{ matrix.os != 'ubuntu-22.04' }}
run: |
npm install
python3 -m pip install -r requirements.txt
- name: Create Package on ${{ matrix.os }}
if: ${{ matrix.os == 'macos-12' || matrix.os == 'windows-latest' }}
run: |
npm run dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Package on Linux
if: ${{ matrix.os == 'ubuntu-22.04' }}
uses: addnab/docker-run-action@v3
with:
shell: bash
image: ghcr.io/${{ github.repository_owner }}/rapid_power_estimator:centos7latest
options: -v ${{ github.workspace }}:/work
run: |
cd /work
npm install
python3 -m pip install -r requirements.txt
npm run dist
ls dist
tar -czvf rapid_power_estimator_linux.tar.gz -C dist/linux-unpacked .
mv rapid_power_estimator_linux.tar.gz dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run on refs/tags only
run: |
echo ${{ github.ref }}
- name: Upload Package
if: ${{ github.ref == 'refs/heads/main' && matrix.os != 'windows-latest' }}
uses: actions/[email protected]
with:
name: rapid_power_estimator_${{ matrix.os }}
path: dist/rapid_power_estimator*.tar.gz
- name: Upload Package
if: ${{ github.ref == 'refs/heads/main' && matrix.os == 'windows-latest' }}
uses: actions/[email protected]
with:
name: rapid_power_estimator_${{ matrix.os }}
path: dist/rapid_power_estimator*.exe
- name: Upload Release
if: ${{ matrix.os != 'windows-latest' && contains(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v1
with:
files: dist/rapid_power_estimator*.tar.gz
- name: Upload Release
if: ${{ matrix.os == 'windows-latest' && contains(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v1
with:
files: dist/rapid_power_estimator*.exe
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
- name: Set up virtual environment
run: |
python3 -m venv venv
source venv/bin/activate
- name: Install dependencies in virtual environment
run: |
source venv/bin/activate
pip install -r requirements.txt
npm install
- name: Run pytest with Codecov
run: |
source venv/bin/activate
python3 -m pytest --cov=. --cov-report=term-missing --cov-report=xml
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: os-fpga/rapid_power_estimator
- name: Run npm test with Codecov
run: npm test
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: os-fpga/rapid_power_estimator
files: ./coverage.xml,./coverage/lcov.info