Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buildkite, initialization script, README #6

Merged
merged 22 commits into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .buildkite/jobscript.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
#SBATCH --job-name=diagrammatic_equations_CI # Job name
#SBATCH --mail-type=END,FAIL # Mail events (NONE, BEGIN, END, FAIL, ALL)
#SBATCH [email protected] # Where to send mail
#SBATCH --ntasks=1 # Run on a single CPU
#SBATCH --mem=8gb # Job memory request
#SBATCH --time=00:15:00 # Time limit hrs:min:sec
pwd; hostname; date

module load julia

echo "Running Tests..."
julia --project -t 32 -e 'using Pkg; Pkg.status(); Pkg.test()'

echo "Building Documentation..."
julia --project=docs -t 32 -e'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.status(); Pkg.instantiate(); include("docs/make.jl")'
20 changes: 20 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
env:
JULIA_VERSION: "1.9.3"

steps:

- label: ":hammer: Build Project"
command:
- "module load julia"
- "julia --project=docs --color=yes -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate(); Pkg.precompile()'"

- wait

- label: ":scroll: Build docs and run tests"
command:
- "srun --cpus-per-task=32 --mem=8G --time=1:00:00 --output=.buildkite/log_%j.log --unbuffered .buildkite/jobscript.sh"
env:
JULIA_PROJECT: "docs/"

- wait

34 changes: 8 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,14 @@ A template repository for making a new AlgebraicJulia package.
git clone https://github.com/AlgebraicJulia/AlgebraicX.jl.git
cd AlgebraicX.jl
```
5. Rename the file `src/AlgebraicTemplate.jl` to match the name of your new package (e.x. "AlgebraicX")
```sh
mv src/AlgebraicTemplate.jl src/AlgebraicX.jl
```
6. Replace all instances of the word "AlgebraicTemplate" with your new package name (e.x. "AlgebraicX")
```sh
# On linux
git grep -l 'AlgebraicTemplate' | xargs sed -i 's/AlgebraicTemplate/AlgebraicX/g'
# On Mac OS X
git grep -l 'AlgebraicTemplate' | xargs sed -i '' -e 's/AlgebraicTemplate/AlgebraicX/g'
```
7. Generate a new random version 4 UUID (you can get one here: https://www.uuidgenerator.net/version4)
- We will assume for this example that your new UUID is `<UUID>`
8. Replace all instances of the template's UUID, "b66562e1-fa90-4e8b-9505-c909188fab76", with your new UUID (e.x. "<UUID>")
```sh
# On linux
git grep -l 'b66562e1-fa90-4e8b-9505-c909188fab76' | xargs sed -i 's/b66562e1-fa90-4e8b-9505-c909188fab76/<UUID>/g'
# On Mac OS X
git grep -l 'b66562e1-fa90-4e8b-9505-c909188fab76' | xargs sed -i '' -e 's/b66562e1-fa90-4e8b-9505-c909188fab76/<UUID>/g'
```
9. Commit these new changes to your repository
```sh
git commit -am "Set up skeleton for AlgebraicX.jl"
git push
```
10. Go back to your repository and wait until the tests have passed, you can check the status by going to the "Actions" tab in the repository
5. Inspect for yourself and run `init.sh` with the new repository name and (optional) UUID are parameters. This script will substitute all instances of `AlgebraicX` with your new repository name and the default UUID with a new one or, if available, the UUID provided.
6. Go back to your repository and wait until the tests have passed, you can check the status by going to the "Actions" tab in the repository

### Buildkite

AlgebraicJulia uses [Buildkite](https://buildkite.com/) to submit resource-intensive processes such as building documentation and executing tests to the [HiPerGator](https://www.rc.ufl.edu/about/hipergator/) computing cluster.

While this template comes with a preconfigured `.buildkite/pipeline.yml` file, this repository is not integrated with Buildkite by default. If you would like your repository to use Buildkite to run processes on HiPerGator, tag an issue with @AlgebraicJulia/SysAdmins.

### 📔 Set Up GitHub Pages (Public Repos Only)

Expand Down
68 changes: 68 additions & 0 deletions init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash

DEFAULT_REPO='AlgebraicTemplate'
DEFAULT_UUID='b66562e1-fa90-4e8b-9505-c909188fab76'

usage="This script is for initializing the template with the new repository name and UUID. Please provide the new repository name and UUID in that order. The repository name cannot be 'Test.'\n
Example:\n
./init.sh ${DEFAULT_REPO} ${DEFAULT_UUID}"

REPO={$1:-$(echo "${PWD##*/}")}
UUID=${2:-$(uuidgen)}

# set to lowercase
UUID=${UUID,,}

if [ ! $REPO ] || [ "$REPO" = 'Test' ] || [ ! $UUID ]; then
echo ""
printf "$usage"
exit 1
fi

read -p "By continuing, the following substitutions will be made:

REPO: $DEFAULT_REPO => $REPO
UUID: $DEFAULT_UUID => $UUID

Are you sure? [y/N]" -n 1 -r -s
echo

if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi

echo "Doing the thing..."

# get version
unameOut="$(uname -s)"

case "${unameOut}" in
Linux*)
git grep -l $DEFAULT_REPO | xargs sed -i "s/${DEFAULT_REPO}/${REPO}/g";
git grep -l $DEFAULT_UUID | xargs sed -i "s/${DEFAULT_UUID}/${UUID}/g";;
Darwin*)
git grep -l $DEFAULT_REPO | xargs sed -i '' -e "s/${DEFAULT_REPO}/${REPO}/g";
git grep -l $DEFAULT_UUID | xargs sed -i '' -e "s/${DEFAULT_UUID}/${UUID}/g";;
*)
echo UNKNOWN:${unameOut};;
esac

# rename
if [[ $REPO == *.jl ]]
then
mv src/$DEFAULT_REPO.jl src/$REPO
else
mv src/$DEFAULT_REPO.jl src/$REPO.jl
fi

read -p "Would you like this script to add, commit, and push the new changes? [y/N]" -n 1 -r -s
echo

if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi

git commit -am "Initialized $REPO"
git push
Loading