Skip to content

Commit

Permalink
add automation for docs
Browse files Browse the repository at this point in the history
along with container builds, basic linting,
and spell checking.

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Dec 31, 2022
1 parent c0461b5 commit 7af14c9
Show file tree
Hide file tree
Showing 9 changed files with 263 additions and 4 deletions.
73 changes: 73 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team leads, @alecbcs and @vsoch. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org
4 changes: 4 additions & 0 deletions .github/dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pre-commit
black
isort
flake8
39 changes: 39 additions & 0 deletions .github/workflows/build-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: build flux-cloud

on:
# Always test on pull request
pull_request: []

# Deploy on merge to main
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
name: Build Container
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Make Space For Build
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
- name: Build and Tag Container
run: |
docker build -t ghcr.io/converged-computing/flux-cloud .
set -x
version=$(docker run -i --entrypoint flux-cloud ghcr.io/converged-computing/flux-cloud --version)
printf "Found version ${version}\n"
docker tag ghcr.io/converged-computing/flux-cloud:latest ghcr.io/converged-computing/flux-cloud:${version}
- name: Login and Deploy Container
if: (github.event_name != 'pull_request')
run: |
set -x
docker images
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker push --all-tags ghcr.io/converged-computing/flux-cloud
48 changes: 48 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: docs flux-cloud
on:
push:
branches: [main]

jobs:
generate-docs:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3
with:
ref: gh-pages

- name: Create conda environment
run: conda create --quiet -c conda-forge --name fluxdocs sphinx-material

- name: Generate Docs
run: |
export PATH="/usr/share/miniconda/bin:$PATH"
root=$PWD
source activate fluxdocs
git clone https://github.com/converged-computing/flux-cloud /tmp/fluxcloud
cd /tmp/fluxcloud/docs
pip install -r requirements.txt
make html
echo
echo "ls"
ls
echo
echo "ls _build/html"
ls _build/html
mv $root/.git _build/html/.git
rm -rf $root
mv /tmp/operator/docs/_build/html $root
cd ${root}
echo "ls $root"
ls .
touch .nojekyll
git add .nojekyll || echo "Already added"
git add .
ls .
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@ba1486788b0490a235422264426c45848eac35c6 # v4.4.1
with:
branch: gh-pages
folder: .
26 changes: 26 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: test flux-cloud

on:
pull_request: []

jobs:
formatting:
name: Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup black linter
run: conda create --quiet --name black pyflakes

- name: Check Spelling
uses: crate-ci/typos@7ad296c72fa8265059cc03d1eda562fbdfcd6df2 # v1.9.0
with:
files: ./docs/*/*.md ./docs/*.md ./README.md

- name: Lint and format Python code
run: |
export PATH="/usr/share/miniconda/bin:$PATH"
source activate black
pip install -r .github/dev-requirements.txt
pre-commit run --all-files
71 changes: 71 additions & 0 deletions .github/workflows/update-contributors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: contributors flux-cloud

on:
push:
branches:
- main

jobs:
Update:
name: Generate
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Tributors Update
uses: con/tributors@de944deeaf5b24fb65518125d5d87e8b939191fb # 0.0.21
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
parsers: unset
update_lookup: github
log_level: DEBUG
force: true
threshold: 1
run_twice: true

- name: Checkout New Branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_AGAINST: main
run: |
printf "GitHub Actor: ${GITHUB_ACTOR}\n"
export BRANCH_FROM="contributors/update-$(date '+%Y-%m-%d')"
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
BRANCH_EXISTS=$(git ls-remote --heads origin ${BRANCH_FROM})
if [[ -z ${BRANCH_EXISTS} ]]; then
printf "Branch does not exist in remote.\n"
else
printf "Branch already exists in remote.\n"
exit 1
fi
git branch
git checkout -b "${BRANCH_FROM}" || git checkout "${BRANCH_FROM}"
git branch
git config --global user.name "github-actions"
git config --global user.email "github-actions@users.noreply.github.com"
git status
if git diff-index --quiet HEAD --; then
export OPEN_PULL_REQUEST=0
printf "No changes\n"
else
export OPEN_PULL_REQUEST=1
printf "Changes\n"
git commit -a -m "Automated deployment to update contributors $(date '+%Y-%m-%d')"
git push origin "${BRANCH_FROM}"
fi
echo "OPEN_PULL_REQUEST=${OPEN_PULL_REQUEST}" >> $GITHUB_ENV
echo "PULL_REQUEST_FROM_BRANCH=${BRANCH_FROM}" >> $GITHUB_ENV
echo "PULL_REQUEST_TITLE=[tributors] ${BRANCH_FROM}" >> $GITHUB_ENV
echo "PULL_REQUEST_BODY=Tributors update automated pull request." >> $GITHUB_ENV
- name: Open Pull Request
uses: vsoch/pull-request-action@c8e84cea4c91c3379be16bc011c195edd3abbb2d # 1.0.23
if: ${{ env.OPEN_PULL_REQUEST == '1' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST_BRANCH: main
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ Code is under development and will be added soon! In the meantime, for early doc
- should have generic template provided by library
- cloud-select could estimate the cost?
- command mode that only shows commands?
- automated container build
- linting and checks, contributor workflow
- run and add more cluster examples

## 😁️ Contributors 😁️
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started/google.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Google Cloud

> Running on Google Kubenetes Engine, GKE
> Running on Google Kubernetes Engine, GKE
The main functionality that flux-cloud provides are easy wrappers (and templates) to running
the Flux Operator on GKE. The main steps of running experiments are:
Expand Down
2 changes: 1 addition & 1 deletion fluxcloud/main/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

cloud_properties = {"zone": {"type": "string"}, "machine": {"type": "string"}}
google_cloud_properties = copy.deepcopy(cloud_properties)
google_cloud_properties["project"] = {"type": "string"}
google_cloud_properties["project"] = {"type": ["null", "string"]}

kubernetes_properties = {"version": {"type": "string"}}
kubernetes_cluster_properties = {
Expand Down

0 comments on commit 7af14c9

Please sign in to comment.