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

chore: update module checks workflow #203

Merged
merged 6 commits into from
Jul 23, 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
98 changes: 98 additions & 0 deletions .github/workflows/module-checks-dev-requirements-change.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Module Checks Dev Requirements Change

on:
push:
branches:
- "main"
paths:
- "requirements-dev.txt"

pull_request:
branches:
- "main"
- "release/*"
- "stable"
paths:
- "requirements-dev.txt"

jobs:
get-modules:
name: Get Modules
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.get-modules.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get modules
id: get-modules
run: |
set -x
# Get all the modules that have the file "deployspec.yaml"
MODULES=$(find modules -type f -name "deployspec.yaml" | cut -d/ -f 2-3 | uniq)
# Create our json structure [{"module_name": "..."}]
MODULES_JSON=$(echo "$MODULES" | jq -R -s 'split("\n")' | jq '[ .[] | select(length > 0) ]' | jq 'map({"module_name": .})')
# Export the modules as json to the outputs
echo 'matrix<<EOF' >> $GITHUB_OUTPUT
echo $MODULES_JSON >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT

test:
name: Run unit tests for module ${{ matrix.modules.module_name }}
needs: get-modules
strategy:
fail-fast: false
matrix:
modules: ${{ fromJson(needs.get-modules.outputs.matrix) }}
python-version: [3.9]
node-version: [18.x]
runs-on: ubuntu-latest
env:
MODULE_PATH: 'modules/${{ matrix.modules.module_name }}'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- id: determine-language
name: Determine Language
run: |
set -x
if [ -f $MODULE_PATH/package.json ]; then \
echo "language=typescript" >> "$GITHUB_OUTPUT"; \
elif [ -f $MODULE_PATH/requirements.txt ]; then \
echo "language=python" >> "$GITHUB_OUTPUT"; \
elif [ -f $MODULE_PATH/pyproject.toml ]; then \
echo "language=python" >> "$GITHUB_OUTPUT"; \
fi
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Requirements (Python)
if: ${{ steps.determine-language.outputs.language == 'python' }}
run: |
set -x
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install -r $MODULE_PATH/requirements.txt
- name: Install Requirements (Typescript)
if: ${{ steps.determine-language.outputs.language == 'typescript' }}
run: |
set -x
cd $MODULE_PATH
npm install
- name: Static checks and linting
run: scripts/validate.sh --language ${{ steps.determine-language.outputs.language }} --path $MODULE_PATH/
- name: Pytest
if: ${{ steps.determine-language.outputs.language == 'python' }}
run: cd $MODULE_PATH/ && pytest
- name: NPM Test
if: ${{ steps.determine-language.outputs.language == 'typescript' }}
run: cd $MODULE_PATH/ && npm test
20 changes: 16 additions & 4 deletions .github/workflows/module-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- "main"
paths:
- "modules/**"
- "requirements-dev.txt"
- ".github/workflows/module-checks.yml"

pull_request:
Expand All @@ -16,7 +15,6 @@ on:
- "stable"
paths:
- "modules/**"
- "requirements-dev.txt"
- ".github/workflows/module-checks.yml"

jobs:
Expand All @@ -27,15 +25,29 @@ jobs:
matrix: ${{ steps.get-modules.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: modules/**
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
- name: Get modules
id: get-modules
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
set -x
# Get all the modules that have the file "deployspec.yaml"
MODULES=$(find modules -type f -name "deployspec.yaml" | cut -d/ -f 2-3 | uniq)
MODULES=$(echo $ALL_CHANGED_FILES | cut -d/ -f 2-3 | uniq)
# Create our json structure [{"module_name": "..."}]
MODULES_JSON=$(echo "$MODULES" | jq -R -s 'split("\n")' | jq '[ .[] | select(length > 0) ]' | jq 'map({"module_name": .})')
# Export the modules as json to the outputs
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### **Added**

- adds workflow specific to changes for `requirements-dev.txt` so all static checks are run

### **Changed**

- add integration tests for `sagemaker-studio`
- bump ecr module version to 1.10.0 to consume auto-delete images feature
- add service account to kuberay
- updated `get-modules` workflow to only run tests against changed files in `modules/**`

## v1.3.0

Expand Down
2 changes: 1 addition & 1 deletion modules/eks/ray-on-eks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This module runs Ray in AWS EKS Kubernetes cluster. It deploys a KubeRay Operato

### Usage

## RayJob Example
## Ray Job Example

This example leverages [RayJob](https://docs.ray.io/en/latest/cluster/kubernetes/getting-started/rayjob-quick-start.html).
With RayJob, KubeRay automatically creates a RayCluster and submits a job when the cluster is ready.
Expand Down
Loading