Skip to content

Commit 74ec25d

Browse files
authored
Merge pull request #9 from oracle/ODSC-42787/add_workflow_for_tests
Add workflow to run tests
2 parents b0bbbbe + b392157 commit 74ec25d

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

.github/workflows/run-tests.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Run Tests
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "container-image/**"
7+
- "oci_mlflow/**"
8+
- "tests/**"
9+
- "**requirements.txt"
10+
- setup.py
11+
# To run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# Cancel in progress workflows on pull_requests.
15+
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
19+
20+
permissions:
21+
contents: read
22+
23+
# hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
24+
env:
25+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5
26+
27+
jobs:
28+
test:
29+
name: python ${{ matrix.python-version }}
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 20
32+
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
python-version: ["3.8", "3.9", "3.10"]
37+
38+
steps:
39+
- uses: actions/checkout@v3
40+
41+
# Caching python libraries installed with pip
42+
# https://github.com/actions/cache/blob/main/examples.md#python---pip
43+
- uses: actions/cache@v3
44+
with:
45+
path: ~/.cache/pip
46+
key: ${{ runner.os }}-pip-${{ hashFiles('**/test-requirements.txt') }}
47+
restore-keys: |
48+
${{ runner.os }}-pip-
49+
- uses: actions/setup-python@v4
50+
with:
51+
python-version: ${{ matrix.python-version }}
52+
53+
- name: "Test config setup"
54+
shell: bash
55+
env:
56+
HOME_RUNNER_DIR: /home/runner
57+
run: |
58+
set -x # print commands that are executed
59+
mkdir -p "$HOME_RUNNER_DIR"/.oci
60+
openssl genrsa -out $HOME_RUNNER_DIR/.oci/oci_ads_user.pem 2048
61+
cat <<EOT >> "$HOME_RUNNER_DIR/.oci/config"
62+
[DEFAULT]
63+
user=ocid1.user.oc1..xxx
64+
fingerprint=00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
65+
tenancy=ocid1.tenancy.oc1..xxx
66+
region=test_region
67+
key_file=$HOME_RUNNER_DIR/.oci/oci_ads_user.pem
68+
EOT
69+
ls -lha "$HOME_RUNNER_DIR"/.oci
70+
echo "Test config file:"
71+
cat $HOME_RUNNER_DIR/.oci/config
72+
73+
- name: "Run tests"
74+
timeout-minutes: 15
75+
shell: bash
76+
env:
77+
NoDependency: True
78+
run: |
79+
set -x # print commands that are executed
80+
$CONDA/bin/conda init
81+
source /home/runner/.bashrc
82+
pip install -r test-requirements.txt
83+
python -m pytest -v -p no:warnings --durations=5 tests

0 commit comments

Comments
 (0)