From bc0b55fd9230bf0c8a091b78e5bba9e7b743081b Mon Sep 17 00:00:00 2001 From: rpkak <67059904+rpkak@users.noreply.github.com> Date: Mon, 19 Jul 2021 11:17:46 +0200 Subject: [PATCH] Daily workflow for dependency testing (#1470) * Make new workflow Descriped in https://github.com/rq/rq/pull/1465#issuecomment-842464560 * For testing * failing tests For testing * log file For testing * log For testing * no newlines For testing * no " For testing * no only one issue For testing * as job For testing * use artifacts For testing * use artifacts2 For testing * use artifacts3 For testing * use artifacts4 For testing * finish * name * only if "normal" workflow doesn't fail https://github.com/rq/rq/pull/1470#discussion_r641343532 --- .github/workflows/dependencies.yml | 109 +++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 .github/workflows/dependencies.yml diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml new file mode 100644 index 0000000..423207b --- /dev/null +++ b/.github/workflows/dependencies.yml @@ -0,0 +1,109 @@ +name: Dependencies + +on: + schedule: + # View https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule + - cron: '0 12 * * *' + workflow_dispatch: + +jobs: + build: + if: github.repository == 'rq/rq' + name: Python${{ matrix.python-version }}/Redis${{ matrix.redis-version }}/redis-py${{ matrix.redis-py-version }} + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.5, 3.6, 3.7, 3.8.3, 3.9] + redis-version: [3, 4, 5, 6] + redis-py-version: [3.5.0] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Start Redis + uses: supercharge/redis-github-action@1.1.0 + with: + redis-version: ${{ matrix.redis-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install redis==${{ matrix.redis-py-version }} + pip install -r requirements.txt -r dev-requirements.txt + pip install -e . + + - name: Test with pytest + run: | + RUN_SLOW_TESTS_TOO=1 pytest --durations=5 + + dependency-build: + name: Check development branches of dependencies + runs-on: ubuntu-latest + needs: build + if: success() + + strategy: + matrix: + python-version: [3.5, 3.6, 3.7, 3.8.3, 3.9] + redis-version: [3, 4, 5, 6] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Start Redis + uses: supercharge/redis-github-action@1.1.0 + with: + redis-version: ${{ matrix.redis-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install git+https://github.com/andymccurdy/redis-py + pip install git+https://github.com/pallets/click + pip install -r dev-requirements.txt + pip install -e . + + - name: Test with pytest + run: RUN_SLOW_TESTS_TOO=1 pytest --durations=5 > log.txt 2>&1 + + - uses: actions/upload-artifact@v2 + with: + name: dependencies-error + path: log.txt + if: failure() + + issue: + name: Create failure issue + runs-on: ubuntu-latest + + if: failure() + needs: dependency-build + + steps: + - uses: actions/download-artifact@v2 + with: + name: dependencies-error + path: . + + - name: Create failure issue + run: | + if [[ "$(curl --url https://api.github.com/repos/${{ github.repository }}/issues --request GET --data '{"creator": "github-actions"}')" != *"\""* ]] + then curl --request POST \ + --url https://api.github.com/repos/${{ github.repository }}/issues \ + --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + --header 'content-type: application/json' \ + --data "{ + \"title\": \"RQ maybe may not work with dependencies in the future\", + \"body\": \"This issue was automatically created by the GitHub Action workflow **${{ github.workflow }}**. \n\n View log: \n\n \`\`\` \n $(cat log.txt | while read line; do echo -n "$line\n"; done | sed -r 's/"/\\"/g') \n \`\`\`\" + }" + fi