]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add github action workflow to run tests on master and on pr to master
authorFederico Caselli <cfederico87@gmail.com>
Fri, 3 Apr 2020 18:11:24 +0000 (14:11 -0400)
committersqla-tester <sqla-tester@sqlalchemy.org>
Fri, 3 Apr 2020 18:11:24 +0000 (14:11 -0400)
Trying the pr to check if it works right away

### Description
<!-- Describe your changes in detail -->

### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

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: #<issue number>` 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: #<issue number>` 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

.github/workflows/run-on-pr.yaml [new file with mode: 0644]
.github/workflows/run-test.yaml [new file with mode: 0644]
tox.ini

diff --git a/.github/workflows/run-on-pr.yaml b/.github/workflows/run-on-pr.yaml
new file mode 100644 (file)
index 0000000..3569105
--- /dev/null
@@ -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 (file)
index 0000000..8169571
--- /dev/null
@@ -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 9950aceb4992a4ee9e391f737201ea033a92bd78..e459d5c11e3a27e4a7fa732cf3a5955c8a072b0b 100644 (file)
--- 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