Execute nightly tests #515
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: Execute nightly tests | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 3 * * 1-5' | |
repository_dispatch: | |
types: [automation-tests-event] | |
jobs: | |
run-functional-tests: | |
if: ${{ github.event_name != 'repository_dispatch' }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2.2.4 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Prepare saleor CLI | |
run: pnpm build | |
- name: Write config file | |
id: write-config-file | |
env: | |
CLI_ACCESS_TOKEN: ${{ secrets.CLI_ACCESS_TOKEN }} | |
CLI_GITHUB_TOKEN: ${{ secrets.CLI_GITHUB_TOKEN }} | |
CLI_VERCEL_TOKEN: ${{ secrets.CLI_VERCEL_TOKEN }} | |
TEST_COMMAND: 'node dist/saleor.js' | |
run: echo '{"token":"${{ secrets.CLI_ACCESS_TOKEN }}","telemetry":"false","saleor_env":"staging","cloud_api_url":"https://staging-cloud.saleor.io/platform/api", "github_token":"${{ secrets.CLI_GITHUB_TOKEN }}", "vercel_token":"${{ secrets.CLI_VERCEL_TOKEN }}" }' > ~/.config/saleor.json | |
- name: pre run | |
env: | |
SALEOR_CLI_ENV: staging | |
RUN_FUNCTIONAL_TESTS: true | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: | | |
node dist/saleor.js info | |
node dist/saleor.js status | |
- name: clear cloud projects | |
env: | |
SALEOR_CLI_ENV: staging | |
RUN_FUNCTIONAL_TESTS: true | |
run: | | |
pnpm vitest run test/clear_cloud.test.ts | |
- name: run tests | |
env: | |
RUN_FUNCTIONAL_TESTS: true | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: | | |
git config --global user.name 'GA-saleor-cli' | |
git config --global user.email 'GA-saleor-cli@users.noreply.github.com' | |
pnpm vitest test/functional -t '^((?!(deploy|tunnel)).)*$' --no-threads | |
- name: Notify Slack | |
if: ${{ failure() }} | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_SNAP_RESTORE }} | |
SLACK_USERNAME: FunctionalTestsBot | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_TITLE: "Functional tests failed" | |
SLACK_MESSAGE: "https://github.com/saleor/saleor-cli/actions/workflows/tests-nightly.yml" | |
MSG_MINIMAL: true |