Skip to content

Commit

Permalink
PENG-2414 implement the whole functionality required to initiate the …
Browse files Browse the repository at this point in the history
…project (#1)

* PENG-2414 implement the whole functionality required to initiate the
project

* PENG-2414 fix the *help* target in the Makefile

* PENG-2414 attempt to fix CI workflow by adjusting the order of the steps

* PENG-2414 PR review modifications

* PENG-2414 omit empty fields in the metadata.yaml

* PENG-2414 add icon url to the cfd-openfoam-motorbike job script
  • Loading branch information
matheushent authored Oct 24, 2024
1 parent 9c9fd3e commit 56df6ce
Show file tree
Hide file tree
Showing 37 changed files with 3,261 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#### What
Provide a full detailed description of the pull request. It should include detialed explanations about the proposed changes. Keep this section as much technical as possible.

#### Why
Explain why the proposed change is necessary. Skip if it is already explained on any task related to the pull request.
92 changes: 92 additions & 0 deletions .github/workflows/catalog-cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Build and Publish Job Scripts

on:
workflow_dispatch:
inputs:
job-script-names:
description: Comma-separated list of job script names to build and publish
required: true
type: string

jobs:
catalog-cd:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v3

- uses: actions/setup-node@v4
with:
node-version: '22.8.0'

- name: Set up Python
uses: actions/setup-python@v4
with:
cache: 'poetry'

- name: Install Poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: 1.8.0

- name: Install CDK
run: |
npm install -g [email protected]
- name: Cache cdk.out
uses: actions/cache@v4
with:
path: cdk.out
key: cdk-out

- name: Setup AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.S3_BUCKET_REGION }}

- name: Install Python packages
run: |
poetry install --with=infra
- name: Install Apptainer
run: |
sudo apt install -y software-properties-common
sudo add-apt-repository -y ppa:apptainer/ppa
sudo apt-update
sudo apt install -y apptainer
- name: Configure settings
run: |
poetry run builder settings set \
--aws-access-key-id ${{ secrets.AWS_ACCESS_KEY_ID }} \
--aws-secret-access-key ${{ secrets.AWS_SECRET_ACCESS_KEY }} \
--s3-bucket ${{ vars.S3_BUCKET }} \
--s3-bucket-region ${{ vars.S3_BUCKET_REGION }}
- name: Build job scripts images
run: |
job_script_names="${{ github.event.inputs.job-script-names }}"
job_script_names_spaced=$(echo $job_script_names | sed 's/,/ /g')
poetry run builder --verbose apptainer build $job_script_names_spaced
- name: Publish job scripts images
run: |
job_script_names="${{ github.event.inputs.job-script-names }}"
job_script_names_spaced=$(echo $job_script_names | sed 's/,/ /g')
poetry run builder --verbose apptainer publish $job_script_names_spaced
- name: Publish job scripts artifacts
run: |
job_script_names="${{ github.event.inputs.job-script-names }}"
job_script_names_spaced=$(echo $job_script_names | sed 's/,/ /g')
poetry run builder --verbose files publish $job_script_names_spaced
- name: Generate the catalog.yaml file
run: |
poetry run builder --verbose catalog generate
- name: Publish the catalog.yaml file
run: |
cdk deploy --require-approval never VantageJobsCatalogWebsite
47 changes: 47 additions & 0 deletions .github/workflows/pr-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: 'Test'

on:
push:
branches:
- main
- release/**
pull_request:

jobs:
qa:
name: Code Quality Assurance
runs-on: ubuntu-24.04

steps:
- name: Checkout code
uses: actions/checkout@v3

- uses: actions/setup-node@v4
with:
node-version: '22.8.0'

- name: Install Poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: 1.8.0

- name: Set up Python
uses: actions/setup-python@v4
with:
cache: 'poetry'

- name: Cache Ruff
uses: actions/cache@v4
with:
path: .ruff_cache
key: ${{ runner.os }}-ruff-${{ hashFiles('.ruff_cache/CACHEDIR.TAG') }}

- name: Cache Mypy
uses: actions/cache@v4
with:
path: .mypy_cache
key: ${{ runner.os }}-mypy-${{ hashFiles('.mypy_cache/CACHEDIR.TAG') }}

- name: Run QA
run: |
make qa
133 changes: 133 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# Apptainer images
*.sif

catalog.yaml

cdk.out
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12.3
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
poetry 1.8.0
nodejs 22.8.0
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
SHELL:=/bin/bash
ROOT_DIR:=$(shell dirname $(shell pwd))

.PHONY: install
install: ## Install Python packages
poetry install

.PHONY: lint
lint: install ## Lint the project using ruff
poetry run ruff check builder infra

.PHONY: mypy
mypy: install ## Run mypy on the project
poetry run mypy builder --pretty

.PHONY: qa
qa: lint mypy ## Run the quality assurance check
echo "All tests pass! Ready for deployment"

.PHONY: format
format: install ## Format the code using ruff
poetry run ruff format builder infra

.PHONY: clean
clean: ## Clean all files/folders created by the project
@find . -iname '*.pyc' -delete
@find . -iname '__pycache__' -delete
@find . -type d -name '.mypy_cache' -exec rm -rf {} +
@find . -type d -name '.ruff_cache' -exec rm -rf {} +
@find . -type d -name '.venv' -exec rm -rf {} +
@find . -iname '*.sif' -delete
@find . -iname 'catalog.yaml' -delete
@find . -type d -name 'cdk.out' -exec rm -rf {} +

.PHONY: help
help: ## Print the targets and their descriptions
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Loading

0 comments on commit 56df6ce

Please sign in to comment.