# main continuous integration workflow # Copyright 2023 ipydrawio contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. on: push: branches: - master pull_request: branches: - master concurrency: group: ${{ github.ref }} cancel-in-progress: true env: PYTHONUNBUFFERED: '1' PYTHONIOENCODING: 'utf-8' PIP_DISABLE_PIP_VERSION_CHECK: '1' CI: '1' CONDARC: ${{ github.workspace }}/.github/.condarc # our stuff ATEST_RETRIES: '3' CACHE_EPOCH: '6' CONDA_BUILDERER: mambabuild jobs: build: name: build runs-on: ${{ matrix.os }}-latest strategy: matrix: os: [ubuntu] python-version: ['3.9'] defaults: run: shell: bash -l {0} env: BUILDING_IN_CI: '1' steps: - uses: actions/checkout@v3 with: submodules: recursive # configure builtin providers - name: setup (python) uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} architecture: x64 - name: setup (node) uses: actions/setup-node@v3 with: node-version: '16' # restore caches - name: cache (pip) uses: actions/cache@v3 with: path: ~/.cache/pip key: | ${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-${{ hashFiles('.github/pip-build.txt') }} restore-keys: | ${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip- - name: cache (node) uses: actions/cache@v3 id: cache-node-modules with: path: '**/node_modules' key: | ${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-build-${{ hashFiles('yarn.lock', '.github/pip-build.txt') }} - name: cache (yarn) uses: actions/cache@v3 if: steps.cache-node-modules.outputs.cache-hit != 'true' id: cache-yarn-packages with: path: .yarn-packages key: | ${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }} restore-keys: | ${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}- ${{ env.CACHE_EPOCH }}-yarn- - name: setup (pip) run: pip install -U pip wheel setuptools - name: setup (pip build) run: pip install -U -v -r .github/pip-build.txt - name: check (pip) run: | set -eux mkdir -p build/pip pip freeze | tee build/pip/dist.pip.freeze pip check - name: upload (pip freeze) uses: actions/upload-artifact@v3 with: name: ipydrawio-${{ github.run_number }}-build-pip-freeze path: ./build/pip/ - name: list run: doit list --all --status - name: build run: doit -n8 dist || exit 0 - name: build (again, maybe) run: doit dist - name: status run: doit list --all --status | sort if: always() - name: upload (dist) uses: actions/upload-artifact@v3 with: name: ipydrawio-${{ github.run_number }}-dist path: ./dist conda-build: needs: [build] runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false matrix: os: ['ubuntu'] steps: - name: configure line endings run: git config --global core.autocrlf false - name: checkout uses: actions/checkout@v3 - name: install (conda) uses: conda-incubator/setup-miniconda@v2 with: environment-file: .github/environment-conda-build.yml miniforge-variant: Mambaforge use-mamba: true - name: download (dist) uses: actions/download-artifact@v3 with: name: ipydrawio-${{ github.run_number }}-dist path: ./dist - name: build (conda) shell: bash -l {0} run: doit -s conda_build - name: upload (conda) uses: actions/upload-artifact@v3 with: name: ipydrawio-${{ github.run_number }}-conda path: ./build/conda-bld - name: Rename uncached conda packages shell: bash run: mv "${CONDA_PKGS_DIR}" "${CONDA_PKGS_DIR}_do_not_cache" conda-test: needs: [conda-build] runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false matrix: os: ['ubuntu', 'macos', 'windows'] steps: - name: configure line endings run: git config --global core.autocrlf false - name: checkout uses: actions/checkout@v3 - name: install (conda) uses: conda-incubator/setup-miniconda@v2 if: matrix.os == 'windows' with: environment-file: .github/environment-conda-build-win.yml miniforge-variant: Mambaforge use-mamba: true - name: install (conda) uses: conda-incubator/setup-miniconda@v2 if: matrix.os != 'windows' with: environment-file: .github/environment-conda-build.yml miniforge-variant: Mambaforge use-mamba: true - name: download (conda) uses: actions/download-artifact@v3 with: name: ipydrawio-${{ github.run_number }}-conda path: ./build/conda-bld - name: test (conda) shell: bash -l {0} run: | conda index build/conda-bld doit -s conda_test || doit -s conda_test - name: Rename uncached conda packages shell: bash run: mv "${CONDA_PKGS_DIR}" "${CONDA_PKGS_DIR}_do_not_cache" test: needs: [build] name: ${{ matrix.os }} ${{ matrix.python-version }} runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false matrix: os: ['ubuntu', 'macos', 'windows'] python-version: ['3.8', '3.11'] include: - python-version: '3.8' CI_ARTIFACT: 'sdist' - python-version: '3.11' CI_ARTIFACT: 'wheel' env: TESTING_IN_CI: '1' steps: - name: configure line endings run: git config --global core.autocrlf false - name: checkout uses: actions/checkout@v3 - name: install (conda) uses: conda-incubator/setup-miniconda@v2 with: miniforge-variant: Mambaforge python-version: ${{ matrix.python-version }} environment-file: .github/environment.yml use-mamba: true - name: tweak install (conda) if: matrix.python-version == '3.8' shell: bash -l {0} run: mamba env update -n test --file .github/environment-py38.yml - name: download (dist) uses: actions/download-artifact@v3 with: name: ipydrawio-${{ github.run_number }}-dist path: ./dist - name: unit test (unix) if: matrix.os != 'windows' shell: bash -l {0} run: doit test:pytest:* || doit test:pytest:* - name: acceptance test (unix) if: matrix.os != 'windows' shell: bash -l {0} run: doit test || doit test - name: unit test (windows) if: matrix.os == 'windows' shell: cmd /C CALL {0} run: doit test:pytest:* || doit test:pytest:* - name: acceptance test (windows) if: matrix.os == 'windows' shell: cmd /C CALL {0} run: doit test || doit test - name: upload coverage shell: bash -l {0} run: | set -eux cd py_packages/ipydrawio codecov --root ../.. cd ../ipydrawio-export codecov --root ../.. cd ../ipydrawio-mathjax codecov --root ../.. - name: upload (utest) if: always() uses: actions/upload-artifact@v3 with: name: |- ipydrawio-${{ github.run_number }}-utest-${{ matrix.os }}-${{ matrix.python-version }} path: ./build/pytest - name: upload (atest) if: always() uses: actions/upload-artifact@v3 with: name: |- ipydrawio-${{ github.run_number }}-atest-${{ matrix.os }}-${{matrix.python-version }} path: ./build/atest - name: Rename uncached conda packages shell: bash run: mv "${CONDA_PKGS_DIR}" "${CONDA_PKGS_DIR}_do_not_cache" lint: name: lint runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false matrix: os: ['ubuntu'] python-version: ['3.11'] steps: - name: checkout uses: actions/checkout@v3 with: submodules: recursive - name: cache (node) uses: actions/cache@v3 id: cache-node-modules with: path: '**/node_modules' key: | ${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-build-${{ hashFiles('yarn.lock', '.github/pip-build.txt') }} - name: cache (yarn) uses: actions/cache@v3 if: steps.cache-node-modules.outputs.cache-hit != 'true' id: cache-yarn-packages with: path: .yarn-packages key: | ${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }} restore-keys: | ${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}- ${{ env.CACHE_EPOCH }}-yarn- - name: install (conda) uses: conda-incubator/setup-miniconda@v2 with: miniforge-variant: Mambaforge python-version: ${{ matrix.python-version }} environment-file: .binder/environment.yml use-mamba: true - name: lint shell: bash -l {0} run: doit -n8 test:integrity lint || exit 0 - name: lint (again, maybe) shell: bash -l {0} run: doit test:integrity lint - name: Rename uncached conda packages shell: bash run: mv "${CONDA_PKGS_DIR}" "${CONDA_PKGS_DIR}_do_not_cache" docs: name: docs runs-on: ${{ matrix.os }}-latest env: ATEST_ARGS: '["--exclude","NOTapp:lite"]' strategy: fail-fast: false matrix: os: ['ubuntu'] python-version: ['3.10'] steps: - name: checkout uses: actions/checkout@v3 with: submodules: recursive - name: cache (node) uses: actions/cache@v3 id: cache-node-modules with: path: '**/node_modules' key: | ${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-build-${{ hashFiles('yarn.lock', '.github/pip-build.txt') }} - name: cache (yarn) uses: actions/cache@v3 if: steps.cache-node-modules.outputs.cache-hit != 'true' id: cache-yarn-packages with: path: .yarn-packages key: | ${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }} restore-keys: | ${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}- ${{ env.CACHE_EPOCH }}-yarn- - name: install (conda) uses: conda-incubator/setup-miniconda@v2 with: miniforge-variant: Mambaforge python-version: ${{ matrix.python-version }} environment-file: docs/environment.yml use-mamba: true - name: build shell: bash -l {0} run: doit -n4 build - name: build docs shell: bash -l {0} run: doit docs || doit docs || doit docs - name: check docs shell: bash -l {0} run: doit check - name: tests (robot) shell: bash -l {0} run: doit test:robot - name: upload (atest) if: always() uses: actions/upload-artifact@v3 with: name: |- ipydrawio-${{ github.run_number }}-atest-${{ matrix.os }}${{ matrix.python-version }} path: ./build/atest - name: upload (docs) if: always() uses: actions/upload-artifact@v3 with: name: |- ipydrawio-${{ github.run_number }}-docs-${{ matrix.os }}-${{matrix.python-version }} path: ./build/docs - name: Rename uncached conda packages shell: bash run: mv "${CONDA_PKGS_DIR}" "${CONDA_PKGS_DIR}_do_not_cache"