From ce99509f07c93eeef4f3e1134bea61f36ac35a7a Mon Sep 17 00:00:00 2001 From: aasim Date: Fri, 19 Apr 2024 21:17:00 -0400 Subject: [PATCH] use Cypress binary from cache if found, else install cypress --- .github/workflows/main.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bc9d9e0..c16de43 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,11 +14,18 @@ jobs: include: - test-type: 'api' - test-type: 'e2e' - + steps: - name: Checkout code uses: actions/checkout@v2 + - name: Cache Cypress binary + uses: actions/cache@v2 + with: + path: ~/.cache/Cypress + key: cypress-${{ runner.os }}-binary-${{ hashFiles('**/package-lock.json') }} + restore-keys: cypress-${{ runner.os }}-binary- + - name: Set up Node.js uses: actions/setup-node@v2 with: @@ -27,6 +34,16 @@ jobs: - name: Install dependencies run: npm install + - name: Check Cypress binary + run: | + if [ ! -f $(npm bin)/cypress ]; then + echo "Cypress binary not found. Installing..." + npx cypress install + fi + + - name: Verify Cypress binary + run: npx cypress verify + - name: Run API tests if: ${{ matrix.test-type == 'api' }} run: npx cypress run --spec "cypress/integration/api/**/*"