Skip to content

Commit

Permalink
Adding changes to make the build-testcase script print nicer output.
Browse files Browse the repository at this point in the history
  • Loading branch information
gm3dmo committed Feb 24, 2023
1 parent 1b6d798 commit fc2ccd3
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 35 deletions.
62 changes: 42 additions & 20 deletions build-testcase
Original file line number Diff line number Diff line change
@@ -1,23 +1,45 @@

# Create the testrepo
set -x
./create-repo-testrepo.sh
./add-team-to-repo.sh
./create-webhook.sh
./create-commit-readme.sh
./create-commit-codeowners.sh
./create-commit-python-pip.sh
./create-commit-test-rst.sh
./create-commit-test-ipynb.sh
sleep 2.5
./create-branch-newbranch.sh
./create-commit-on-new-branch.sh
./create-repo-issue.sh
./create-pull-request.sh
#./create-branch-protected.sh
# set the branch protection rules for main
./set-branch-protection.sh
if [ -z "$1" ]
printf "Creating repo: "
./create-repo-testrepo.sh | jq -r '.name'
./add-team-to-repo.sh
printf "Creating webhook: "
./create-webhook.sh | jq -r '.id'
printf "Creating docs/README: "
./create-commit-readme.sh | jq -r ".content.html_url"
printf "Creating CODEOWNERS: "
./create-commit-codeowners.sh| jq -r ".content.html_url"
printf "Creating requirements.txt: "
./create-commit-python-pip.sh| jq -r ".content.html_url"
sleep 2.5
printf "Creating new branch: "
./create-branch-newbranch.sh | jq -r '.url'
printf "Creating a commit on the new branch: "
./create-commit-on-new-branch.sh | jq -r ".content.html_url"
printf "Creating an issue: "
./create-repo-issue.sh | jq -r '.html_url'
printf "Creating a pull request: "
./create-pull-request.sh | jq -r '.html_url'
# set the branch protection rules for main
printf "Setting branch protection rules on default branch: "
./set-branch-protection.sh | jq -r '.url'

./create-release.sh
# Now add an additional file to the pull request:
./create-commit-gitattributes.sh
printf "Creating a release: "
./create-release.sh | jq -r '.url'
printf "Adding a .gitattributes file to new branch: "
./create-commit-gitattributes.sh | jq -r ".content.html_url"

then
>&2 echo "No optional being run"
else

# Renderers
./create-commit-test-rst.sh
./create-commit-test-ipynb.sh
./create-commit-mermaid.sh

# Pride labels
./pride-patch-labels.sh

fi
4 changes: 0 additions & 4 deletions create-commit-codeowners.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,11 @@ def main(args):
with open(p, 'rb') as ct:
t = {}
chapter_content = ct.read()
print(chapter_content)
chapter_string = string.Template(chapter_content.decode("utf-8"))
print(f"""({chapter_string})""")
values = { "org": args.org, "team_slug": args.team_slug, "default_committer": args.default_committer }
n = chapter_string.substitute(values)
print(f"""({n})""")
chapter_content = bytes(n, 'utf-8')
chapter_base64 = base64.encodebytes(chapter_content)
print
t["message"] = f"""A CODEOWNERS file."""
t["committer"] = {}
t["committer"]["name"] = args.default_committer
Expand Down
4 changes: 0 additions & 4 deletions create-commit-gitattributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,11 @@ def main(args):
with open(p, 'rb') as ct:
t = {}
chapter_content = ct.read()
print(chapter_content)
chapter_string = string.Template(chapter_content.decode("utf-8"))
print(f"""({chapter_string})""")
values = { "org": args.org, "team_slug": args.team_slug, "default_committer": args.default_committer }
n = chapter_string.substitute(values)
print(f"""({n})""")
chapter_content = bytes(n, 'utf-8')
chapter_base64 = base64.encodebytes(chapter_content)
print
t["message"] = f"""A .gitattributes file."""
t["committer"] = {}
t["committer"]["name"] = args.default_committer
Expand Down
4 changes: 0 additions & 4 deletions create-commit-on-new-branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,11 @@ def main(args):
with open(p, 'rb') as ct:
t = {}
chapter_content = ct.read()
print(chapter_content)
chapter_string = string.Template(chapter_content.decode("utf-8"))
print(f"""({chapter_string})""")
values = { "org": args.org, "team_slug": args.team_slug, "default_committer": args.default_committer }
n = chapter_string.substitute(values)
print(f"""({n})""")
chapter_content = bytes(n, 'utf-8')
chapter_base64 = base64.encodebytes(chapter_content)
print
t["message"] = f"""A .gitattributes file."""
t["committer"] = {}
t["committer"]["name"] = args.default_committer
Expand Down
2 changes: 1 addition & 1 deletion create-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jq -n \
--arg body "The first and possibly last ever release." \
'{tag_name : $tag, target_commitish: $commitish, name: $name, generate_release_notes: $generate_release_notes | test("true"), body: $body, prerelease: $prerelease | test("true")}' > ${json_file}

cat $json_file | jq -r >&2
#cat $json_file | jq -r >&2

curl ${curl_custom_flags} \
-H "Accept: application/vnd.github.v3+json" \
Expand Down
3 changes: 1 addition & 2 deletions set-branch-protection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fi
json_file=tmp/branch-protection.json
source_json=test-data/api-doc-set-branch-protection.json

cat ${source_json} | jq -r >&2
#cat ${source_json} | jq -r >&2

cat ${source_json}| jq --arg team_slug "$team_slug" \
--arg team_admin "$team_admin" \
Expand All @@ -35,4 +35,3 @@ curl ${curl_custom_flags} \
-H "Authorization: token ${GITHUB_TOKEN}" \
${GITHUB_API_BASE_URL}/repos/${org}/${repo}/branches/${protected_branch_name}/protection --data @${json_file}

rm -f ${json_file}

0 comments on commit fc2ccd3

Please sign in to comment.