NoneBot Store Test #2985
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "NoneBot Store Test" | |
on: | |
workflow_dispatch: | |
inputs: | |
offset: | |
description: "Offset" | |
required: false | |
default: "0" | |
limit: | |
description: "Limit" | |
required: false | |
default: "1" | |
args: | |
description: "Args" | |
required: false | |
default: "" | |
schedule: | |
- cron: "0 */4 * * *" | |
repository_dispatch: | |
types: [registry_update] | |
concurrency: | |
group: "store-test" | |
cancel-in-progress: false | |
jobs: | |
store_test: | |
runs-on: ubuntu-latest | |
name: NoneBot2 plugin test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: nonebot/noneflow | |
fetch-depth: 0 | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Prepare test | |
run: | | |
git checkout `git describe --abbrev=0 --tags` | |
poetry config virtualenvs.prefer-active-python true | |
poetry install | |
- name: Test plugin | |
if: ${{ !contains(fromJSON('["Bot", "Adapter", "Plugin"]'), github.event.client_payload.type) }} | |
run: | | |
poetry run python -m src.utils.store_test --offset ${{ github.event.inputs.offset || 0 }} --limit ${{ github.event.inputs.limit || 50 }} ${{ github.event.inputs.args }} | |
- name: Update registry(Plugin) | |
if: github.event.client_payload.type == 'Plugin' | |
run: poetry run python -m src.utils.store_test -k '${{ github.event.client_payload.key }}' -f | |
env: | |
PLUGIN_CONFIG: ${{ github.event.client_payload.config }} | |
PLUGIN_DATA: ${{ github.event.client_payload.data }} | |
- name: Update registry(Bot, Apdater) | |
if: ${{ contains(fromJSON('["Bot", "Adapter"]'), github.event.client_payload.type) }} | |
run: poetry run python -m src.utils.store_test -l 0 | |
- name: Upload results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: results | |
path: | | |
${{ github.workspace }}/plugin_test/results.json | |
${{ github.workspace }}/plugin_test/adapters.json | |
${{ github.workspace }}/plugin_test/bots.json | |
${{ github.workspace }}/plugin_test/drivers.json | |
${{ github.workspace }}/plugin_test/plugins.json | |
upload_results: | |
runs-on: ubuntu-latest | |
name: Upload results | |
needs: store_test | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: results | |
- name: Download results | |
uses: actions/download-artifact@v4 | |
with: | |
name: results | |
path: ${{ github.workspace }} | |
- name: Push results | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email github-actions[bot]@users.noreply.github.com | |
git add . | |
git diff-index --quiet HEAD || git commit -m "chore: update test results" | |
git push | |
upload_results_netlify: | |
runs-on: ubuntu-latest | |
name: Upload results to netlify | |
needs: store_test | |
permissions: | |
contents: read | |
deployments: write | |
statuses: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Setup Node Environment | |
uses: ./.github/actions/setup-node | |
- name: Download results | |
uses: actions/download-artifact@v4 | |
with: | |
name: results | |
path: ${{ github.workspace }}/public | |
- name: Build Website | |
run: pnpm build | |
env: | |
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
- name: Get Branch Name | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV | |
- name: Deploy to Netlify | |
uses: nwtgck/actions-netlify@v3 | |
with: | |
publish-dir: "./dist" | |
production-deploy: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-message: "Deploy ${{ env.BRANCH_NAME }}@${{ github.sha }}" | |
enable-commit-comment: false | |
alias: ${{ env.BRANCH_NAME }} | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |