This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #361 from SegmentLinking/fix-ci
Fix a few issues with the CI
- Loading branch information
Showing
4 changed files
with
132 additions
and
19 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ on: | |
types: [created] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.issue.number }} | ||
group: ${{ github.workflow }}-${{ github.event.issue.number }}-${{ contains(github.event.comment.body, '/run standalone') }}-${{ contains(github.event.comment.body, '/run cmssw') }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
|
@@ -20,11 +20,33 @@ jobs: | |
(github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'CONTRIBUTOR') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout PR | ||
- name: Check out PR | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: refs/pull/${{ github.event.issue.number }}/head | ||
- 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 }} | ||
skip-token-revoke: true | ||
- name: Create in progress check | ||
uses: LouisBrunner/[email protected] | ||
with: | ||
token: ${{ steps.app-token.outputs.token }} | ||
sha: ${{ env.COMMIT_SHA }} | ||
name: Run Standalone PU200 | ||
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: Build and run PR | ||
timeout-minutes: 60 | ||
id: build-and-run | ||
uses: SegmentLinking/TrackLooper-actions/standalone@v1 | ||
with: | ||
|
@@ -56,8 +78,26 @@ jobs: | |
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: `There was a problem while building and running in standalone mode. You can find a log of the job [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).` | ||
body: `There was a problem while building and running in standalone mode. The logs can be found [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).` | ||
}) | ||
- name: Create App Token | ||
if: always() | ||
uses: actions/create-github-app-token@v1 | ||
id: app-token-end | ||
with: | ||
app-id: ${{ secrets.APP_ID }} | ||
private-key: ${{ secrets.APP_PRIVATE_KEY }} | ||
- name: Create completed check | ||
uses: LouisBrunner/[email protected] | ||
if: always() | ||
with: | ||
token: ${{ steps.app-token-end.outputs.token }} | ||
sha: ${{ env.COMMIT_SHA }} | ||
name: Run Standalone PU200 | ||
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 }})."} | ||
cmssw: | ||
if: > | ||
|
@@ -70,6 +110,27 @@ jobs: | |
uses: actions/checkout@v4 | ||
with: | ||
ref: refs/pull/${{ github.event.issue.number }}/head | ||
- 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 }} | ||
skip-token-revoke: true | ||
- name: Create in progress check | ||
uses: LouisBrunner/[email protected] | ||
with: | ||
token: ${{ steps.app-token.outputs.token }} | ||
sha: ${{ env.COMMIT_SHA }} | ||
name: Run CMSSW 21034.1 | ||
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: Get CMSSW branch name | ||
env: | ||
COMMENT_BODY: ${{ github.event.comment.body }} | ||
|
@@ -78,14 +139,13 @@ jobs: | |
cmssw_branch= | ||
while IFS= read -r line; do | ||
echo "$line" | ||
if [[ $line == *"/run cmssw"* ]]; then | ||
if [[ $line == "/run cmssw"* ]]; then | ||
# Check if there is a branch after "/run cmssw" | ||
words=($line) | ||
cmssw_branch="${words[2]}" | ||
# Validate the extracted branch to avoid code injection | ||
if ! [[ $cmssw_branch =~ ^[[:alnum:]_-]+$ ]]; then | ||
echo "Branch name is invalid. Ignoring..." | ||
cmssw_branch= | ||
if [ -n "$cmssw_branch" ]; then | ||
cmssw_branch=$(git check-ref-format --branch $cmssw_branch || echo "default") | ||
fi | ||
fi | ||
done <<< "$COMMENT_BODY" | ||
|
@@ -95,6 +155,7 @@ jobs: | |
echo "Using CMSSW branch: $cmssw_branch" | ||
echo "cmssw-branch=$cmssw_branch" >> $GITHUB_ENV | ||
- name: Build and run PR | ||
timeout-minutes: 200 | ||
id: build-and-run | ||
uses: SegmentLinking/TrackLooper-actions/cmssw@v1 | ||
with: | ||
|
@@ -127,5 +188,23 @@ jobs: | |
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: `There was a problem while building and running with CMSSW. You can find a log of the job [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).` | ||
body: `There was a problem while building and running with CMSSW. The logs can be found [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).` | ||
}) | ||
- name: Create App Token | ||
if: always() | ||
uses: actions/create-github-app-token@v1 | ||
id: app-token-end | ||
with: | ||
app-id: ${{ secrets.APP_ID }} | ||
private-key: ${{ secrets.APP_PRIVATE_KEY }} | ||
- name: Create completed check | ||
uses: LouisBrunner/[email protected] | ||
if: always() | ||
with: | ||
token: ${{ steps.app-token-end.outputs.token }} | ||
sha: ${{ env.COMMIT_SHA }} | ||
name: Run CMSSW 21034.1 | ||
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 }})."} |
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
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