Skip to content

Commit 52063cc

Browse files
authored
Merge pull request #1 from uc-cdis/feat/init
Feat/init
2 parents 1ee3010 + b44b53b commit 52063cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+7919
-4
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore unnecessary files inside allowed directories
2+
# This should go after the allowed directories
3+
**/*.pyc
4+
**/*.egg-info
5+
**/__pycache__

.github/workflows/automation.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# push will run on every pushed commit to any branch (so this will rerun the tests
2+
# once a branch gets merged to main in addition to any new commits on any branch)
3+
on: push
4+
5+
name: Automation
6+
7+
concurrency:
8+
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
9+
cancel-in-progress: true
10+
11+
jobs:
12+
post-commit-check:
13+
name: Post-Commit Validation of Pre-Commit Checks (Includes Linting)
14+
uses: uc-cdis/.github/.github/workflows/pre_commit.yaml@fix/linting
15+
with:
16+
UV_VERSION: '0.10.9'
17+
JUST_VERSION: '1.46.0'
18+
secrets: inherit
19+
20+
security:
21+
name: Security Pipeline
22+
uses: uc-cdis/.github/.github/workflows/securitypipeline.yaml@master
23+
with:
24+
python-poetry: 'true'
25+
secrets: inherit
26+
27+
unit-test:
28+
name: Python Unit Test
29+
# TODO: enable when security and post-commit work reliably
30+
# needs: [ security, post-commit-check ]
31+
runs-on: ubuntu-latest
32+
env:
33+
UV_VERSION: '0.10.9'
34+
JUST_VERSION: '1.46.0'
35+
PYTHON_VERSION: '3.13'
36+
PGHOST: 'localhost'
37+
PGPORT: 5432
38+
PGUSER: 'postgres'
39+
40+
steps:
41+
- name: Check out code
42+
uses: actions/checkout@v6
43+
with:
44+
persist-credentials: false
45+
46+
- name: Set up python
47+
uses: actions/setup-python@v6
48+
with:
49+
python-version: ${{ env.PYTHON_VERSION }}
50+
51+
- name: python info
52+
run: python --version
53+
54+
- name: Install uv
55+
run: |
56+
curl -LsSf https://astral.sh/uv/${{ env.UV_VERSION }}/install.sh | sh
57+
58+
- uses: taiki-e/install-action@v2
59+
with:
60+
tool: just@${{ env.JUST_VERSION }}
61+
62+
- name: just setup
63+
run: |
64+
just setup
65+
66+
- name: just install
67+
run: |
68+
just install
69+
70+
- name: just test
71+
run: |
72+
just test
73+
74+
image-build-push-1:
75+
name: Build Image and Push - Gen3 Embeddings
76+
uses: uc-cdis/.github/.github/workflows/image_build_push.yaml@fix/linting
77+
needs: [post-commit-check, security, unit-test]
78+
with:
79+
BUILD_PLATFORMS: "linux/amd64"
80+
DOCKERFILE_BUILD_CONTEXT: '.'
81+
BUILD_ARGS: SERVICE_NAME=gen3_embeddings
82+
OVERRIDE_REPO_NAME: gen3_embeddings
83+
secrets:
84+
ECR_AWS_ACCESS_KEY_ID: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
85+
ECR_AWS_SECRET_ACCESS_KEY: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
86+
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
87+
QUAY_ROBOT_TOKEN: ${{ secrets.QUAY_ROBOT_TOKEN }}
88+
89+
image-build-push-2:
90+
name: Build Image and Push - Gen3 Inference
91+
uses: uc-cdis/.github/.github/workflows/image_build_push.yaml@fix/linting
92+
needs: [post-commit-check, security, unit-test]
93+
with:
94+
BUILD_PLATFORMS: "linux/amd64"
95+
DOCKERFILE_BUILD_CONTEXT: '.'
96+
BUILD_ARGS: SERVICE_NAME=gen3_inference
97+
OVERRIDE_REPO_NAME: gen3_inference
98+
secrets:
99+
ECR_AWS_ACCESS_KEY_ID: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
100+
ECR_AWS_SECRET_ACCESS_KEY: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
101+
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
102+
QUAY_ROBOT_TOKEN: ${{ secrets.QUAY_ROBOT_TOKEN }}
103+
104+
image-build-push-3:
105+
name: Build Image and Push - Gen3 AI Model Repo
106+
uses: uc-cdis/.github/.github/workflows/image_build_push.yaml@fix/linting
107+
needs: [post-commit-check, security, unit-test]
108+
with:
109+
BUILD_PLATFORMS: "linux/amd64"
110+
DOCKERFILE_BUILD_CONTEXT: '.'
111+
BUILD_ARGS: SERVICE_NAME=gen3_ai_model_repo
112+
OVERRIDE_REPO_NAME: gen3_ai_model_repo
113+
secrets:
114+
ECR_AWS_ACCESS_KEY_ID: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
115+
ECR_AWS_SECRET_ACCESS_KEY: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
116+
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
117+
QUAY_ROBOT_TOKEN: ${{ secrets.QUAY_ROBOT_TOKEN }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Markdown validation
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
paths:
10+
- .github/workflows/validate_markdown.yaml
11+
- "**.md"
12+
13+
jobs:
14+
markdown_validation:
15+
name: Markdown validation
16+
uses: uc-cdis/.github/.github/workflows/validate_markdown.yaml@master

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ cython_debug/
182182
.abstra/
183183

184184
# Visual Studio Code
185-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
185+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186186
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
187+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188188
# you could uncomment the following to ignore the entire vscode folder
189189
# .vscode/
190190

@@ -205,3 +205,7 @@ cython_debug/
205205
marimo/_static/
206206
marimo/_lsp/
207207
__marimo__/
208+
209+
210+
# Other
211+
.DS_Store

.justfile_helpers.bash

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# setup some color to help differentiate between services and tool runs
2+
# should default to normal colors if terminal doesn't support
3+
is_tty() { [[ -t 1 ]] && [[ -t 0 ]]; }
4+
if is_tty; then
5+
RED=$(tput setaf 1)
6+
GREEN=$(tput setaf 2)
7+
YELLOW=$(tput setaf 3)
8+
BLUE=$(tput setaf 4)
9+
PURPLE=$(tput setaf 5)
10+
CYAN=$(tput setaf 6)
11+
RESET=$(tput sgr0)
12+
else
13+
RED='' GREEN='' YELLOW='' BLUE='' PURPLE='' CYAN='' RESET=''
14+
fi
15+
16+
# utility for adding color and a border to a message
17+
print_header() {
18+
local command=$1
19+
local message_left=$2
20+
local service=$3
21+
local message_right=$4
22+
local type=${5:-default}
23+
24+
local color
25+
case "$type" in
26+
error) color="${RED}" ;;
27+
success) color="${GREEN}" ;;
28+
# anything else (default)
29+
*) color="${PURPLE}" ;;
30+
# I hate bash syntax. esac...
31+
esac
32+
33+
# fallback width
34+
local cols=$(tput cols 2>/dev/null || echo 100)
35+
if (( cols <= 0 )); then cols=100; fi
36+
37+
local visible_length=$(
38+
echo -ne "$command$message_left$service$message_right" |
39+
sed -r 's/\x1b\[[0-9;]*m//g' |
40+
wc -c)
41+
42+
# dashes on each side
43+
local left_dashes=$(( (cols - visible_length) / 2 ))
44+
local message_right_dashes=$(( cols - visible_length - left_dashes ))
45+
46+
# print the dashes, the coloured parts, then the message_right-side dashes
47+
printf '%b' "${color}"
48+
printf '%*s' "$left_dashes" '' | tr ' ' '-'
49+
printf '%b' " ${BLUE}$command ${color}$message_left ${CYAN}$service ${color}$message_right "
50+
printf '%*s\n' "$message_right_dashes" '' | tr ' ' '-'
51+
printf '%b' "${RESET}"
52+
}
53+
54+
55+
print_message() {
56+
local message=$1
57+
local type=${2:-info}
58+
59+
# Choose color based on type
60+
local color
61+
case "$type" in
62+
error) color="${RED}" ;;
63+
*) color="${GREEN}" ;; # anything else (info, success, etc.)
64+
esac
65+
66+
# fallback width
67+
local cols=$(tput cols 2>/dev/null || echo 100)
68+
if (( cols <= 0 )); then cols=100; fi
69+
70+
local visible_length=$(
71+
echo -ne "$message" |
72+
sed -r 's/\x1b\[[0-9;]*m//g' |
73+
wc -c
74+
)
75+
local left_spaces=$(( (cols - visible_length) / 2 ))
76+
local right_spaces=$(( cols - visible_length - left_spaces ))
77+
78+
printf '%b' "${color}"
79+
printf '%*s' "$left_spaces" '' | tr ' ' ' '
80+
printf '%b' " ** $message ** "
81+
printf '%*s\n' "$right_spaces" '' | tr ' ' ' '
82+
printf '%b' "${RESET}"
83+
echo
84+
}
85+
86+
report_error_or_success() {
87+
local status=$1
88+
local command=$2
89+
local message_left=$3
90+
local service=$4
91+
local message_right=$5
92+
93+
echo
94+
if [ $status -ne 0 ]; then
95+
print_header "$command" "ERROR: $message_left" "$service" "$message_right" "error"
96+
else
97+
print_header "$command" "SUCCESS: $message_left" "$service" "$message_right" "success"
98+
fi
99+
echo
100+
}
101+
102+
report_error_if_failed() {
103+
local status=$1
104+
local command=$2
105+
local message_left=$3
106+
local service=$4
107+
local message_right=$5
108+
109+
if [ $status -ne 0 ]; then
110+
echo
111+
print_header "$command" "ERROR: $message_left" "$service" "$message_right" "error"
112+
echo
113+
fi
114+
}

.pre-commit-config.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
repos:
2+
- repo: https://github.com/Yelp/detect-secrets
3+
rev: v1.5.0
4+
hooks:
5+
- id: detect-secrets
6+
args: ["--baseline", ".secrets.baseline"]
7+
exclude: poetry.lock
8+
- repo: https://github.com/pre-commit/pre-commit-hooks
9+
rev: v6.0.0
10+
hooks:
11+
- id: trailing-whitespace
12+
- id: end-of-file-fixer
13+
- id: no-commit-to-branch
14+
args: [--branch, develop, --branch, master, --branch, main, --pattern, release/.*]
15+
- repo: local
16+
hooks:
17+
- id: lint
18+
name: lint
19+
entry: uv run just lint
20+
language: python
21+
types: [python]
22+
pass_filenames: false

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

0 commit comments

Comments
 (0)