From 51eaaafabe5131f341350827d597a99ffb01bc21 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Tue, 3 Aug 2021 16:10:16 +0200 Subject: [PATCH] Simplify linux test matrix. (#10835) * Simplify linux test matrix. * Quoting? * Run instead of use. * Mount CWD to find the test scripts. * No it. * Add WORKDIR. * Workdir. * Less clutter. * Minor UX fixes. --- .github/workflows/ci.yml | 79 ++----------------- .../workflows/{ci_image.yml => ci_images.yml} | 6 +- README.rst | 8 +- ci/Dockerfile | 2 + ci/{unit_test.sh => unit_tests.sh} | 0 5 files changed, 16 insertions(+), 79 deletions(-) rename .github/workflows/{ci_image.yml => ci_images.yml} (92%) rename ci/{unit_test.sh => unit_tests.sh} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a75689efdc7..54415a1a22d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CondaCI +name: CI tests on: push: @@ -116,88 +116,19 @@ jobs: entrypoint: /bin/bash args: -c "/opt/conda/bin/flake8 --statistics" - linux-tests-py37: + linux-tests: runs-on: ubuntu-latest strategy: fail-fast: false matrix: + python_version: ['3.7', '3.8', '3.9'] test_type: ['unit', 'integration'] steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: py37 unit tests - if: ${{ matrix.test_type == 'unit' }} - uses: docker://continuumio/conda-ci-linux-64-python3.7:latest - with: - entrypoint: /bin/bash - args: ./ci/unit_test.sh - - name: py37 integration tests - if: ${{ matrix.test_type == 'integration' }} - uses: docker://continuumio/conda-ci-linux-64-python3.7:latest - with: - entrypoint: /bin/bash - args: ./ci/integration_tests.sh - - name: upload codecov - run: | - if [[ $(git diff origin/master --name-only | wc -l) == $(git diff origin/master --name-only | grep docs | wc -l) && $(git diff origin/master --name-only | grep docs) ]]; then - echo "No codecov report to upload" - else - bash <(curl -s https://codecov.io/bash) - fi - - linux-tests-py38: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - test_type: ['unit', 'integration'] - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: py38 unit tests - if: ${{ matrix.test_type == 'unit' }} - uses: docker://continuumio/conda-ci-linux-64-python3.8:latest - with: - entrypoint: /bin/bash - args: ./ci/unit_test.sh - - name: py38 integration tests - if: ${{ matrix.test_type == 'integration' }} - uses: docker://continuumio/conda-ci-linux-64-python3.8:latest - with: - entrypoint: /bin/bash - args: ./ci/integration_tests.sh - - name: upload codecov - run: | - if [[ $(git diff origin/master --name-only | wc -l) == $(git diff origin/master --name-only | grep docs | wc -l) && $(git diff origin/master --name-only | grep docs) ]]; then - echo "No codecov report to upload" - else - bash <(curl -s https://codecov.io/bash) - fi - - linux-tests-py39: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - test_type: ['unit', 'integration'] - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: py39 unit tests - if: ${{ matrix.test_type == 'unit' }} - uses: docker://continuumio/conda-ci-linux-64-python3.9:latest - with: - entrypoint: /bin/bash - args: ./ci/unit_test.sh - - name: py39 integration tests - if: ${{ matrix.test_type == 'integration' }} - uses: docker://continuumio/conda-ci-linux-64-python3.9:latest - with: - entrypoint: /bin/bash - args: ./ci/integration_tests.sh + - name: Python ${{ matrix.python_version }} ${{ matrix.test_type }} tests + run: docker run --rm -v ${PWD}:/conda --workdir=/conda continuumio/conda-ci-linux-64-python${{ matrix.python_version }}:latest /conda/ci/${{ matrix.test_type }}_tests.sh - name: upload codecov run: | if [[ $(git diff origin/master --name-only | wc -l) == $(git diff origin/master --name-only | grep docs | wc -l) && $(git diff origin/master --name-only | grep docs) ]]; then diff --git a/.github/workflows/ci_image.yml b/.github/workflows/ci_images.yml similarity index 92% rename from .github/workflows/ci_image.yml rename to .github/workflows/ci_images.yml index 523f0e5e721..440f93347aa 100644 --- a/.github/workflows/ci_image.yml +++ b/.github/workflows/ci_images.yml @@ -1,4 +1,4 @@ -name: Build and Publish Conda CI Images +name: CI images on: schedule: @@ -6,11 +6,11 @@ on: pull_request: paths: - 'ci/Dockerfile' - - '.github/workflows/ci_image.yml' + - '.github/workflows/ci_images.yml' push: paths: - 'ci/Dockerfile' - - '.github/workflows/ci_image.yml' + - '.github/workflows/ci_images.yml' workflow_dispatch: env: diff --git a/README.rst b/README.rst index 6126eef8f21..ab602c79078 100644 --- a/README.rst +++ b/README.rst @@ -7,10 +7,14 @@ ---------------------------------------- -.. image:: https://github.com/conda/conda/workflows/CondaCI/badge.svg - :target: https://github.com/conda/conda/actions?query=workflow%3ACondaCI+branch%3Amaster +.. image:: https://github.com/conda/conda/actions/workflows/ci.yml/badge.svg + :target: https://github.com/conda/conda/actions/workflows/ci.yml :alt: CI Tests (GitHub Actions) +.. image:: https://github.com/conda/conda/actions/workflows/ci_images.yml/badge.svg + :target: https://github.com/conda/conda/actions/workflows/ci_images.yml + :alt: CI Images (GitHub Actions) + .. image:: https://img.shields.io/codecov/c/github/conda/conda/master.svg?label=coverage :alt: Codecov Status :target: https://codecov.io/gh/conda/conda/branch/master diff --git a/ci/Dockerfile b/ci/Dockerfile index 8329cabd284..71e73f41a7c 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -39,5 +39,7 @@ RUN /opt/conda/bin/conda install --update-all -y -c defaults \ USER test_user +WORKDIR /conda + ENTRYPOINT ["/usr/bin/tini", "--"] CMD ["/bin/bash"] diff --git a/ci/unit_test.sh b/ci/unit_tests.sh similarity index 100% rename from ci/unit_test.sh rename to ci/unit_tests.sh