From 0cbfdd7f39f7b0050a6ef2097cda14f2e9504bd5 Mon Sep 17 00:00:00 2001 From: Ariel Adams Date: Thu, 18 Mar 2021 15:24:56 -0500 Subject: [PATCH] Fix #205, Remove Duplicate Workflows --- .github/workflows/build-cfs-deprecated.yml | 23 ++++++++++++++++----- .github/workflows/build-cfs.yml | 23 ++++++++++++++++----- .github/workflows/codeql-build.yml | 23 +++++++++++++++++++++ .github/workflows/static-analysis.yml | 24 ++++++++++++++++------ 4 files changed, 77 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-cfs-deprecated.yml b/.github/workflows/build-cfs-deprecated.yml index 67a996d4e..b06b96144 100644 --- a/.github/workflows/build-cfs-deprecated.yml +++ b/.github/workflows/build-cfs-deprecated.yml @@ -1,11 +1,8 @@ name: "Deprecated Build, Test, and Run" -# Run every time a new commit pushed to main or for pull requests +# Run every time a new commit pushed or for pull requests on: push: - branches: - - main - pull_request: env: @@ -13,11 +10,27 @@ env: OMIT_DEPRECATED: false jobs: - + #Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action. + duplicate-job: + runs-on: ubuntu-latest + # Map a step output to a job output + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@master + with: + concurrent_skipping: 'same_content' + skip_after_successful_duplicate: 'true' + do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' + # Set the job key. The key is displayed as the job name # when a job name is not provided build-cfs: + #Continue if duplicate-job found no duplicates. Always runs for pull-requests. + needs: duplicate-job + if: ${{ needs.duplicate-job.outputs.should_skip != 'true' }} name: Build runs-on: ubuntu-18.04 diff --git a/.github/workflows/build-cfs.yml b/.github/workflows/build-cfs.yml index bbddd1f83..e6ab1fe0d 100644 --- a/.github/workflows/build-cfs.yml +++ b/.github/workflows/build-cfs.yml @@ -1,11 +1,8 @@ name: Build, Test, and Run [OMIT_DEPRECATED=true] -# Run every time a new commit pushed to main or for pull requests +# Run every time a new commit pushed or for pull requests on: push: - branches: - - main - pull_request: env: @@ -13,8 +10,24 @@ env: OMIT_DEPRECATED: true jobs: - + #Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action. + duplicate-job: + runs-on: ubuntu-latest + # Map a step output to a job output + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@master + with: + concurrent_skipping: 'same_content' + skip_after_successful_duplicate: 'true' + do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' + build-cfs: + #Continue if duplicate-job found no duplicates. Always runs for pull-requests. + needs: duplicate-job + if: ${{ needs.duplicate-job.outputs.should_skip != 'true' }} name: Build runs-on: ubuntu-18.04 diff --git a/.github/workflows/codeql-build.yml b/.github/workflows/codeql-build.yml index abab28920..e78d43c78 100644 --- a/.github/workflows/codeql-build.yml +++ b/.github/workflows/codeql-build.yml @@ -13,25 +13,45 @@ env: BUILDTYPE: release jobs: + #Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action. + duplicate-job: + runs-on: ubuntu-latest + # Map a step output to a job output + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@master + with: + concurrent_skipping: 'same_content' + skip_after_successful_duplicate: 'true' + do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' + CodeQL-Build: + #Continue if duplicate-job found no duplicates. Always runs for pull-requests. + needs: duplicate-job + if: ${{ needs.duplicate-job.outputs.should_skip != 'true' }} runs-on: ubuntu-18.04 timeout-minutes: 15 steps: # Checks out a copy of your repository - name: Checkout code + if: ${{ !steps.skip-workflow.outputs.skip }} uses: actions/checkout@v2 with: repository: nasa/cFS submodules: true - name: Check versions + if: ${{ !steps.skip-workflow.outputs.skip }} run: | git log -1 --pretty=oneline git submodule - name: Initialize CodeQL + if: ${{ !steps.skip-workflow.outputs.skip }} uses: github/codeql-action/init@v1 with: languages: c @@ -39,14 +59,17 @@ jobs: # Setup the build system - name: Copy sample_defs + if: ${{ !steps.skip-workflow.outputs.skip }} run: | cp ./cfe/cmake/Makefile.sample Makefile cp -r ./cfe/cmake/sample_defs sample_defs # Setup the build system - name: Make Install + if: ${{ !steps.skip-workflow.outputs.skip }} run: make # Run CodeQL - name: Perform CodeQL Analysis + if: ${{ !steps.skip-workflow.outputs.skip }} uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 65d56a286..7fd5578e8 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -1,16 +1,29 @@ name: Static Analysis -# Run this workflow every time a new commit pushed to your repository +# Run this workflow every time a new commit pushed to your repository and for pull requests on: push: - branches: - - main - pull_request: jobs: + #Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action. + duplicate-job: + runs-on: ubuntu-latest + # Map a step output to a job output + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@master + with: + concurrent_skipping: 'same_content' + skip_after_successful_duplicate: 'true' + do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' static-analysis: + #Continue if duplicate-job found no duplicates. Always runs for pull-requests. + needs: duplicate-job + if: ${{ needs.duplicate-job.outputs.should_skip != 'true' }} name: Run cppcheck runs-on: ubuntu-18.04 @@ -19,8 +32,7 @@ jobs: matrix: cppcheck: [bundle, cfe, osal, psp] - steps: - + steps: - name: Install cppcheck run: sudo apt-get install cppcheck -y