From 6ccb8c6a7ecec44186931b3a7ec12bea303aa07f Mon Sep 17 00:00:00 2001 From: burak-upstash Date: Sun, 3 Dec 2023 14:51:18 +0300 Subject: [PATCH] migrate tests and dependabot --- .github/dependabot.yaml | 37 ++++ .github/workflows/compatibility-checks.yaml | 224 ++++++++++++++++++++ 2 files changed, 261 insertions(+) create mode 100644 .github/dependabot.yaml create mode 100644 .github/workflows/compatibility-checks.yaml diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..e78a6d8 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,37 @@ +version: 2 +updates: + + # Python packages + - package-ecosystem: "pip" + directory: "/examples/using-huey" + schedule: + interval: "daily" + + - package-ecosystem: "pip" + directory: "/examples/using-apscheduler" + schedule: + interval: "daily" + + - package-ecosystem: "pip" + directory: "/examples/using-celery" + schedule: + interval: "daily" + + + # Ruby packages + - package-ecosystem: "bundler" + directory: "/examples/using-sidekiq" + schedule: + interval: "daily" + + - package-ecosystem: "bundler" + directory: "/examples/using-resque" + schedule: + interval: "daily" + + + # Rust packages + - package-ecosystem: "cargo" + directory: "/examples/using_redis-rs" + schedule: + interval: "daily" \ No newline at end of file diff --git a/.github/workflows/compatibility-checks.yaml b/.github/workflows/compatibility-checks.yaml new file mode 100644 index 0000000..14583d9 --- /dev/null +++ b/.github/workflows/compatibility-checks.yaml @@ -0,0 +1,224 @@ +name: Compatibility Tests +on: + pull_request: + push: + branches: + - 'compatible-libraries' + + schedule: + - cron: "0 12 * * *" + # run everyday at 12.00 + +jobs: + + sidekiq: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./examples/using-sidekiq + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Ruby and dependencies + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.1' + - name: Install dependencies + run: | + gem install bundler + bundle install + shell: bash + - name: run + continue-on-error: true + run: | + timeout 50s bundle exec sidekiq -r ./sendEmail.rb 2>&1 | tee sampleLogs2.log | bash client.sh + env: + UPSTASH_REDIS_HOST: ${{ secrets.UPSTASH_REDIS_HOST }} + UPSTASH_REDIS_PASSWORD: ${{ secrets.UPSTASH_REDIS_PASSWORD }} + UPSTASH_REDIS_PORT: ${{ secrets.UPSTASH_REDIS_PORT }} + - name: Compare outputs + if: always() + id: 'compare' + run: | + sed -i '/^\(Emailed to:\)/!d' sampleLogs2.log + diff <(sort sampleLogs.log) <(sort sampleLogs2.log) + - name: Run script for Sidekiq + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + if: always() && steps.compare.outcome != 'success' + run: | + curl -X POST -H 'Content-type: application/json' --data '{"text":"SIDEKIQ-COMPATIBILITY: Some tests have failed. Check the action: '$GITHUB_SERVER_URL'/'$GITHUB_REPOSITORY'/actions/runs/'$GITHUB_RUN_ID'"}' "$SLACK_WEBHOOK" + shell: bash + + + celery: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./examples/using-celery + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python and dependencies + uses: actions/setup-python@v4 + with: + python-version: '3.8' + - name: Install dependencies with latest versions + run: pip install -r requirements.txt -U + - name: Run servers and test + id: 'testing' + run: | + flask --app server run > /dev/null 2>&1 & + celery -A tasks worker --loglevel=INFO > /dev/null 2>&1 & + timeout 45s python3 test.py + shell: bash + env: + UPSTASH_REDIS_HOST: ${{ secrets.UPSTASH_REDIS_HOST }} + UPSTASH_REDIS_PASSWORD: ${{ secrets.UPSTASH_REDIS_PASSWORD }} + UPSTASH_REDIS_PORT: ${{ secrets.UPSTASH_REDIS_PORT }} + - name: Run script + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + if: always() && steps.testing.outcome != 'success' + run: | + curl -X POST -H 'Content-type: application/json' --data '{"text":"CELERY-COMPATIBILITY: Some tests have failed. Check the action: '$GITHUB_SERVER_URL'/'$GITHUB_REPOSITORY'/actions/runs/'$GITHUB_RUN_ID'"}' "$SLACK_WEBHOOK" + shell: bash + + huey: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./examples/using-huey + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python and dependencies + uses: actions/setup-python@v4 + with: + python-version: '3.8' + - name: Install dependencies with latest versions + run: pip install -r requirements.txt -U + - name: Run Huey Worker + run: | + huey_consumer.py tasks.huey > /dev/null 2>&1 & + shell: bash + env: + UPSTASH_REDIS_HOST: ${{ secrets.UPSTASH_REDIS_HOST }} + UPSTASH_REDIS_PASSWORD: ${{ secrets.UPSTASH_REDIS_PASSWORD }} + UPSTASH_REDIS_PORT: ${{ secrets.UPSTASH_REDIS_PORT }} + - name: Run Python script + id: 'testing' + run: | + python3 test.py + shell: bash + env: + UPSTASH_REDIS_HOST: ${{ secrets.UPSTASH_REDIS_HOST }} + UPSTASH_REDIS_PASSWORD: ${{ secrets.UPSTASH_REDIS_PASSWORD }} + UPSTASH_REDIS_PORT: ${{ secrets.UPSTASH_REDIS_PORT }} + + - name: Run script + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + if: always() && steps.testing.outcome != 'success' + run: | + curl -X POST -H 'Content-type: application/json' --data '{"text":"HUEY-COMPATIBILITY: Some tests have failed. Check the action: '$GITHUB_SERVER_URL'/'$GITHUB_REPOSITORY'/actions/runs/'$GITHUB_RUN_ID'"}' "$SLACK_WEBHOOK" + shell: bash + + apscheduler: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./examples/using-apscheduler + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python and dependencies + uses: actions/setup-python@v4 + with: + python-version: '3.8' + - name: Install dependencies with latest versions + run: pip install -r requirements.txt -U + - name: Run compatibility test + id: "testing" + run: | + python3 test.py + env: + UPSTASH_REDIS_HOST: ${{ secrets.UPSTASH_REDIS_HOST }} + UPSTASH_REDIS_PASSWORD: ${{ secrets.UPSTASH_REDIS_PASSWORD }} + UPSTASH_REDIS_PORT: ${{ secrets.UPSTASH_REDIS_PORT }} + - name: Run script + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + if: always() && steps.testing.outcome != 'success' + run: | + curl -X POST -H 'Content-type: application/json' --data '{"text":"APSCHEDULER-COMPATIBILITY: Some tests have failed. Check the action: '$GITHUB_SERVER_URL'/'$GITHUB_REPOSITORY'/actions/runs/'$GITHUB_RUN_ID'"}' "$SLACK_WEBHOOK" + shell: bash + + resque: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./examples/using-resque + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Ruby and dependencies + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.1' + - name: Install dependencies + run: | + gem install bundler + bundle install + shell: bash + - name: Populate Queues + continue-on-error: true + run: | + timeout 20s rake resque:work QUEUE=enterprise,free INTERVAL=0.5 2>&1 | tee sampleLogs2.log | ruby populate.rb + env: + UPSTASH_REDIS_HOST: ${{ secrets.UPSTASH_REDIS_HOST }} + UPSTASH_REDIS_PASSWORD: ${{ secrets.UPSTASH_REDIS_PASSWORD }} + UPSTASH_REDIS_PORT: ${{ secrets.UPSTASH_REDIS_PORT }} + - name: Start Workers + id: 'compare' + run: | + sed -i '/^\(Enterprise process\|Free process\)/!d' sampleLogs2.log + diff sampleLogs.log sampleLogs2.log + env: + UPSTASH_REDIS_HOST: ${{ secrets.UPSTASH_REDIS_HOST }} + UPSTASH_REDIS_PASSWORD: ${{ secrets.UPSTASH_REDIS_PASSWORD }} + UPSTASH_REDIS_PORT: ${{ secrets.UPSTASH_REDIS_PORT }} + - name: Run script for Resque + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + if: always() && steps.compare.outcome != 'success' + run: | + curl -X POST -H 'Content-type: application/json' --data '{"text":"RESQUE-COMPATIBILITY: Some tests have failed. Check the action: '$GITHUB_SERVER_URL'/'$GITHUB_REPOSITORY'/actions/runs/'$GITHUB_RUN_ID'"}' "$SLACK_WEBHOOK" + shell: bash + + + redis-rs: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./examples/using_redis-rs + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Cargo run + id: 'testing' + run: | + cargo run + env: + UPSTASH_REDIS_HOST: ${{ secrets.UPSTASH_REDIS_HOST }} + UPSTASH_REDIS_PASSWORD: ${{ secrets.UPSTASH_REDIS_PASSWORD }} + UPSTASH_REDIS_PORT: ${{ secrets.UPSTASH_REDIS_PORT }} + - name: Run script + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + if: always() && steps.testing.outcome != 'success' + run: | + curl -X POST -H 'Content-type: application/json' --data '{"text":"RUST-REDIS-COMPATIBILITY: Some tests have failed. Check the action: '$GITHUB_SERVER_URL'/'$GITHUB_REPOSITORY'/actions/runs/'$GITHUB_RUN_ID'"}' "$SLACK_WEBHOOK" + shell: bash + +