|
9 | 9 |
|
10 | 10 | jobs: |
11 | 11 | build: |
12 | | - name: Build Wheels |
13 | | - runs-on: ubuntu-latest |
14 | | - |
| 12 | + name: Build and Test Package |
| 13 | + runs-on: ${{ matrix.os }} |
15 | 14 | strategy: |
16 | 15 | matrix: |
17 | 16 | python-version: ["3.8", "3.9", "3.10", "3.11"] |
18 | 17 | os: [ubuntu-latest, macos-latest, windows-latest] |
19 | 18 |
|
20 | 19 | steps: |
21 | | - # Checkout the repository |
| 20 | + # Step 1: Checkout the repository |
22 | 21 | - name: Checkout Code |
23 | 22 | uses: actions/checkout@v3 |
24 | 23 |
|
25 | | - # Set up Python |
| 24 | + # Step 2: Set up Python environment |
26 | 25 | - name: Set up Python ${{ matrix.python-version }} |
27 | 26 | uses: actions/setup-python@v4 |
28 | 27 | with: |
29 | 28 | python-version: ${{ matrix.python-version }} |
30 | 29 |
|
31 | | - # Install dependencies |
| 30 | + # Step 3: Cache Python dependencies |
| 31 | + - name: Cache Python Dependencies |
| 32 | + uses: actions/cache@v3 |
| 33 | + with: |
| 34 | + path: ~/.cache/pip |
| 35 | + key: ${{ runner.os }}-pip-${{ matrix.python-version }} |
| 36 | + restore-keys: | |
| 37 | + ${{ runner.os }}-pip- |
| 38 | +
|
| 39 | + # Step 4: Install dependencies |
32 | 40 | - name: Install Build Tools |
33 | 41 | run: | |
34 | 42 | python -m pip install --upgrade pip setuptools wheel |
35 | 43 | python -m pip install pybind11 |
36 | 44 |
|
37 | | - # Build the wheel |
| 45 | + # Step 5: Build the wheel |
38 | 46 | - name: Build Wheel |
39 | 47 | run: python setup.py bdist_wheel |
40 | 48 |
|
41 | | - # Upload built wheels as artifacts |
| 49 | + # Step 6: Upload built wheels as artifacts |
42 | 50 | - name: Upload Built Wheels |
43 | 51 | uses: actions/upload-artifact@v3 |
44 | 52 | with: |
45 | 53 | name: binaryparser-wheels |
46 | 54 | path: dist/*.whl |
47 | 55 |
|
48 | | - # Install the built wheel |
| 56 | + # Step 7: Install the built package |
49 | 57 | - name: Install Built Package |
50 | | - run: | |
51 | | - pip install dist/*.whl |
| 58 | + run: pip install dist/*.whl |
52 | 59 |
|
53 | | -
|
54 | | - # Test the package (optional) |
| 60 | + # Step 8: Run tests |
55 | 61 | - name: Run Tests |
| 62 | + env: |
| 63 | + PYTHONPATH: ${{ github.workspace }} |
| 64 | + run: | |
| 65 | + python -m unittest discover -s tests |
| 66 | +
|
| 67 | + # Optional Step: Debugging (if tests fail) |
| 68 | + - name: Show Python Environment (Debug) |
| 69 | + if: failure() |
56 | 70 | run: | |
57 | | - python ./tests/test.py |
| 71 | + python --version |
| 72 | + pip list |
| 73 | + ls -R |
| 74 | +
|
0 commit comments