Spaces:
Sleeping
Sleeping
Add GitHub Actions CI pipeline for unit tests and Docker image building.
Browse files- .github/workflows/ci.yml +18 -5
.github/workflows/ci.yml
CHANGED
|
@@ -7,9 +7,8 @@ on:
|
|
| 7 |
branches: [ "main" ]
|
| 8 |
|
| 9 |
jobs:
|
| 10 |
-
|
| 11 |
runs-on: ubuntu-latest
|
| 12 |
-
|
| 13 |
steps:
|
| 14 |
- name: Checkout code
|
| 15 |
uses: actions/checkout@v3
|
|
@@ -26,7 +25,7 @@ jobs:
|
|
| 26 |
uses: actions/setup-python@v4
|
| 27 |
with:
|
| 28 |
python-version: "3.10"
|
| 29 |
-
cache: 'pip'
|
| 30 |
|
| 31 |
- name: Install dependencies
|
| 32 |
run: |
|
|
@@ -38,14 +37,13 @@ jobs:
|
|
| 38 |
|
| 39 |
- name: Lint with Ruff
|
| 40 |
run: |
|
| 41 |
-
# Using make lint as defined in Makefile
|
| 42 |
make lint
|
| 43 |
|
| 44 |
- name: Run Unit Tests
|
| 45 |
run: |
|
| 46 |
-
# Run tests and generate HTML report
|
| 47 |
pytest tests/unit/ -v -m unit --html=report.html --self-contained-html
|
| 48 |
|
|
|
|
| 49 |
- name: Upload Test Report
|
| 50 |
if: failure()
|
| 51 |
uses: actions/upload-artifact@v4
|
|
@@ -53,6 +51,21 @@ jobs:
|
|
| 53 |
name: test-report
|
| 54 |
path: report.html
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
- name: Configure DVC
|
| 57 |
run: |
|
| 58 |
dvc remote modify origin --local auth basic
|
|
|
|
| 7 |
branches: [ "main" ]
|
| 8 |
|
| 9 |
jobs:
|
| 10 |
+
unit-tests:
|
| 11 |
runs-on: ubuntu-latest
|
|
|
|
| 12 |
steps:
|
| 13 |
- name: Checkout code
|
| 14 |
uses: actions/checkout@v3
|
|
|
|
| 25 |
uses: actions/setup-python@v4
|
| 26 |
with:
|
| 27 |
python-version: "3.10"
|
| 28 |
+
cache: 'pip'
|
| 29 |
|
| 30 |
- name: Install dependencies
|
| 31 |
run: |
|
|
|
|
| 37 |
|
| 38 |
- name: Lint with Ruff
|
| 39 |
run: |
|
|
|
|
| 40 |
make lint
|
| 41 |
|
| 42 |
- name: Run Unit Tests
|
| 43 |
run: |
|
|
|
|
| 44 |
pytest tests/unit/ -v -m unit --html=report.html --self-contained-html
|
| 45 |
|
| 46 |
+
# Preserved contribution from Antonio Fratta
|
| 47 |
- name: Upload Test Report
|
| 48 |
if: failure()
|
| 49 |
uses: actions/upload-artifact@v4
|
|
|
|
| 51 |
name: test-report
|
| 52 |
path: report.html
|
| 53 |
|
| 54 |
+
build-image:
|
| 55 |
+
needs: unit-tests
|
| 56 |
+
runs-on: ubuntu-latest
|
| 57 |
+
steps:
|
| 58 |
+
- name: Checkout code
|
| 59 |
+
uses: actions/checkout@v3
|
| 60 |
+
|
| 61 |
+
- name: Free Disk Space
|
| 62 |
+
run: |
|
| 63 |
+
sudo rm -rf /usr/share/dotnet
|
| 64 |
+
sudo rm -rf /usr/local/lib/android
|
| 65 |
+
sudo rm -rf /opt/ghc
|
| 66 |
+
sudo rm -rf /opt/hostedtoolcache/CodeQL
|
| 67 |
+
sudo docker image prune --all --force
|
| 68 |
+
|
| 69 |
- name: Configure DVC
|
| 70 |
run: |
|
| 71 |
dvc remote modify origin --local auth basic
|