-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* prettier check * add automatic formatting updates * make script executable * exclude workflow files * Automated formatting of files (#69) Co-authored-by: Philip Top <top1@llnl.gov> Co-authored-by: HELICS-bot <HELICS-bot@users.noreply.github.com> * update the markdownlintrc * add dockerfile linter * update config location * update create-file-docker image * remove markdown from codacy * fix codacy Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: HELICS-bot <HELICS-bot@users.noreply.github.com>
- Loading branch information
1 parent
e43cb5a
commit 5a329cd
Showing
29 changed files
with
969 additions
and
612 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
steps: | ||
- task: CMake@1 | ||
inputs: | ||
cmakeArgs: .. -DCMAKE_CXX_STANDARD=$(units.std) -DUNITS_HEADER_ONLY=$(units.header) -DCMAKE_BUILD_TYPE=$(units.build_type) $(units.options) | ||
displayName: 'Configure' | ||
env: | ||
GIT_SSL_NO_VERIFY: 1 | ||
|
||
- task: CMake@1 | ||
inputs: | ||
cmakeArgs: .. -DCMAKE_CXX_STANDARD=$(units.std) -DUNITS_HEADER_ONLY=$(units.header) -DCMAKE_BUILD_TYPE=$(units.build_type) $(units.options) | ||
displayName: 'Configure' | ||
env: | ||
GIT_SSL_NO_VERIFY: 1 | ||
|
||
- script: cmake --build . | ||
displayName: 'Build' | ||
workingDirectory: build | ||
|
||
- script: cmake --build . | ||
displayName: 'Build' | ||
workingDirectory: build |
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 |
---|---|---|
@@ -1,16 +1,15 @@ | ||
steps: | ||
# Note that silkeh/clang does not include ca-certificates, so check the shasum for verification | ||
- bash: | | ||
wget --no-check-certificate "https://cmake.org/files/v3.14/cmake-3.14.3-Linux-x86_64.tar.gz" | ||
echo "29faa62fb3a0b6323caa3d9557e1a5f1205614c0d4c5c2a9917f16a74f7eff68 cmake-3.14.3-Linux-x86_64.tar.gz" | shasum -sca 256 | ||
displayName: Download CMake | ||
# Note that silkeh/clang does not include ca-certificates, so check the shasum for verification | ||
- bash: | | ||
wget --no-check-certificate "https://cmake.org/files/v3.14/cmake-3.14.3-Linux-x86_64.tar.gz" | ||
echo "29faa62fb3a0b6323caa3d9557e1a5f1205614c0d4c5c2a9917f16a74f7eff68 cmake-3.14.3-Linux-x86_64.tar.gz" | shasum -sca 256 | ||
displayName: Download CMake | ||
- task: ExtractFiles@1 | ||
inputs: | ||
archiveFilePatterns: 'cmake*.tar.gz' | ||
destinationFolder: 'cmake_program' | ||
displayName: Extract CMake | ||
|
||
- task: ExtractFiles@1 | ||
inputs: | ||
archiveFilePatterns: 'cmake*.tar.gz' | ||
destinationFolder: 'cmake_program' | ||
displayName: Extract CMake | ||
|
||
- bash: echo "##vso[task.prependpath]$(Build.SourcesDirectory)/cmake_program/cmake-3.14.3-Linux-x86_64/bin" | ||
displayName: Add CMake to PATH | ||
- bash: echo "##vso[task.prependpath]$(Build.SourcesDirectory)/cmake_program/cmake-3.14.3-Linux-x86_64/bin" | ||
displayName: Add CMake to PATH |
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 |
---|---|---|
@@ -1,18 +1,17 @@ | ||
steps: | ||
- checkout: self | ||
fetchDepth: 50 | ||
submodules: true | ||
|
||
- checkout: self | ||
fetchDepth: 50 | ||
submodules: true | ||
- task: CMake@1 | ||
inputs: | ||
cmakeArgs: .. -DCMAKE_BUILD_TYPE=Debug | ||
displayName: 'Configure' | ||
|
||
- task: CMake@1 | ||
inputs: | ||
cmakeArgs: .. -DCMAKE_BUILD_TYPE=Debug | ||
displayName: 'Configure' | ||
- script: cmake --build . -j | ||
displayName: 'Build' | ||
workingDirectory: build | ||
|
||
- script: cmake --build . -j | ||
displayName: 'Build' | ||
workingDirectory: build | ||
|
||
- script: ctest --output-on-failure -C Debug | ||
displayName: 'Test' | ||
workingDirectory: build | ||
- script: ctest --output-on-failure -C Debug | ||
displayName: 'Test' | ||
workingDirectory: build |
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 |
---|---|---|
@@ -1,12 +1,9 @@ | ||
steps: | ||
|
||
- script: ctest --output-on-failure -C $(units.build_type) -T test | ||
displayName: 'Test' | ||
workingDirectory: build | ||
|
||
- task: PublishTestResults@2 | ||
inputs: | ||
testResultsFormat: 'cTest' | ||
testResultsFiles: '**/Test.xml' | ||
|
||
|
||
- script: ctest --output-on-failure -C $(units.build_type) -T test | ||
displayName: 'Test' | ||
workingDirectory: build | ||
|
||
- task: PublishTestResults@2 | ||
inputs: | ||
testResultsFormat: 'cTest' | ||
testResultsFiles: '**/Test.xml' |
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
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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
--- | ||
engines: | ||
rubocop: | ||
enabled: true | ||
duplication: | ||
enabled: true | ||
metrics: | ||
enabled: true | ||
coverage: | ||
enabled: false | ||
rubocop: | ||
enabled: true | ||
duplication: | ||
enabled: true | ||
metrics: | ||
enabled: true | ||
coverage: | ||
enabled: false | ||
languages: | ||
|
||
exclude_paths: | ||
- ThirdParty/**/* | ||
- ThirdParty/* | ||
- scripts/**/* | ||
- scripts/* | ||
|
||
- 'ThirdParty/**/*' | ||
- 'ThirdParty/*' | ||
- 'scripts/**/*' | ||
- 'scripts/*' | ||
- '**.md' |
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
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM alpine:latest | ||
|
||
RUN apk add --no-cache \ | ||
bash \ | ||
jq \ | ||
git \ | ||
ca-certificates \ | ||
curl | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
LABEL name="create-file-pr" | ||
LABEL version="1.0.1" | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: 'Create File Update PR' | ||
description: 'Pushes a new branch with changed files and opens a PR for updating the changed files in the base branch' | ||
inputs: | ||
no-hash: # turn off inclusion of the hash in the created branch name | ||
description: 'Do not include the changed file hash in the PR branch name' | ||
default: false | ||
replace-branch: # if a PR branch already exists, replaces it with updated contents | ||
description: 'Replace the contents of an existing PR branch of the same name' | ||
default: false | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' |
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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/bash | ||
|
||
PR_URL=$(jq --raw-output .repository.pulls_url "$GITHUB_EVENT_PATH") | ||
PR_URL=${PR_URL%\{*} | ||
API_VERSION=v3 | ||
API_HEADER="Accept: application/vnd.github.${API_VERSION}+json; application/vnd.github.shadow-cat-preview+json; application/vnd.github.symmetra-preview+json; application/vnd.github.sailor-v-preview+json" | ||
AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}" | ||
|
||
# Only commit and open a PR if files have changed | ||
files_changed=$(git diff --staged --name-only) | ||
if [[ "$files_changed" != "" ]]; | ||
then | ||
hash=$(sha256sum "${files_changed}" | sha256sum | cut -c 1-12 -) | ||
if [[ "${GITHUB_REF}" == "refs/pull/"* ]]; | ||
then | ||
current_branch="${GITHUB_HEAD_REF}" | ||
else | ||
current_branch="${GITHUB_REF#refs/heads/}" | ||
fi | ||
|
||
# Set the git origin url for committing using a GITHUB_TOKEN | ||
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}" | ||
git config user.name "${INPUT_GIT_NAME}" | ||
git config user.email "${INPUT_GIT_EMAIL}" | ||
|
||
# Construct the branch name with the changes for a PR | ||
pr_branch="${INPUT_BRANCH_PREFIX}update-${current_branch}" | ||
if [[ "${INPUT_NO_HASH}" != "true" ]]; | ||
then | ||
pr_branch="${pr_branch}-${hash}" | ||
fi | ||
|
||
# Make sure a branch with the same name doesn't already exist, unless INPUT_REPLACE_BRANCH is true | ||
git ls-remote --exit-code . "origin/${pr_branch}" | ||
rv=$? | ||
if [[ "$rv" == "0" ]]; | ||
then | ||
if [[ "${INPUT_REPLACE_BRANCH}" != "true" ]]; | ||
then | ||
exit 0 | ||
fi | ||
pr_branch_exists="true" | ||
fi | ||
|
||
if [[ "${pr_branch_exists}" == "true" ]]; | ||
then | ||
# delete any existing local branch with the same name | ||
git branch -D "${pr_branch}" >/dev/null 2>&1 | ||
fi | ||
|
||
# Commit the changed files and push the branch to GitHub | ||
git checkout -b "${pr_branch}" | ||
git commit -m "${INPUT_COMMIT_MSG}" | ||
git push -f -u origin "${pr_branch}" | ||
|
||
if [[ "$pr_branch_exists" != "true" ]]; | ||
then | ||
# Format string values for GitHub API JSON payload | ||
PR_TITLE="$(echo -n "${INPUT_PR_TITLE}" | jq --raw-input --slurp ".")" | ||
PR_BODY="$(echo -n "${INPUT_PR_BODY}" | jq --raw-input --slurp ".")" | ||
PR_BASE="$(echo -n "${current_branch}" | jq --raw-input --slurp ".")" | ||
PR_HEAD="$(echo -n "${pr_branch}" | jq --raw-input --slurp ".")" | ||
pr_api_data="{\"title\":${PR_TITLE}, \"body\":${PR_BODY}, \"base\":${PR_BASE}, \"head\":${PR_HEAD}, \"draft\":false}" | ||
|
||
# Open up the GitHub PR | ||
curl -XPOST -fsSL \ | ||
-H "${AUTH_HEADER}" \ | ||
-H "${API_HEADER}" \ | ||
--data "${pr_api_data}" \ | ||
"${PR_URL}" | ||
fi | ||
fi |
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
Oops, something went wrong.