Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ence into ODSC-47899/allow_customize_destination_folder_job_mount
  • Loading branch information
lu-ohai committed Oct 11, 2023
2 parents cadbab1 + abb3140 commit 3c2a007
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 83 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/create-more-space/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# We are running out space on the disk, solution described here:
# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173

name: "Create more disk space"
description: "Removing some folders to create more disk space"
runs:
using: composite
steps:
- shell: bash
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
42 changes: 8 additions & 34 deletions .github/workflows/run-unittests-default_setup.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
name: tests/unitary/default_setup/**
name: "[Py3.8][Py3.9][Py3.10] tests/unitary/default_setup/**"

on:
workflow_dispatch:
pull_request:
branches:
- main
- "release/**"
- develop
paths:
- "ads/**"
- pyproject.toml
- "**requirements.txt"
- .github/workflows/run-unittests.yml
- .github/workflows/run-unittests-default_setup.yml
- ".github/workflows/run-unittests*.yml"

# Cancel in progress workflows on pull_requests.
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
Expand Down Expand Up @@ -41,37 +36,16 @@ jobs:
steps:
- uses: actions/checkout@v3

# Caching python libraries installed with pip
# https://github.com/actions/cache/blob/main/examples.md#python---pip
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/test-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
pyproject.toml
"**requirements.txt"
- name: "Test config setup"
shell: bash
env:
HOME_RUNNER_DIR: /home/runner
run: |
set -x # print commands that are executed
mkdir -p "$HOME_RUNNER_DIR"/.oci
openssl genrsa -out $HOME_RUNNER_DIR/.oci/oci_ads_user.pem 2048
cat <<EOT >> "$HOME_RUNNER_DIR/.oci/config"
[DEFAULT]
user=ocid1.user.oc1..xxx
fingerprint=00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
tenancy=ocid1.tenancy.oc1..xxx
region=test_region
key_file=$HOME_RUNNER_DIR/.oci/oci_ads_user.pem
EOT
ls -lha "$HOME_RUNNER_DIR"/.oci
echo "Test config file:"
cat $HOME_RUNNER_DIR/.oci/config
- uses: ./.github/workflows/set-dummy-conf
name: "Test config setup"

- name: "Run default_setup tests folder ONLY with minimum ADS dependencies"
timeout-minutes: 15
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
name: tests/unitary/**
name: "[Py3.8][COV REPORT] tests/unitary/**"

on:
workflow_dispatch:
pull_request:
branches:
- main
- "release/**"
- develop
paths:
- "ads/**"
- pyproject.toml
- "**requirements.txt"
- .github/workflows/run-unittests.yml
- .github/workflows/run-unittests-default_setup.yml
- ".github/workflows/run-unittests*.yml"

# Cancel in progress workflows on pull_requests.
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
Expand All @@ -30,58 +25,37 @@ env:

jobs:
test:
name: python ${{ matrix.python-version }}, ${{ matrix.name }}
name: python 3.8, ${{ matrix.name }}
runs-on: ubuntu-latest
timeout-minutes: 90

strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
test-path: ["tests/unitary/with_extras tests/unitary/default_setup", "tests/unitary/with_extras/model"]
include:
- test-path: "tests/unitary/with_extras tests/unitary/default_setup"
ignore-path: "--ignore tests/unitary/with_extras/model --ignore tests/unitary/with_extras/feature_store"
name: "unitary"
- test-path: "tests/unitary/with_extras/model"
name: "model"
- python-version: "3.8"
cov-reports: --cov=ads --cov-report=xml --cov-report=html

steps:
- uses: actions/checkout@v3

# Caching python libraries installed with pip
# https://github.com/actions/cache/blob/main/examples.md#python---pip
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: ./.github/workflows/create-more-space
name: "Create more disk space"

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: "3.8"
cache: "pip"
cache-dependency-path: |
pyproject.toml
"**requirements.txt"
- name: "Test config setup"
shell: bash
env:
HOME_RUNNER_DIR: /home/runner
run: |
set -x # print commands that are executed
mkdir -p "$HOME_RUNNER_DIR"/.oci
openssl genrsa -out $HOME_RUNNER_DIR/.oci/oci_ads_user.pem 2048
cat <<EOT >> "$HOME_RUNNER_DIR/.oci/config"
[DEFAULT]
user=ocid1.user.oc1..xxx
fingerprint=00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
tenancy=ocid1.tenancy.oc1..xxx
region=test_region
key_file=$HOME_RUNNER_DIR/.oci/oci_ads_user.pem
EOT
ls -lha "$HOME_RUNNER_DIR"/.oci
echo "Test config file:"
cat $HOME_RUNNER_DIR/.oci/config
- uses: ./.github/workflows/set-dummy-conf
name: "Test config setup"

- name: "Test env setup"
timeout-minutes: 20
Expand All @@ -104,22 +78,19 @@ jobs:
set -x # print commands that are executed
# Setup project and tests folder for cov reports to not be overwritten by another parallel step
if [[ ! -z "${{ matrix.cov-reports }}" ]]; then
mkdir -p cov-${{ matrix.name }}
cd cov-${{ matrix.name }}
ln -s ../tests tests
ln -s ../ads ads
ln -s ../.coveragerc .coveragerc
fi
mkdir -p cov-${{ matrix.name }}
cd cov-${{ matrix.name }}
ln -s ../tests tests
ln -s ../ads ads
ln -s ../.coveragerc .coveragerc
# Run tests
python -m pytest -v -p no:warnings --durations=5 \
-n auto --dist loadfile ${{ matrix.cov-reports }} \
-n auto --dist loadfile --cov=ads --cov-report=xml --cov-report=html \
${{ matrix.test-path }} ${{ matrix.ignore-path }}
- name: "Save coverage files"
uses: actions/upload-artifact@v3
if: ${{ matrix.cov-reports }}
with:
name: cov-reports-${{ matrix.name }}
path: |
Expand All @@ -132,7 +103,7 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: true
needs: test
if: ${{ success() }} && ${{ github.event.issue.pull_request }}
if: ${{ success() }} && && github.event_name == 'pull_request'
env:
COMPARE_BRANCH: main

Expand Down
84 changes: 84 additions & 0 deletions .github/workflows/run-unittests-py39-py310.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: "[Py3.9][Py3.10] - tests/unitary/**"

on:
workflow_dispatch:
pull_request:
paths:
- "ads/**"
- pyproject.toml
- "**requirements.txt"
- ".github/workflows/run-unittests*.yml"

# Cancel in progress workflows on pull_requests.
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

# hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5

jobs:
test:
name: python ${{ matrix.python-version }}, ${{ matrix.name }}
runs-on: ubuntu-latest
timeout-minutes: 90

strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]
test-path: ["tests/unitary/with_extras tests/unitary/default_setup", "tests/unitary/with_extras/model"]
include:
- test-path: "tests/unitary/with_extras tests/unitary/default_setup"
ignore-path: "--ignore tests/unitary/with_extras/model --ignore tests/unitary/with_extras/feature_store"
name: "unitary"
- test-path: "tests/unitary/with_extras/model"
name: "model"

steps:
- uses: actions/checkout@v3

- uses: ./.github/workflows/create-more-space
name: "Create more disk space"

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
pyproject.toml
"**requirements.txt"
- uses: ./.github/workflows/set-dummy-conf
name: "Test config setup"

- name: "Test env setup"
timeout-minutes: 20
shell: bash
run: |
set -x # print commands that are executed
sudo apt-get install libkrb5-dev graphviz
$CONDA/bin/conda init
source /home/runner/.bashrc
pip install -r dev-requirements.txt
- name: "Run unitary tests folder with maximum ADS dependencies"
timeout-minutes: 60
shell: bash
env:
CONDA_PREFIX: /usr/share/miniconda
run: |
set -x # print commands that are executed
# Run tests
python -m pytest -v -p no:warnings --durations=5 \
-n auto --dist loadfile \
${{ matrix.test-path }} ${{ matrix.ignore-path }}
26 changes: 26 additions & 0 deletions .github/workflows/set-dummy-conf/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This composite action is to avoid duplicating code across test actions.
# Ref: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action

name: "Create dummy oci config"
description: "Creates dummy oci config folder in ~/.oci"
runs:
using: composite
steps:
- shell: bash
env:
HOME_RUNNER_DIR: /home/runner
run: |
set -x # print commands that are executed
mkdir -p "$HOME_RUNNER_DIR"/.oci
openssl genrsa -out $HOME_RUNNER_DIR/.oci/oci_ads_user.pem 2048
cat <<EOT >> "$HOME_RUNNER_DIR/.oci/config"
[DEFAULT]
user=ocid1.user.oc1..xxx
fingerprint=00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
tenancy=ocid1.tenancy.oc1..xxx
region=test_region
key_file=$HOME_RUNNER_DIR/.oci/oci_ads_user.pem
EOT
ls -lha "$HOME_RUNNER_DIR"/.oci
echo "Test config file:"
cat $HOME_RUNNER_DIR/.oci/config
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ repos:
rev: v8.17.0
hooks:
- id: gitleaks
exclude: .github/workflows/reusable-actions/set-dummy-conf.yml
# Oracle copyright checker
- repo: https://github.com/oracle-samples/oci-data-science-ai-samples/
rev: cbe0136f7aaffe463b31ddf3f34b0e16b4b124ff
Expand Down

0 comments on commit 3c2a007

Please sign in to comment.