-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add linting and ci, automated container build, demo docs (#3)
* add linting and ci, automated container build, demo docs Signed-off-by: vsoch <[email protected]>
- Loading branch information
Showing
27 changed files
with
360 additions
and
103 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
File renamed without changes.
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,50 @@ | ||
name: Build Deploy Containers | ||
|
||
on: | ||
|
||
# Publish packages on release | ||
release: | ||
types: [published] | ||
|
||
pull_request: [] | ||
|
||
# On push to main we build and deploy images | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
env: | ||
container: ghcr.io/flux-framework/flux-restful-api | ||
permissions: | ||
packages: write | ||
|
||
runs-on: ubuntu-latest | ||
name: Build | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build Container | ||
run: docker build -t ${{env.container}} . | ||
|
||
- name: GHCR Login | ||
if: (github.event_name != 'pull_request') | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Tag and Push Release Image | ||
if: (github.event_name == 'release') | ||
run: | | ||
tag=${GITHUB_REF#refs/tags/} | ||
echo "Tagging and releasing ${{ env.container }}:${tag}" | ||
docker tag ${{env.container}}:latest ${{env.container}}:${tag} | ||
docker push ${{env.container}}:${tag} | ||
- name: Deploy | ||
if: (github.event_name != 'pull_request') | ||
run: docker push ${{env.container}}:latest |
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,29 @@ | ||
name: flux-restful-api | ||
|
||
on: | ||
# This should run on a push to any branch except main, gh-pages, and binoc | ||
push: | ||
branches-ignore: | ||
- main | ||
- gh-pages | ||
|
||
jobs: | ||
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: ./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 |
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,4 +1,4 @@ | ||
env | ||
.env | ||
__pycache__ | ||
*.tar.gz | ||
*.tar.gz |
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 @@ | ||
exclude: ".all-contributorsrc" | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: mixed-line-ending | ||
|
||
- repo: local | ||
hooks: | ||
- id: black | ||
name: black | ||
language: python | ||
types: [python] | ||
entry: black | ||
|
||
- id: isort | ||
name: isort | ||
args: [--filter-files] | ||
language: python | ||
types: [python] | ||
entry: isort | ||
|
||
- id: flake8 | ||
name: flake8 | ||
language: python | ||
types: [python] | ||
entry: flake8 |
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,29 @@ | ||
FROM fluxrm/flux-sched:focal | ||
|
||
# docker build -t ghcr.io/flux-framework/flux-restful-api . | ||
|
||
ARG user | ||
ARG token | ||
ARG use_auth | ||
ARG port="5000" | ||
ARG host="0.0.0.0" | ||
LABEL maintainer="Vanessasaurus <@vsoch>" | ||
|
||
USER root | ||
RUN apt-get update | ||
COPY ./requirements.txt /requirements.txt | ||
|
||
EXPOSE ${port} | ||
ENV PYTHONPATH=/usr/lib/flux/python3.8 | ||
|
||
# For easier Python development. | ||
RUN python3 -m pip install -r /requirements.txt | ||
|
||
WORKDIR /code | ||
COPY . /code | ||
ENV FLUX_USER=${user} | ||
ENV FLUX_TOKEN=${token} | ||
ENV FLUX_REQUIRE_AUTH=${use_auth} | ||
ENV PORT=${port} | ||
ENV HOST=${host} | ||
ENTRYPOINT ["/code/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
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
Oops, something went wrong.