Deploy new ORD app (#166) #674
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright 2020 Open Reaction Database Project Authors | |
| # | |
| # 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. | |
| name: CI | |
| on: [ pull_request, push ] | |
| env: | |
| # See https://dev.to/dtinth/caching-docker-builds-in-github-actions-which-approach-is-the-fastest-a-research-18ei. | |
| CACHE_TARGET: "docker.pkg.github.com/open-reaction-database/ord-interface/interface-cache" | |
| jobs: | |
| test_ord_interface: | |
| strategy: | |
| matrix: | |
| os: ["ubuntu-latest", "macos-14"] | |
| python-version: ["3.10", "3.11", "3.12"] | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| PGDATA: $GITHUB_WORKSPACE/rdkit-postgres | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| miniconda-version: 'latest' | |
| - name: Setup PostgreSQL | |
| shell: bash -l {0} | |
| run: | | |
| # NOTE(skearnes): conda is only used for postgres (not python). | |
| conda install -c conda-forge rdkit-postgresql | |
| initdb | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: actions-setup-redis | |
| uses: shogo82148/actions-setup-redis@v1.35.0 | |
| - name: Install ord_interface | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install wheel | |
| python -m pip install .[tests] | |
| - name: Run tests | |
| shell: bash -l {0} | |
| run: | | |
| coverage erase | |
| pytest -vv --cov=ord_interface --durations=20 --ignore=ord_interface/editor | |
| coverage xml | |
| - uses: codecov/codecov-action@v1 | |
| test_app: | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| # NOTE(skearnes): Docker is not supported on macOS GitLab runners. | |
| # NOTE(skearnes): ubuntu-latest AppArmor doesn't play nicely with puppeteer. | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: actions/setup-node@v3 | |
| - name: actions-setup-redis | |
| uses: shogo82148/actions-setup-redis@v1.35.0 | |
| - name: Setup docker cache | |
| run: | | |
| docker login docker.pkg.github.com -u "${GITHUB_ACTOR}" --password="${{ secrets.GITHUB_TOKEN }}" | |
| docker pull "${CACHE_TARGET}" | |
| - name: Install ord-interface | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install wheel | |
| python -m pip install .[tests] | |
| - name: Install non-python test dependencies | |
| run: | | |
| cd "${GITHUB_WORKSPACE}/ord_interface" | |
| npm install puppeteer | |
| - name: Run tests | |
| run: | | |
| cd "${GITHUB_WORKSPACE}/ord_interface" | |
| ./run_tests.sh "--cache-from=${CACHE_TARGET}" | |
| - name: Update docker cache | |
| run: | | |
| docker tag openreactiondatabase/ord-interface "${CACHE_TARGET}" | |
| docker push "${CACHE_TARGET}" | |
| # NOTE(kearnes): Actions in forks cannot update the cache. | |
| if: ${{ ! github.event.pull_request.head.repo.fork }} |