Changes to make standalone run also from within a CMSSW area #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Static checks | |
on: | |
issue_comment: | |
types: [created] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.issue.number }}-${{ contains(github.event.comment.body, '/run checks') || contains(github.event.comment.body, '/run all') }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
linter: | |
if: > | |
github.event.issue.pull_request && | |
(contains(github.event.comment.body, '/run checks') || contains(github.event.comment.body, '/run all')) && | |
(github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'CONTRIBUTOR') | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout PR | |
uses: actions/checkout@v4 | |
with: | |
ref: refs/pull/${{ github.event.issue.number }}/head | |
sparse-checkout: | | |
.clang-format | |
RecoTracker/LST | |
RecoTracker/LSTCore | |
- name: Get commit SHA | |
run: | | |
sha=$(git rev-parse HEAD) | |
echo "COMMIT_SHA=$sha" >> $GITHUB_ENV | |
- name: Create App Token | |
uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.APP_ID }} | |
private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Create in progress check | |
uses: LouisBrunner/[email protected] | |
with: | |
token: ${{ steps.app-token.outputs.token }} | |
sha: ${{ env.COMMIT_SHA }} | |
name: Static Checks | |
status: in_progress | |
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
output: | | |
{"title": "This check has started...", "summary": "The logs can be found [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})."} | |
- name: Mount cvmfs | |
uses: cvmfs-contrib/github-action-cvmfs@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Generate compilation database | |
run: | | |
# There are some errors when running the script, but they don't affect anything important. | |
# We only need to run it to set up some environment variables, so we suppress the output. | |
cd RecoTracker/LSTCore/standalone | |
source setup.sh 1> /dev/null 2> /dev/null | |
pip install compiledb compdb | |
cd SDL | |
make BACKEND=cpu explicit_cache -Bnwk > build_log.txt | |
compiledb < build_log.txt | |
# This extra step is needed to generate compilation commands for headers | |
compdb list > compile_commands_new.json | |
mv compile_commands_new.json ${{ github.workspace }}/compile_commands.json | |
rm compile_commands.json | |
- name: Run linter | |
uses: cpp-linter/cpp-linter-action@v2 | |
id: linter | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
version: 16 | |
style: file | |
thread-comments: true | |
# disable clang-tidy for now | |
tidy-checks: '-*' | |
files-changed-only: false | |
ignore: RecoTracker/LSTCore/standalone | |
extra-args: '-U_OPENMP -ferror-limit=0' | |
- name: Fail job if there were checks that failed | |
if: steps.linter.outputs.checks-failed > 0 | |
run: exit 1 | |
- name: Create completed check | |
uses: LouisBrunner/[email protected] | |
if: always() | |
with: | |
token: ${{ steps.app-token.outputs.token }} | |
sha: ${{ env.COMMIT_SHA }} | |
name: Static Checks | |
conclusion: ${{ job.status }} | |
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
output: | | |
{"title": "Status: ${{ job.status }}", "summary": "The logs can be found [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})."} |