From: Federico Caselli Date: Fri, 3 Apr 2020 18:11:24 +0000 (-0400) Subject: Add github action workflow to run tests on master and on pr to master X-Git-Tag: rel_1_4_0b1~413^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c658540b9ae36e86a92e11667d3679ac1f3eac2e;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Add github action workflow to run tests on master and on pr to master Trying the pr to check if it works right away ### Description ### Checklist This pull request is: - [ ] A documentation / typographical error fix - Good to go, no issue or tests are needed - [x] A short code fix - please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted. - Please include: `Fixes: #` in the commit message - please include tests. one line code fixes without tests will not be accepted. - [ ] A new feature implementation - please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look. - Please include: `Fixes: #` in the commit message - please include tests. **Have a nice day!** Closes: #5222 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5222 Pull-request-sha: afbb8567525f3841554d3ba599ef4d713c78e647 Change-Id: I4981b02f900e76e446cf42e6cc6495ffc0883951 --- diff --git a/.github/workflows/run-on-pr.yaml b/.github/workflows/run-on-pr.yaml new file mode 100644 index 0000000000..3569105c3e --- /dev/null +++ b/.github/workflows/run-on-pr.yaml @@ -0,0 +1,51 @@ +name: Run tests on a pr + +on: + # run on pull request to master excluding changes that are only on doc or example folders + pull_request: + branches: + - master + paths-ignore: + - "doc/**" + - "examples/**" + +env: + # global env to all steps + TOX_WORKERS: -n2 + +jobs: + run-test: + name: ${{ matrix.python-version }}-${{ matrix.build-type }}-${{ matrix.architecture }}-${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + # run this job using this matrix, excluding some combinations below. + matrix: + os: + - "ubuntu-latest" + python-version: + - "3.8" + build-type: + - "nocext" + architecture: + - x64 + # abort all jobs as soon as one fails + fail-fast: true + + # steps to run in each job. Some are github actions, others run shell commands + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Set up python + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + + - name: Run tests + run: tox -e github-${{ matrix.build-type }} -- -q --nomemory ${{ matrix.pytest-args }} diff --git a/.github/workflows/run-test.yaml b/.github/workflows/run-test.yaml new file mode 100644 index 0000000000..8169571fe8 --- /dev/null +++ b/.github/workflows/run-test.yaml @@ -0,0 +1,82 @@ +name: Run tests + +on: + # run on push in master or rel_* branches excluding changes are only on doc or example folders + push: + branches: + - master + - "rel_*" + # branches used to test the workflow + - "workflow_test_*" + paths-ignore: + - "doc/**" + - "examples/**" + +env: + # global env to all steps + TOX_WORKERS: -n2 + +jobs: + run-test: + name: ${{ matrix.python-version }}-${{ matrix.build-type }}-${{ matrix.architecture }}-${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + # run this job using this matrix, excluding some combinations below. + matrix: + os: + - "ubuntu-latest" + - "windows-latest" + - "macos-latest" + python-version: + - "2.7" + - "3.5" + - "3.6" + - "3.7" + - "3.8" + build-type: + - "cext" + - "nocext" + architecture: + - x64 + - x86 + + include: + # the mock reconnect test seems to fail on the ci in windows + - os: "windows-latest" + pytest-args: "-k 'not MockReconnectTest'" + + exclude: + # c-extensions fail to build on windows for python 3.5 and 2.7 + - os: "windows-latest" + python-version: "2.7" + build-type: "cext" + - os: "windows-latest" + python-version: "3.5" + build-type: "cext" + # linux and osx do not have x86 python + - os: "ubuntu-latest" + architecture: x86 + - os: "macos-latest" + architecture: x86 + + # abort all jobs as soon as one fails + fail-fast: true + + # steps to run in each job. Some are github actions, others run shell commands + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Set up python + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + + - name: Run tests + run: tox -e github-${{ matrix.build-type }} -- -q --nomemory ${{ matrix.pytest-args }} diff --git a/tox.ini b/tox.ini index 9950aceb49..e459d5c11e 100644 --- a/tox.ini +++ b/tox.ini @@ -100,3 +100,15 @@ deps= commands = flake8 ./lib/ ./test/ ./examples/ setup.py doc/build/conf.py black --check . + +# command run in the github action when cext are active. +[testenv:github-cext] +commands= + python -m pytest {env:WORKERS} {env:SQLITE:} {env:POSTGRESQL:} {env:MYSQL:} {env:ORACLE:} {env:MSSQL:} {env:BACKENDONLY:} {env:IDENTS:} {env:NOMEMORY:} {env:COVERAGE:} {posargs} + oracle,mssql,sqlite_file: python reap_dbs.py db_idents.txt + +# command run in the github action when cext are not active. +[testenv:github-nocext] +commands= + python -m pytest {env:WORKERS} {env:SQLITE:} {env:POSTGRESQL:} {env:MYSQL:} {env:ORACLE:} {env:MSSQL:} {env:BACKENDONLY:} {env:IDENTS:} {env:NOMEMORY:} {env:COVERAGE:} {posargs} + oracle,mssql,sqlite_file: python reap_dbs.py db_idents.txt \ No newline at end of file