diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2767c998..df11c8c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,25 +4,29 @@ on: push: branches: - master - pull_request: {} + paths: + - "**.py" + pull_request: + paths: + - "**.py" jobs: check: name: Run pre-commit checks runs-on: ubuntu-latest steps: - - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: pip - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - name: install pre-commit - run: | - python -m pip install --upgrade pip - pip install pre-commit - - name: Run pre-commit - run: pre-commit run --all-files + - uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: pip + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - name: Install pre-commit + run: | + python -m pip install --upgrade pip + pip install pre-commit + - name: Run pre-commit + run: pre-commit run --all-files test: name: Test ${{ matrix.python-version }}${{ matrix.compile && ' compiled' || '' }} runs-on: ubuntu-latest @@ -33,28 +37,28 @@ jobs: python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', 'pypy3'] compile: [true, false] exclude: - - python-version: pypy3 - compile: true + - python-version: pypy3 + compile: true steps: - - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: pip - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: cythonize - if: matrix.compile - run: | - python -m pip install cython ${{ (matrix.python-version == '3.6' || matrix.python-version == 'pypy3') && 'dataclasses' || '' }} - python scripts/cythonize.py - python setup.py build_ext --inplace - - name: Install tox - run: | - python -m pip install --upgrade pip - pip install tox tox-gh-actions - - name: Run tox - run: tox + - uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: pip + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: cythonize + if: matrix.compile + run: | + python -m pip install cython ${{ (matrix.python-version == '3.6' || matrix.python-version == 'pypy3') && 'dataclasses' || '' }} + python scripts/cythonize.py + python setup.py build_ext --inplace + - name: Install tox + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions + - name: Run tox + run: tox diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml new file mode 100644 index 00000000..fd9e5fb8 --- /dev/null +++ b/.github/workflows/doc.yml @@ -0,0 +1,46 @@ +name: Documentation + +on: + push: + branches: + - master + tags: + - v[0-9]*.*.* + paths: + - examples/** + - docs/** + +jobs: + publish_doc: + name: Publish documentation + runs-on: ubuntu-latest + steps: + - uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: pip + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-python@v2 + - name: Install requirements + run: | + python -m pip install --upgrade pip + pip install -r docs/requirements.txt + - name: Setup git + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git fetch origin gh-pages --depth=1 + - name: Publish documentation + run: | + export version=$(python setup.py --version | cut -d. -f-2) + export revision=$(python setup.py --version | cut -d. -f3) + if [[ $GITHUB_REF != refs/tags/* ]]; then + mike deploy $version dev -t "$version (dev)" -u + elif [[ $revision == 0 ]]; then + mike retitle latest "$(mike list latest -j | jq .version -r)" + mike deploy $version latest -t "$version (latest)" -u + else + mike deploy $version + fi \ No newline at end of file