nightly tests #159
This file contains hidden or 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: nightly tests | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| core: | |
| type: boolean | |
| description: "core" | |
| default: 'true' | |
| required: false | |
| servers: | |
| type: boolean | |
| description: "servers" | |
| default: 'true' | |
| required: false | |
| exports: | |
| type: boolean | |
| description: "exports" | |
| default: 'true' | |
| required: false | |
| api: | |
| type: boolean | |
| description: "api" | |
| default: 'true' | |
| required: false | |
| views: | |
| type: boolean | |
| description: "views" | |
| default: 'true' | |
| required: false | |
| schedule: | |
| - cron: '0 3 * * *' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| services: | |
| mongodb: | |
| image: mongo:8 | |
| ports: | |
| - 27017:27017 | |
| redis: | |
| image: redis:6-alpine | |
| ports: | |
| - 6379:6379 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install nodejs | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: ".nvmrc" | |
| check-latest: false | |
| - name: install nvm | |
| run: | | |
| curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash | |
| echo -n 'nvm "$@" && echo $NVM_BIN >> $GITHUB_PATH' >> ~/.nvm/nvm.sh | |
| sudo cp ~/.nvm/nvm.sh /usr/local/bin/nvm | |
| sudo chmod +x /usr/local/bin/nvm | |
| - name: setup repos | |
| run: | | |
| ./install_local.sh https | |
| - name: configure mochajs for github | |
| run: | | |
| echo '{"reporter": "mocha-ctrf-json-reporter"}' > ./.mocharc.json | |
| - name: core tests | |
| if: ${{ inputs.core == true || inputs.core == 'true' }} | |
| timeout-minutes: 5 | |
| continue-on-error: true | |
| run: | | |
| cd cables/ | |
| npm run test | |
| - name: checkout api | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: "undev-studio/cables_api" | |
| ref: develop | |
| token: ${{ secrets.undev_token }} | |
| path: "cables_api/" | |
| fetch-depth: 0 | |
| - name: checkout docs | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: "cables-gl/cables_docs" | |
| ref: develop | |
| token: ${{ secrets.undev_token }} | |
| path: "cables_docs/" | |
| fetch-depth: 0 | |
| - name: checkout asset library | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: "cables-gl/cables-asset-library" | |
| ref: master | |
| token: ${{ secrets.undev_token }} | |
| path: "cables_api/public/assets/library" | |
| fetch-depth: 0 | |
| - name: build api | |
| run: | | |
| cd cables_api/ | |
| npm install --no-save | |
| touch scss/svgicons.scss | |
| npm run build | |
| - name: Server dev/live Tests | |
| if: ${{ inputs.servers == true || inputs.servers == 'true' }} | |
| timeout-minutes: 5 | |
| continue-on-error: true | |
| run: | | |
| cd cables_api/ | |
| npm run test:servers | |
| env: | |
| CABLES_USER_APIKEY: ${{ secrets.cables_user_apikey }} | |
| - name: Store dev/live Tests Summary Results | |
| if: ${{ inputs.servers == true || inputs.servers == 'true' }} | |
| uses: ctrf-io/github-test-reporter@v1 | |
| with: | |
| report-path: './cables_api/ctrf/*.json' | |
| github-report: true | |
| summary-delta-report: true | |
| insights-report: true | |
| flaky-rate-report: true | |
| fail-rate-report: true | |
| slowest-report: true | |
| upload-artifact: true | |
| suite-folded-report: true | |
| artifact-name: "devlive-report" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish dev/live Tests Results on discord | |
| if: ${{ inputs.servers == true || inputs.servers == 'true' }} | |
| continue-on-error: true | |
| run: | | |
| cd cables_api/ | |
| node hooks/discord_testresults.js ctrf/ctrf-report.json | |
| env: | |
| CABLES_TEST_TITLE: "HTTP dev/live Tests" | |
| DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_TESTRESULTS_WEBHOOK }} | |
| - name: checkout electron for exe export | |
| if: ${{ inputs.exports == true || inputs.exports == 'true' }} | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: "cables-gl/cables-exe-export" | |
| ref: develop | |
| token: ${{ secrets.undev_token }} | |
| path: "electron" | |
| fetch-depth: 0 | |
| - name: create exe-export LFS file list | |
| if: ${{ inputs.exports == true || inputs.exports == 'true' }} | |
| run: | | |
| cd electron/ | |
| git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
| - name: restore exe-export LFS cache | |
| if: ${{ inputs.exports == true || inputs.exports == 'true' }} | |
| uses: actions/cache@v4 | |
| id: exe-export-lfs-cache | |
| with: | |
| path: electron/.git/lfs | |
| key: ${{ runner.os }}-lfs-${{ hashFiles('electron/.lfs-assets-id') }}-v1 | |
| - name: pull exe-export LFS files | |
| if: ${{ inputs.exports == true || inputs.exports == 'true' }} | |
| run: | | |
| cd electron/ | |
| git lfs pull | |
| - name: Export Tests | |
| if: ${{ inputs.exports == true || inputs.exports == 'true' }} | |
| timeout-minutes: 5 | |
| continue-on-error: true | |
| run: | | |
| cd cables_api/ | |
| npm run test:export | |
| - name: Store Export Tests Summary Results | |
| if: ${{ inputs.exports == true || inputs.exports == 'true' }} | |
| uses: ctrf-io/github-test-reporter@v1 | |
| with: | |
| report-path: './cables_api/ctrf/*.json' | |
| github-report: true | |
| summary-delta-report: true | |
| insights-report: true | |
| flaky-rate-report: true | |
| fail-rate-report: true | |
| slowest-report: true | |
| upload-artifact: true | |
| suite-folded-report: true | |
| artifact-name: "export-report" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish Export Tests Results on discord | |
| if: ${{ inputs.exports == true || inputs.exports == 'true' }} | |
| continue-on-error: true | |
| run: | | |
| cd cables_api/ | |
| node hooks/discord_testresults.js ctrf/ctrf-report.json | |
| env: | |
| CABLES_TEST_TITLE: "Export Tests" | |
| DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_TESTRESULTS_WEBHOOK }} | |
| - name: Install PM2 locally | |
| run: npm install pm2@6.0.13 -g | |
| - name: Run PM2 | |
| run: | | |
| npm run pm2:test & | |
| shell: bash | |
| - name: Wait for Express on port 5711 | |
| run: | | |
| echo "Waiting for tcp:5711..." | |
| time npx wait-on http://localhost:5711/login --timeout 30000 -v | |
| echo "Port 5711 is up!" | |
| echo "Waiting for tcp:5713..." | |
| time npx wait-on http://localhost:5713/api/ops/code --timeout 30000 -v | |
| echo "Port 5713 is up!" | |
| - name: Check what listens on 5711 | |
| run: | | |
| echo "Listening on 5711:" | |
| ss -tlnp | grep 5711 || netstat -tlnp | grep 5711 | |
| - name: Try HTTP hit | |
| run: | | |
| echo "curl GET http://127.0.0.1:5711/login" | |
| curl -v http://127.0.0.1:5711/login | |
| - name: API Tests | |
| if: ${{ inputs.api == true || inputs.api == 'true' }} | |
| timeout-minutes: 5 | |
| continue-on-error: true | |
| run: | | |
| cd cables_api/ | |
| npm run test:api | |
| pm2 logs --lines 20 | |
| pm2 flush | |
| - name: Store API Tests Summary Results | |
| if: ${{ inputs.api == true || inputs.api == 'true' }} | |
| uses: ctrf-io/github-test-reporter@v1 | |
| with: | |
| report-path: './cables_api/ctrf/*.json' | |
| github-report: true | |
| summary-delta-report: true | |
| insights-report: true | |
| flaky-rate-report: true | |
| fail-rate-report: true | |
| slowest-report: true | |
| upload-artifact: true | |
| suite-folded-report: true | |
| artifact-name: "api-report" | |
| - name: Publish API Tests Results on discord | |
| if: ${{ inputs.api == true || inputs.api == 'true' }} | |
| continue-on-error: true | |
| run: | | |
| cd cables_api/ | |
| node hooks/discord_testresults.js ctrf/ctrf-report.json | |
| env: | |
| CABLES_TEST_TITLE: "API Tests" | |
| DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_TESTRESULTS_WEBHOOK }} | |
| - name: Views Tests | |
| if: ${{ inputs.views == true || inputs.views == 'true' }} | |
| timeout-minutes: 5 | |
| continue-on-error: true | |
| run: | | |
| cd cables_api/ | |
| npm run test:views | |
| pm2 logs --lines 20 | |
| pm2 flush | |
| - name: Store Views Tests Summary Results | |
| if: ${{ inputs.views == true || inputs.views == 'true' }} | |
| uses: ctrf-io/github-test-reporter@v1 | |
| with: | |
| report-path: './cables_api/ctrf/*.json' | |
| github-report: true | |
| summary-delta-report: true | |
| insights-report: true | |
| flaky-rate-report: true | |
| fail-rate-report: true | |
| slowest-report: true | |
| upload-artifact: true | |
| suite-folded-report: true | |
| artifact-name: "views-report" | |
| - name: Publish Views Tests Results on discord | |
| if: ${{ inputs.views == true || inputs.views == 'true' }} | |
| continue-on-error: true | |
| run: | | |
| cd cables_api/ | |
| node hooks/discord_testresults.js ctrf/ctrf-report.json | |
| env: | |
| CABLES_TEST_TITLE: "Views Tests" | |
| DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_TESTRESULTS_WEBHOOK }} | |
| - name: Upload PM2 logs on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pm2-logs | |
| path: | | |
| ~/.pm2/logs/*.log | |
| if-no-files-found: warn |