|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [ master, main, ci/* ] |
| 5 | + tags: [ 'v[0-9]+\.[0-9]+.*' ] |
| 6 | + pull_request: { branches: [master] } |
| 7 | + schedule: [ cron: '20 16 * * 6' ] |
| 8 | + workflow_call: |
| 9 | + |
| 10 | +jobs: |
| 11 | + lint: |
| 12 | + name: Lint |
| 13 | + runs-on: ubuntu-latest |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + python-version: [ "3.8", "3.9", "3.10", "3.11" ] |
| 17 | + steps: |
| 18 | + - name: Set up Python |
| 19 | + uses: actions/setup-python@v4 |
| 20 | + with: |
| 21 | + python-version: ${{ matrix.python-version }} |
| 22 | + - uses: actions/cache@v2 |
| 23 | + name: Set up caches |
| 24 | + with: |
| 25 | + path: ~/.cache/pip |
| 26 | + key: ${{ runner.os }}-py${{ matrix.python-version }} |
| 27 | + - name: Checkout repo |
| 28 | + uses: actions/checkout@v4 |
| 29 | + with: |
| 30 | + fetch-depth: 3 |
| 31 | + - name: Install dependencies |
| 32 | + run: pip install flake8 |
| 33 | + - name: flake8 |
| 34 | + run: flake8 skopt/ |
| 35 | + |
| 36 | + test: |
| 37 | + name: Test |
| 38 | + runs-on: ubuntu-latest |
| 39 | + strategy: |
| 40 | + matrix: |
| 41 | + # When bumping, note to revise env.TEST_WITH_COVERAGE below |
| 42 | + python-version: [ "3.8", "3.9", "3.10", "3.11" ] |
| 43 | + scikit-version: [ "1.1.3", "1.2.2", "1.3.2" ] |
| 44 | + |
| 45 | + env: |
| 46 | + TEST_WITH_COVERAGE: ${{ matrix.python-version == '3.11' && matrix.scikit-version == '1.3.2' }} |
| 47 | + |
| 48 | + steps: |
| 49 | + - name: Set up Python ${{ matrix.python-version }} |
| 50 | + uses: actions/setup-python@v4 |
| 51 | + with: |
| 52 | + python-version: ${{ matrix.python-version }} |
| 53 | + |
| 54 | + - name: Checkout repo |
| 55 | + uses: actions/checkout@v4 |
| 56 | + |
| 57 | + - name: Install dependencies |
| 58 | + run: | |
| 59 | + pip install -U pip wheel |
| 60 | + pip install scikit-learn==${{ matrix.scikit-version }} |
| 61 | + pip install . |
| 62 | + pip install .[dev,plots] |
| 63 | + python -c 'import skopt; print(skopt.__version__)' |
| 64 | +
|
| 65 | + - name: Test |
| 66 | + if: env.TEST_WITH_COVERAGE != 'true' |
| 67 | + run: | |
| 68 | + make test-code-parallel |
| 69 | +
|
| 70 | + - name: Test with Coverage |
| 71 | + if: env.TEST_WITH_COVERAGE == 'true' |
| 72 | + run: | |
| 73 | + make test-coverage |
| 74 | + bash <(curl -s https://codecov.io/bash) |
| 75 | +
|
| 76 | + - name: Upload artifact |
| 77 | + uses: actions/upload-artifact@v2 |
| 78 | + with: |
| 79 | + name: package |
| 80 | + path: dist |
| 81 | + |
| 82 | + docs: |
| 83 | + name: Docs |
| 84 | + runs-on: ubuntu-latest |
| 85 | + strategy: |
| 86 | + matrix: |
| 87 | + python-version: [ "3.11" ] |
| 88 | + env: |
| 89 | + MPLBACKEND: "agg" |
| 90 | + steps: |
| 91 | + - name: Set up Python ${{ matrix.python-version }} |
| 92 | + uses: actions/setup-python@v4 |
| 93 | + with: |
| 94 | + python-version: ${{ matrix.python-version }} |
| 95 | + |
| 96 | + - name: Checkout repo |
| 97 | + uses: actions/checkout@v4 |
| 98 | + |
| 99 | + - name: Install latex dependencies |
| 100 | + run: | |
| 101 | + sudo apt-get -yq update |
| 102 | + sudo apt-get -yq --no-install-recommends install \ |
| 103 | + dvipng texlive-latex-base texlive-latex-extra \ |
| 104 | + texlive-latex-recommended texlive-fonts-recommended \ |
| 105 | + latexmk tex-gyre gsfonts ccache |
| 106 | +
|
| 107 | + - name: Install dependencies |
| 108 | + run: | |
| 109 | + pip install -U pip setuptools wheel |
| 110 | + pip install .[dev,doc,plots] |
| 111 | +
|
| 112 | + - name: Test docs |
| 113 | + run: | |
| 114 | + python -c 'import skopt; skopt.show_versions()' |
| 115 | + make test-doc |
| 116 | + make test-sphinxext |
| 117 | + make -C doc doctest |
| 118 | + make -C doc linkcheck |
| 119 | +
|
| 120 | + - name: Build docs |
| 121 | + run: | |
| 122 | + .github/scripts/build_docs.sh |
| 123 | +
|
| 124 | + - name: Upload artifact |
| 125 | + uses: actions/upload-artifact@v2 |
| 126 | + with: |
| 127 | + name: docs |
| 128 | + path: doc/_build/html/stable |
0 commit comments