Skip to content

Fix type annotations in sst_unittest_support.py #204

Fix type annotations in sst_unittest_support.py

Fix type annotations in sst_unittest_support.py #204

name: SST-CORE cmake-format TEST
on:
workflow_dispatch:
pull_request_target:
branches-ignore:
- master
# Push option may be used in the future for developers forks
# push:
# branches-ignore:
# - master
# NOTE: This script is run using pull_request_target. It is critical that
# that any changes to this script be looked at very carefully.
# !! DO NOT COMPILE OR RUN ANY CODE FROM THE PR SOURCE REPO !!
# Any changes to this script will not be run until it is merged into
# the main repo.
# This script is used to do a cmake-format check on the
# PR source repo to ensure it is formatted correctly. It will initially set
# the AT: WIP label to try to stop the Autottester from processing the PR, and
# then perform the cmake-format test using a 3rd party action. It will then
# set labels and add comments in the conversation for Pass or Failure as
# appropriate. Any labels that do not exist will be created. Also we use
# the step command "continue-on-error" to prevent a trying to remove a
# missing label from failing the script.
### NOTE: This script owes a lot to the work of Stephanie Eckles; see:
### https://dev.to/5t3ph/github-workflows-for-newbies-add-labels-and-comments-to-pull-requests-37da
### Also look at https://octokit.github.io/rest.js/v18 for available script commands
defaults:
run:
shell: bash -l {0}
jobs:
Test_With_cmake-format:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
python-version: [3.8]
name: Test:${{ matrix.os }}/PY-${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
steps:
# Set the WIP label immediately before testing
- name: SET WIP Label before testing
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['AT: WIP']
})
# Checkout this users SST-core repo/branch
- name: Checkout Users SST-Core source
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
# Running the github action for cmake format
- name: Run cmake-format
uses: PuneetMatharu/cmake-format-lint-action@153d95f1343baa771b35d1410b3e61d37130cf6e # v1.0.3
with:
args: --config-files experimental/.cmake-format.yaml --check
#############################################
# LABEL RESULTS - USING actions/github-script
#############################################
# Label the Results - FOR FAILURE
- name: ADD FAIL + WIP Label Results for Failure
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['AT: CMAKE-FORMAT FAIL', 'AT: WIP']
})
if: ${{ failure() }}
- name: REMOVE PASS Label Results for Failure
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'AT: CMAKE-FORMAT PASS'
})
if: ${{ failure() }}
continue-on-error: true
- name: ADD COMMENT ABOUT FAIL
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '**CMAKE-FORMAT TEST - FAILED** (on last commit): <br>Run > ./scripts/cmake-format-test.sh using cmake-format to check formatting'
})
if: ${{ failure() }}
#############################
# Label the Results - FOR SUCCESS
- name: ADD PASS Label Results for Success
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['AT: CMAKE-FORMAT PASS']
})
if: ${{ success() }}
- name: REMOVE WIP Label Results for Success
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'AT: WIP'
})
if: ${{ success() }}
continue-on-error: true
- name: REMOVE FAIL Label Results for Success
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'AT: CMAKE-FORMAT FAIL'
})
if: ${{ success() }}
continue-on-error: true
- name: ADD COMMENT ABOUT SUCCESS
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '**CMAKE-FORMAT TEST - PASSED**'
})
if: ${{ success() }}