-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into multiple-private-keys
- Loading branch information
Showing
115 changed files
with
3,070 additions
and
1,765 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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: PR Validation | ||
|
||
on: | ||
pull_request: | ||
# one limitation here is that there's no trigger to re-run any time we "connect" or "disconnect" an issue | ||
types: [opened, edited, labeled, unlabeled, synchronize] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
validate-pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Validate PR has labels | ||
id: check_labels | ||
run: | | ||
PR_LABELS=$(jq -r '.pull_request.labels | length' $GITHUB_EVENT_PATH) | ||
if [ "$PR_LABELS" -eq "0" ]; then | ||
echo "No labels found on the pull request." | ||
exit 1 | ||
fi | ||
- name: Validate PR is linked to an issue | ||
id: check_linked_issues | ||
run: | | ||
PR_NUMBER=$(jq -r '.pull_request.number' $GITHUB_EVENT_PATH) | ||
REPO_OWNER=$(jq -r '.repository.owner.login' $GITHUB_EVENT_PATH) | ||
REPO_NAME=$(jq -r '.repository.name' $GITHUB_EVENT_PATH) | ||
TIMELINE_JSON=$(curl -s "https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/issues/$PR_NUMBER/timeline") | ||
# Count the number of times the timeline sees a "connected" event and subract the number of "disconnected" events | ||
# We might also consider using the "cross-referenced" event in the future if actual connecting/disconnecting is too heavy-handed | ||
LINKED_ISSUES=$(echo "$TIMELINE_JSON" | jq ' | ||
reduce .[] as $event ( | ||
0; | ||
if $event.event == "connected" then | ||
. + 1 | ||
elif $event.event == "disconnected" then | ||
. - 1 | ||
else | ||
. | ||
end | ||
)') | ||
# If the sum is 0, then no linked issues were found | ||
if [ "$LINKED_ISSUES" -eq "0" ]; then | ||
echo "❌ No linked issues found in the pull request." | ||
exit 1 | ||
elif [ "$LINKED_ISSUES" -lt "0" ]; then | ||
echo "Error: More disconnected events than connected events. This shouldn't be possible and likely indicates a big ol' 🪲" | ||
exit 1 | ||
else | ||
echo "Linked issues found: $LINKED_ISSUES" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Issue Validation | ||
|
||
on: | ||
issues: | ||
types: [closed] | ||
|
||
jobs: | ||
validate-issue: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Validate issue has labels | ||
id: check_labels | ||
run: | | ||
ISSUE_LABELS=$(jq -r '.issue.labels | length' $GITHUB_EVENT_PATH) | ||
if [ "$ISSUE_LABELS" -eq "0" ]; then | ||
echo "No labels found on the issue." | ||
# Re-open the issue | ||
ISSUE_NUMBER=$(jq -r '.issue.number' $GITHUB_EVENT_PATH) | ||
REPO_OWNER=$(jq -r '.repository.owner.login' $GITHUB_EVENT_PATH) | ||
REPO_NAME=$(jq -r '.repository.name' $GITHUB_EVENT_PATH) | ||
curl -L \ | ||
-X PATCH \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/issues/$ISSUE_NUMBER \ | ||
-d '{"state":"open"}' | ||
exit 1 | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Toggle webhook to pull latest release onto pelicanplatform.org and update the download offerings there | ||
# Post release this will result in the new release being available and the Major/Minor pointers being moved/created accordingly | ||
name: post-release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
toggle-webhook: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Toggle Webhook | ||
run: | | ||
curl -X POST https://dl.pelicanplatform.org/api/api/hooks/release-download-toggle |
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,99 @@ | ||
name: Test Template | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
tags: | ||
required: true | ||
type: string | ||
coverprofile: | ||
required: true | ||
type: string | ||
binary_name: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: hub.opensciencegrid.org/pelican_platform/pelican-dev:latest-itb | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- name: Fetch tags | ||
run: | | ||
git config --global --add safe.directory /__w/pelican/pelican | ||
git fetch --force --tags | ||
- name: Cache Next.js | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.npm | ||
${{ github.workspace }}/.next/cache | ||
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} | ||
restore-keys: | | ||
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- | ||
- name: Test | ||
run: | | ||
make web-build | ||
go test -tags=${{ inputs.tags }} -timeout 15m -coverpkg=./... -coverprofile=${{ inputs.coverprofile }} -covermode=count ./... | ||
- name: Get total code coverage | ||
if: github.event_name == 'pull_request' | ||
id: cc | ||
run: | | ||
set -x | ||
cc_total=`go tool cover -func=${{ inputs.coverprofile }} | grep total | grep -Eo '[0-9]+\.[0-9]+'` | ||
echo "cc_total=$cc_total" >> $GITHUB_OUTPUT | ||
- name: Restore base test coverage | ||
id: base-coverage | ||
if: github.event.pull_request.base.sha != '' | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
unit-base.txt | ||
key: ${{ runner.os }}-unit-test-coverage-${{ (github.event.pull_request.base.sha != github.event.after) && github.event.pull_request.base.sha || github.event.after }} | ||
- name: Run test for base code | ||
if: steps.base-coverage.outputs.cache-hit != 'true' && github.event.pull_request.base.sha != '' | ||
run: | | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
git fetch origin main ${{ github.event.pull_request.base.sha }} | ||
HEAD=$(git rev-parse HEAD) | ||
git reset --hard ${{ github.event.pull_request.base.sha }} | ||
make web-build | ||
go generate ./... | ||
go test -tags=${{ inputs.tags }} -timeout 15m -coverpkg=./... -coverprofile=base_coverage.out -covermode=count ./... | ||
go tool cover -func=base_coverage.out > unit-base.txt | ||
git reset --hard $HEAD | ||
- name: Get base code coverage value | ||
if: github.event_name == 'pull_request' | ||
id: cc_b | ||
run: | | ||
set -x | ||
cc_base_total=`grep total ./unit-base.txt | grep -Eo '[0-9]+\.[0-9]+'` | ||
echo "cc_base_total=$cc_base_total" >> $GITHUB_OUTPUT | ||
- name: Add coverage information to action summary | ||
if: github.event_name == 'pull_request' | ||
run: echo 'Code coverage ' ${{steps.cc.outputs.cc_total}}'% Prev ' ${{steps.cc_b.outputs.cc_base_total}}'%' >> $GITHUB_STEP_SUMMARY | ||
- name: Run GoReleaser for Ubuntu | ||
uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: build --single-target --clean --snapshot | ||
- name: Copy files (Ubuntu) | ||
run: | | ||
cp dist/${{ inputs.binary_name }}_linux_amd64_v1/${{ inputs.binary_name }} ./pelican | ||
- name: Run Integration Tests | ||
run: ./github_scripts/citests.sh | ||
- name: Run End-to-End Test for Object get/put | ||
run: ./github_scripts/get_put_test.sh | ||
- name: Run End-to-End Test for Director stat | ||
run: ./github_scripts/stat_test.sh | ||
- name: Run End-to-End Test for --version flag | ||
run: ./github_scripts/version_test.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
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.