Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task/restructure workflow #1

Merged
merged 33 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ba038e0
initial github action
Apr 2, 2024
1de66ac
adding workflows
Apr 2, 2024
7dc985b
updating requirements
Apr 2, 2024
299fb96
adding npm package
Apr 2, 2024
3b499b4
adding .npmrc file
Apr 2, 2024
baad002
updating npm install
Apr 2, 2024
d30b52a
including docker
Apr 2, 2024
c357ced
including package.josn
Apr 2, 2024
399d50c
updating install
Apr 2, 2024
73d2df5
updating workflow
Apr 3, 2024
e976b9a
updating workflow
Apr 3, 2024
f014ff7
updating workflow
Apr 3, 2024
46c3f63
updating workflow
Apr 3, 2024
8b3bf41
updating workflow
Apr 3, 2024
bd41bfd
uptting back credentials
Apr 3, 2024
da7721a
updating workflow
Apr 3, 2024
795b2c8
updating workflow
Apr 3, 2024
06ff59b
updatig main.py and workflow
jharajeev55 Apr 5, 2024
f6295f8
fixing folder issue
jharajeev55 Apr 5, 2024
ee25cbe
fixing path issue
jharajeev55 Apr 5, 2024
4ae660c
fixing dir issue
jharajeev55 Apr 5, 2024
6097646
fixing dir remove issue
jharajeev55 Apr 5, 2024
dc58bdb
fixing path issue
jharajeev55 Apr 5, 2024
95e20ff
removing data folder
jharajeev55 Apr 5, 2024
554f945
updating configurations
jharajeev55 Apr 5, 2024
2d28aca
fixing path issue
jharajeev55 Apr 5, 2024
37cc22e
updating to latest node
jharajeev55 Apr 5, 2024
75386cd
updating with latest action version
jharajeev55 Apr 5, 2024
a4d43cf
running with windows-latest
jharajeev55 Apr 5, 2024
083f8af
updating workflow
jharajeev55 Apr 8, 2024
14cde29
removing release job , updating condition when job should trigger
jharajeev55 Apr 8, 2024
ffb1167
adding release job , updating changelog file
jharajeev55 Apr 10, 2024
bbb89e9
Update CHANGELOG.md
jharajeev55 Apr 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions .github/workflows/pr.yml
esarver marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Generate JSON and Save as Artifacts

on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
push:
tags:
- "*"

jobs:
build:
name: generate-json-and-save-as-artifacts
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: install node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://npm.pkg.github.com

- name: Install package from npm registry
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc
npm install

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: install requirements.txt
run: pip install -r requirements.txt

- name: Copy HTML file
run: cp -r node_modules/@tektronix/web-help-documents web-help-documents

- name: Run Python script to generate JSON
run: python main.py web-help-documents

- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: generated-json
path: data/
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
checks: write
pull-requests: read
needs:
- build
if: ${{ (endsWith(github.base_ref, 'main') && (contains(github.head_ref, 'release/')) || github.event.pull_request.merged ) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Get RC Version
id: lasttag
run: |
COMMIT="${{github.sha}}"
if ${{contains(github.head_ref, 'release/')}}; then
V="${{github.head_ref}}"
V="${V#release/}"
else
V="$(npm pkg get version)"
echo "Extracted Version: $V"
V="$(echo v"$V" | sed 's/\"//g')"
echo "Cleaned up Version: $V"
fi

# Check to see if the version tag already exists
# If it does, print a message and exit with an error code
if [ $(git tag --list "$V") ]; then
echo "Version tag already exists. Did you bump the version number?"
exit 1
fi

# Create an RC release if
# 1) This PR is a release branch that hasn't been merged to main.
# 2) This is a feature branch being merged into the main branch.
if ${{(! github.event.pull_request.merged && contains(github.head_ref, 'release/')) || (github.event.pull_request.merged && !contains(github.head_ref, 'release/'))}}; then
V="${V}-$(git tag --list ${V}* | wc -l)"
echo "RC Version: $V"
fi

CL=${V#v}
CL=${CL%-*}

echo "version=${V}" >> $GITHUB_OUTPUT
echo "cl_version=${CL}" >> $GITHUB_OUTPUT
echo "commit=${COMMIT}" >> $GITHUB_OUTPUT

- run: 'git tag --list ${V}*'
- name: Get Artifacts
uses: actions/download-artifact@v3
with:
name: generated-json
path: data/
- name: Get Changelog for this Tag
id: changelog
uses: coditory/changelog-parser@v1
with:
version: ${{steps.lasttag.outputs.cl_version}}
- name: Create Release
uses: ncipollo/release-action@v1
with:
name: ${{steps.lasttag.outputs.version}}
artifacts: "extension/*.vsix,sbom/**/*"
body: |
## Features Requests / Bugs

If you find issues or have a feature request, please enter a [new issue on GitHub](${{github.server_url}}/${{github.repository}}/issues/new).

## Installation

View the installation instructions in the [README](${{github.server_url}}/${{github.repository}}/blob/main/README.md)

## Changelog

${{steps.changelog.outputs.description}}

prerelease: ${{ (! github.event.pull_request.merged) || (github.event.pull_request.merged && ! contains(github.head_ref, 'release/')) }}
commit: ${{steps.lasttag.outputs.commit}}
makeLatest: true
tag: ${{steps.lasttag.outputs.version}}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
**/*.pyc
**/*.pyc
node_modules/
.vscode/
data/
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@tektronix:registry=https://npm.pkg.github.com
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
Security -- in case of vulnerabilities.
-->

## [Unreleased]
## [0.15.1]

### Changed
- workflow has been added for generaing json artifacts.

<!--Version Comparison Links-->
[Unreleased]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/tree/dev
[Unreleased]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/compare/v0.15.1...HEAD
[0.15.1]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/releases/tag/v0.15.1
34 changes: 26 additions & 8 deletions Configuration.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
# Folder path of webhelp file
import os

class Confiurations:
HELP_FILE_FOLDER_PATH = "C:\\Users\\rjha\\source\\repos\\GitHub\\tsp-toolkit-webhelp\\WebHelpDocs\\Commands_DMM7510\\"

HELP_FILE_FOLDER_PATH = "C:\\Users\\rjha\\source\\repos\\GitHub\\tsp-toolkit-webhelp\\WebHelpDocs\\Commands_DMM7510\\"
# model number
MODEL_NUMBER = "DMM7510"

# model number
MODEL_NUMBER = "DMM7510"
# Currently ist only get used for 26xx models
CHANNELS = ['a']

# Currently ist only get used for 26xx models
CHANNELS = ['a']
# folder path where generated json file will store
OUTPUT_FOLDER_PATH = os.path.join(os.getcwd(), "data")

# folder path where generated json file will store

OUTPUT_FOLDER_PATH = os.getcwd()+ "\\data"
SUPPORTED_MODELS = ["2450",
"2460",
"2461",
"2470",
"DMM7510",
"26XX"
]

MODEL_2600B_CHANNELS= {"2601B":["a"],
"2611B":["a"],
"2635B": ["a"],
"2604B": ["a", "b"],
"2614B": ["a", "b"],
"2602B": ["a", "b"],
"2612B": ["a", "b"],
"2634B": ["a", "b"],
"2636B": ["a", "b"]
}
12 changes: 6 additions & 6 deletions ParserGeneric/HelperFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import re
from bs4 import BeautifulSoup
from ordered_set import OrderedSet
from Configuration import MODEL_NUMBER
from Configuration import Confiurations
from helpers import cmd_param

supportedInstruments = "2601, 2602, 2611, 2612, 2635, 2636, 2601A, 2602A, 2611A, 2612A, 2635A, 2636A,2651A, 2657A, 2601B, 2601B-PULSE, 2602B, 2606B, 2611B, 2612B, 2635B, 2636B, 2604B, 2614B, 2634B,2601B-L, 2602B-L, 2611B-L, 2612B-L, 2635B-L, 2636B-L, 2604B-L, 2614B-L, 2634B-L"
Expand Down Expand Up @@ -109,7 +109,7 @@ def get_record(name, webhelpfile, cmd_type, default_value, descr, details, param
record["usage"] = usage
record["overloads"] = list(overloads)
record["examples"] = example
if(str(MODEL_NUMBER).find("26")!= -1):
if(str(Confiurations.MODEL_NUMBER).find("26")!= -1):
if flag == 1:
record["supported_models"] = temp_c
else:
Expand Down Expand Up @@ -269,7 +269,7 @@ def get_parameter_details(S, command_name):

param_desc = "\n".join([item.get_text(separator='\n') for item in data[1:]]) #24xx, dmm, daq

if(str(MODEL_NUMBER).find("26")!= -1):
if(str(Confiurations.MODEL_NUMBER).find("26")!= -1):
param_desc = "\n".join([item.get_text().replace("\n", "") for item in data[1:]])


Expand Down Expand Up @@ -434,9 +434,9 @@ def get_param_type(cmd, param_name) -> str:
if str(cmd).startswith("status.") and "*" in cmd:
return "number"

file_path = "ParserGeneric\\tti-command_param_data_type.txt"
if(str(MODEL_NUMBER).find("26")!= -1):
file_path = "ParserGeneric\\26xx-command_param_data_type.txt"
file_path = os.path.join("ParserGeneric","tti-command_param_data_type.txt")
esarver marked this conversation as resolved.
Show resolved Hide resolved
if(str(Confiurations.MODEL_NUMBER).find("26")!= -1):
file_path = os.path.join("ParserGeneric","26xx-command_param_data_type.txt")

paramTypeDetails = cmd_param.getParamTypeDetails(
os.path.abspath(file_path))
Expand Down
Loading
Loading