Skip to content

Commit e1618d8

Browse files
Tanmay DasPrabhakar Kumar
authored andcommitted
Github action workflows for development and release. Also include testing on Windows platforms.
1 parent db32711 commit e1618d8

File tree

7 files changed

+241
-183
lines changed

7 files changed

+241
-183
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) 2020-2022 The MathWorks, Inc
2+
3+
# Composite Action to Build and Publish in PyPi
4+
name: Build and Publish in PyPi
5+
inputs:
6+
pypi_token:
7+
description: 'PyPi API Token'
8+
required: true
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Set up Python 3.8
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: '3.8'
16+
17+
- name: Install Python build dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
python -m pip install wheel
21+
shell: bash
22+
23+
- name: Build Source and Binary wheel distributions
24+
run: python setup.py bdist_wheel sdist
25+
shell: bash
26+
27+
- name: Publish to PyPI.
28+
uses: pypa/gh-action-pypi-publish@release/v1
29+
with:
30+
user: __token__
31+
verbose: true
32+
password: ${{ inputs.pypi_token }}
33+
repository_url: https://upload.pypi.org/legacy/
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright (c) 2020-2022 The MathWorks, Inc
2+
3+
# Composite Action to generate Code Coverage XML and Upload it
4+
name: Generate Code Coverage XML
5+
runs:
6+
using: "composite"
7+
steps:
8+
- name: Set up Python 3.8
9+
uses: actions/setup-python@v2
10+
with:
11+
python-version: '3.8'
12+
13+
- name: Use Node.js 13.x
14+
uses: actions/setup-node@v2
15+
with:
16+
node-version: 13.x
17+
18+
- name: Install Python build dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
python -m pip install wheel
22+
pip install .[dev]
23+
shell: bash
24+
25+
- name: Generate Code Coverage report for Python code
26+
run: pytest --cov=./ --cov-report=xml
27+
shell: bash
28+
29+
- name: Upload python coverage report to Codecov
30+
uses: codecov/codecov-action@v2
31+
with:
32+
directory: ./
33+
name: Python-codecov
34+
files: ./coverage.xml
35+
fail_ci_if_error: true
36+
verbose: true
37+
38+
- name: Install Node Dependencies
39+
run: npm --prefix gui install gui
40+
shell: bash
41+
42+
- name: Generate code coverage for Javascript code
43+
run: npm --prefix gui test -- --coverage --watchAll=false
44+
shell: bash
45+
46+
- name: Upload Javscript coverage report to Codecov
47+
uses: codecov/codecov-action@v2
48+
with:
49+
directory: ./gui/coverage/
50+
fail_ci_if_error: true
51+
verbose: true
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copyright (c) 2020-2022 The MathWorks, Inc
2+
3+
# Workflow to test MATLAB-Proxy while releasing to PyPi
4+
name: Release to PyPI
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
call-run-tests:
12+
# Call workflow for running node and python tests
13+
uses: ./.github/workflows/run-tests.yml
14+
15+
build_and_publish_pypi:
16+
needs: call-run-tests
17+
if: success()
18+
# windows container is not required here
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
with:
24+
ref: ${{github.sha}}
25+
26+
- name: Build and Publish in PyPi
27+
uses: ./.github/actions/build_and_publish_pypi
28+
with:
29+
pypi_token: ${{ secrets.PYPI_TOKEN }}
30+
31+
# build_and_publish_anaconda:
32+
# needs: [build_and_publish_pypi]
33+
# if: success()
34+
# runs-on: ubuntu-latest
35+
36+
# steps:
37+
# - name: Checkout
38+
# uses: actions/checkout@v2
39+
# with:
40+
# ref: ${{github.sha}}
41+
42+
# - name: Set up Python 3.6
43+
# uses: actions/setup-python@v2
44+
# with:
45+
# python-version: 3.6
46+
47+
# - name: Install Python build dependencies
48+
# run: |
49+
# python -m pip install --upgrade pip
50+
# python -m pip install wheel
51+
# python -m pip install .[dev]
52+
53+
# - name: Build and Publish to Anaconda.
54+
# env:
55+
# ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
56+
57+
# run: |
58+
# # $CONDA is an environment variable pointing to the root of the miniconda directory
59+
# echo $CONDA/bin >> $GITHUB_PATH
60+
# conda install -y conda-build
61+
# conda install -y anaconda-client
62+
# cd ./anaconda
63+
# conda skeleton pypi matlab-proxy
64+
# python parse_meta_file.py
65+
# conda build ./matlab-proxy --python 3.6 --output-folder ./build
66+
# $CONDA/bin/anaconda upload --label main ./build/linux-64/matlab*.tar.gz

.github/workflows/release.yml

Lines changed: 0 additions & 124 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) 2020-2022 The MathWorks, Inc
2+
3+
# Workflow to test MATLAB-Proxy in Development workflow
4+
name: Testing MATLAB Proxy during feature development
5+
6+
on:
7+
# Trigger workflow both manually and pushing to
8+
# branches other than main
9+
workflow_dispatch:
10+
push:
11+
branches-ignore:
12+
- "main"
13+
14+
jobs:
15+
# Three runs for dev mode workflow to catch sporadic failures
16+
# 'uses' and 'strategy' properties are not supported together
17+
# so run number needs to be hardcoded
18+
call-run-tests-r000:
19+
uses: ./.github/workflows/run-tests.yml
20+
with:
21+
continue-on-error: true
22+
call-run-tests-r001:
23+
uses: ./.github/workflows/run-tests.yml
24+
with:
25+
continue-on-error: true
26+
call-run-tests-r002:
27+
uses: ./.github/workflows/run-tests.yml
28+
with:
29+
continue-on-error: true
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (c) 2020-2022 The MathWorks, Inc
2+
3+
# Workflow to test MATLAB-Proxy while releasing to GitHub
4+
name: Testing MATLAB Proxy in Main Branch
5+
6+
on:
7+
# Trigger workflow both manually and pushing to main
8+
workflow_dispatch:
9+
push:
10+
branches:
11+
- "main"
12+
13+
jobs:
14+
call-run-tests:
15+
# Runs node and python tests
16+
uses: ./.github/workflows/run-tests.yml
17+
18+
generate-code-coverage:
19+
# Generates Code coverage and uploads it
20+
needs: call-run-tests
21+
if: success()
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v2
26+
27+
- name: Generate Code Coverage XML
28+
uses: ./.github/actions/generate-code-coverage

0 commit comments

Comments
 (0)