|
| 1 | +name: Code Checks |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - 1.3.x |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + - 1.3.x |
| 12 | + |
| 13 | +env: |
| 14 | + ENV_FILE: environment.yml |
| 15 | + PANDAS_CI: 1 |
| 16 | + |
| 17 | +jobs: |
| 18 | + pre_commit: |
| 19 | + name: pre-commit |
| 20 | + runs-on: ubuntu-latest |
| 21 | + concurrency: |
| 22 | + # https://github.community/t/concurrecy-not-work-for-push/183068/7 |
| 23 | + group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-pre-commit |
| 24 | + cancel-in-progress: true |
| 25 | + steps: |
| 26 | + - name: Checkout |
| 27 | + uses: actions/checkout@v2 |
| 28 | + |
| 29 | + - name: Install Python |
| 30 | + uses: actions/setup-python@v2 |
| 31 | + with: |
| 32 | + python-version: '3.9.7' |
| 33 | + |
| 34 | + - name: Run pre-commit |
| 35 | + uses: pre-commit/[email protected] |
| 36 | + |
| 37 | + typing_and_docstring_validation: |
| 38 | + name: Docstring and typing validation |
| 39 | + runs-on: ubuntu-latest |
| 40 | + defaults: |
| 41 | + run: |
| 42 | + shell: bash -l {0} |
| 43 | + |
| 44 | + concurrency: |
| 45 | + # https://github.community/t/concurrecy-not-work-for-push/183068/7 |
| 46 | + group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-code-checks |
| 47 | + cancel-in-progress: true |
| 48 | + |
| 49 | + steps: |
| 50 | + - name: Checkout |
| 51 | + uses: actions/checkout@v2 |
| 52 | + with: |
| 53 | + fetch-depth: 0 |
| 54 | + |
| 55 | + - name: Cache conda |
| 56 | + uses: actions/cache@v2 |
| 57 | + with: |
| 58 | + path: ~/conda_pkgs_dir |
| 59 | + key: ${{ runner.os }}-conda-${{ hashFiles('${{ env.ENV_FILE }}') }} |
| 60 | + |
| 61 | + - uses: conda-incubator/setup-miniconda@v2 |
| 62 | + with: |
| 63 | + mamba-version: "*" |
| 64 | + channels: conda-forge |
| 65 | + activate-environment: pandas-dev |
| 66 | + channel-priority: strict |
| 67 | + environment-file: ${{ env.ENV_FILE }} |
| 68 | + use-only-tar-bz2: true |
| 69 | + |
| 70 | + - name: Install node.js (for pyright) |
| 71 | + uses: actions/setup-node@v2 |
| 72 | + with: |
| 73 | + node-version: "16" |
| 74 | + |
| 75 | + - name: Install pyright |
| 76 | + # note: keep version in sync with .pre-commit-config.yaml |
| 77 | + run: npm install -g [email protected] |
| 78 | + |
| 79 | + - name: Build Pandas |
| 80 | + id: build |
| 81 | + uses: ./.github/actions/build_pandas |
| 82 | + |
| 83 | + - name: Run checks on imported code |
| 84 | + run: ci/code_checks.sh code |
| 85 | + if: ${{ steps.build.outcome == 'success' }} |
| 86 | + |
| 87 | + - name: Run doctests |
| 88 | + run: ci/code_checks.sh doctests |
| 89 | + if: ${{ steps.build.outcome == 'success' }} |
| 90 | + |
| 91 | + - name: Run docstring validation |
| 92 | + run: ci/code_checks.sh docstrings |
| 93 | + if: ${{ steps.build.outcome == 'success' }} |
| 94 | + |
| 95 | + - name: Run typing validation |
| 96 | + run: ci/code_checks.sh typing |
| 97 | + if: ${{ steps.build.outcome == 'success' }} |
| 98 | + |
| 99 | + - name: Run docstring validation script tests |
| 100 | + run: pytest scripts |
| 101 | + if: ${{ steps.build.outcome == 'success' }} |
| 102 | + |
| 103 | + asv-benchmarks: |
| 104 | + name: ASV Benchmarks |
| 105 | + runs-on: ubuntu-latest |
| 106 | + defaults: |
| 107 | + run: |
| 108 | + shell: bash -l {0} |
| 109 | + |
| 110 | + concurrency: |
| 111 | + # https://github.community/t/concurrecy-not-work-for-push/183068/7 |
| 112 | + group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-asv-benchmarks |
| 113 | + cancel-in-progress: true |
| 114 | + |
| 115 | + steps: |
| 116 | + - name: Checkout |
| 117 | + uses: actions/checkout@v2 |
| 118 | + with: |
| 119 | + fetch-depth: 0 |
| 120 | + |
| 121 | + - name: Cache conda |
| 122 | + uses: actions/cache@v2 |
| 123 | + with: |
| 124 | + path: ~/conda_pkgs_dir |
| 125 | + key: ${{ runner.os }}-conda-${{ hashFiles('${{ env.ENV_FILE }}') }} |
| 126 | + |
| 127 | + - uses: conda-incubator/setup-miniconda@v2 |
| 128 | + with: |
| 129 | + mamba-version: "*" |
| 130 | + channels: conda-forge |
| 131 | + activate-environment: pandas-dev |
| 132 | + channel-priority: strict |
| 133 | + environment-file: ${{ env.ENV_FILE }} |
| 134 | + use-only-tar-bz2: true |
| 135 | + |
| 136 | + - name: Build Pandas |
| 137 | + id: build |
| 138 | + uses: ./.github/actions/build_pandas |
| 139 | + |
| 140 | + - name: Run ASV benchmarks |
| 141 | + run: | |
| 142 | + cd asv_bench |
| 143 | + asv check -E existing |
| 144 | + git remote add upstream https://github.com/pandas-dev/pandas.git |
| 145 | + git fetch upstream |
| 146 | + asv machine --yes |
| 147 | + asv dev | sed "/failed$/ s/^/##[error]/" | tee benchmarks.log |
| 148 | + if grep "failed" benchmarks.log > /dev/null ; then |
| 149 | + exit 1 |
| 150 | + fi |
| 151 | + if: ${{ steps.build.outcome == 'success' }} |
| 152 | + |
| 153 | + - name: Publish benchmarks artifact |
| 154 | + uses: actions/upload-artifact@master |
| 155 | + with: |
| 156 | + name: Benchmarks log |
| 157 | + path: asv_bench/benchmarks.log |
| 158 | + if: failure() |
0 commit comments