diff --git a/.github/codeql/jpl-misra.qls b/.github/codeql/jpl-misra.qls index e63ef04ab..6050a1ff7 100644 --- a/.github/codeql/jpl-misra.qls +++ b/.github/codeql/jpl-misra.qls @@ -12,8 +12,6 @@ - cpp/jsf/av-rule-168 # MISRA 6-2-2 - cpp/jsf/av-rule-202 - # MISRA Rule 9-5-1 - - cpp/jsf/av-rule-153 # JPL Rules - /cpp/jpl-c/*/ # Exclude queries with too many results @@ -28,3 +26,6 @@ # JPL 24 - cpp/jpl-c/multiple-stmts-per-line - cpp/jpl-c/multiple-var-decls-per-line + # Excluded since cFS use unions judiciously + # MISRA Rule 9-5-1 + - cpp/jsf/av-rule-153 diff --git a/.github/scripts/create_ccb_agenda.py b/.github/scripts/create_ccb_agenda.py new file mode 100644 index 000000000..deb12b274 --- /dev/null +++ b/.github/scripts/create_ccb_agenda.py @@ -0,0 +1,69 @@ +import subprocess +import json +import sys +import time +import os + +# extract pull request data from GitHub +repos = ['cFS', 'cFE', 'osal', 'psp', 'sch_lab', 'ci_lab', 'to_lab', 'sample_app', 'sample_lib', 'elf2cfetbl', 'tblcrctool','cFS-GroundSystem', 'CF', 'CS', 'DS','FM', 'HK', 'HS', 'LC', 'MD', 'MM', 'SC'] + +for repo in repos: + subprocess.Popen('gh pr list --repo nasa/' + str(repo) + ' --search "draft:false" --json number,author,title,url,additions,deletions,labels | jq -c ' + '\'reduce range(0, length) as $index (.; (.[$index].author=.[$index].author.login | .[$index].number=(.[$index].number|"\'' + str(repo) + '\' PR #\(.)") )) | .[]\' ' + '>> temp.json', shell=True) + +time.sleep(5) +subprocess.Popen('jq -s . temp.json > prs.json', shell=True) +time.sleep(5) + +# load a list of pull requests as python dictionaries +with open ('prs.json') as prs_file: + prs = json.load(prs_file) + +PrData = dict() # {author: [pr1, pr2, pr3, ...]} +AuthorPrChanges = dict() # {author: #TotalChanges} + +for pr in prs: + ignore = False + for label in pr['labels']: + if label['name'] == 'CCB:Ignore' or label['name'] == 'CCB:Approved': + ignore = True + break + if ignore == False: + if pr['author'] not in PrData: + PrData[pr['author']] = [pr] + AuthorPrChanges[pr['author']] = pr['additions'] + pr['deletions'] + else: + PrData[pr['author']].append(pr) + AuthorPrChanges[pr['author']] += pr['additions'] + pr['deletions'] + +# no prs to write, exit program +if len(PrData) == 0: + print("Failed to find relevant Pull Requests for the agenda. Exiting...\n") + sys.exit() + +# re-order dict according to sum(additions, deletions) of each pr for each author +AuthorPrChanges = {k: v for k, v in sorted(AuthorPrChanges.items(), key=lambda item: item[1])} + +# write to markdown +CCBfilename = "CCBAgenda.md" +with open(CCBfilename, 'w') as f: + f.write("## Items for Discussion\n\n") + for author in AuthorPrChanges.keys(): + f.write("### @" + author + "\n\n") + for pr_auth in PrData[author]: + if (author == pr_auth['author']): + f.write("[" + pr_auth['number'] + "](" + pr_auth['url'].replace("pull", "issues") + ") " + pr_auth['title'] + "\n\n") + +# close files +f.close() +prs_file.close() +time.sleep(5) +try: + os.remove("prs.json") + os.remove("temp.json") +except OSError: + pass + +time.sleep(5) + +if (os.stat(CCBfilename).st_size != 0): + print("CCB markdown has been successfully created") \ No newline at end of file diff --git a/.github/workflows/cfs-wiki.yml b/.github/workflows/cfs-wiki.yml new file mode 100644 index 000000000..3a688363b --- /dev/null +++ b/.github/workflows/cfs-wiki.yml @@ -0,0 +1,32 @@ +name: Update wiki + +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Force bash to apply pipefail option so pipeline failures aren't masked +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ubuntu-latest + + steps: + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: true + + - name: create CCB agenda + run: python3 .github/scripts/create_ccb_agenda.py + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Archive CCB agenda artifact + uses: actions/upload-artifact@v3 + with: + name: ccb-agenda + path: ./CCBAgenda.md \ No newline at end of file diff --git a/osal b/osal index e98bb23a9..f34759d6d 160000 --- a/osal +++ b/osal @@ -1 +1 @@ -Subproject commit e98bb23a94877480b32a75dfbdf995bf2e282f0d +Subproject commit f34759d6d6f7087e81afda94eccf7554e013cbe6