|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, develop ] |
| 6 | + pull_request: |
| 7 | + branches: [ main, develop ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 15 | + python-version: ["3.10", "3.11", "3.12", "3.13"] |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Set up Python ${{ matrix.python-version }} |
| 21 | + uses: actions/setup-python@v4 |
| 22 | + with: |
| 23 | + python-version: ${{ matrix.python-version }} |
| 24 | + |
| 25 | + - name: Cache pip dependencies |
| 26 | + uses: actions/cache@v3 |
| 27 | + with: |
| 28 | + path: ~/.cache/pip |
| 29 | + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| 30 | + restore-keys: | |
| 31 | + ${{ runner.os }}-pip- |
| 32 | + |
| 33 | + - name: Install dependencies |
| 34 | + run: | |
| 35 | + python -m pip install --upgrade pip |
| 36 | + pip install -r requirements.txt |
| 37 | + pip install pytest pytest-cov black ruff mypy pre-commit |
| 38 | + |
| 39 | + - name: Lint with ruff |
| 40 | + run: | |
| 41 | + ruff check forexsmartbot/ tests/ |
| 42 | + |
| 43 | + - name: Type check with mypy |
| 44 | + run: | |
| 45 | + mypy forexsmartbot/ --ignore-missing-imports |
| 46 | + |
| 47 | + - name: Format check with black |
| 48 | + run: | |
| 49 | + black --check forexsmartbot/ tests/ |
| 50 | + |
| 51 | + - name: Test with pytest |
| 52 | + run: | |
| 53 | + pytest tests/ --cov=forexsmartbot --cov-report=xml --cov-report=term-missing |
| 54 | + |
| 55 | + - name: Upload coverage to Codecov |
| 56 | + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' |
| 57 | + uses: codecov/codecov-action@v3 |
| 58 | + with: |
| 59 | + file: ./coverage.xml |
| 60 | + flags: unittests |
| 61 | + name: codecov-umbrella |
| 62 | + fail_ci_if_error: false |
| 63 | + |
| 64 | + build: |
| 65 | + runs-on: ubuntu-latest |
| 66 | + needs: test |
| 67 | + |
| 68 | + steps: |
| 69 | + - uses: actions/checkout@v4 |
| 70 | + |
| 71 | + - name: Set up Python |
| 72 | + uses: actions/setup-python@v4 |
| 73 | + with: |
| 74 | + python-version: "3.11" |
| 75 | + |
| 76 | + - name: Install build dependencies |
| 77 | + run: | |
| 78 | + python -m pip install --upgrade pip |
| 79 | + pip install build twine |
| 80 | + |
| 81 | + - name: Build package |
| 82 | + run: | |
| 83 | + python -m build |
| 84 | + |
| 85 | + - name: Check package |
| 86 | + run: | |
| 87 | + twine check dist/* |
0 commit comments