diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 494425689e..c42a78c81b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,9 +22,58 @@ concurrency: cancel-in-progress: true jobs: - php: + init: runs-on: ubuntu-latest + strategy: + # do not stop on another job's failure + fail-fast: false + matrix: + node-version: [ 20.x ] + npm-version: [ 10.x ] + + steps: + - name: Checkout floccus + uses: actions/checkout@v2 + with: + path: floccus + + - name: Set up node ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Set up npm ${{ matrix.npm-version }} + run: npm i -g npm@"${{ matrix.npm-version }}" + + - name: Cache node modules + uses: actions/cache@v1 + env: + cache-name: cache-node-modules + with: + path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Install dependencies & build + working-directory: floccus + run: | + npm ci + npm run build-release --if-present + + - name: Save context + uses: buildjet/cache/save@v3 + with: + key: selenium-context-${{ github.run_id }} + path: ./ + + selenium: + runs-on: ubuntu-latest + needs: init + env: SELENIUM_HUB_HOST: hub TEST_HOST: nextcloud @@ -129,10 +178,13 @@ jobs: MYSQL_ROOT_PASSWORD: ${{env.MYSQL_PASSWORD}} steps: - - name: Checkout floccus - uses: actions/checkout@v2 + + - name: Restore context + uses: buildjet/cache/restore@v3 with: - path: floccus + fail-on-cache-miss: true + key: selenium-context-${{ github.run_id }} + path: ./ - name: Checkout bookmarks app uses: actions/checkout@v2 @@ -169,32 +221,6 @@ jobs: [ $NEXT_WAIT_TIME -lt 25 ] if: matrix.floccus-adapter != 'fake' - - name: Set up node ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: Set up npm ${{ matrix.npm-version }} - run: npm i -g npm@"${{ matrix.npm-version }}" - - - name: Cache node modules - uses: actions/cache@v1 - env: - cache-name: cache-node-modules - with: - path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Install dependencies & build - working-directory: floccus - run: | - npm ci - npm run build-release --if-present - - name: Wait for Selenium run: | sudo apt install -y jq @@ -216,3 +242,15 @@ jobs: APP_VERSION: ${{ matrix.app-version }} run: | npm run test + + summary: + runs-on: ubuntu-latest + needs: [ init, selenium ] + + if: always() + + name: selenium-summary + + steps: + - name: Summary status + run: if ${{ needs.init.result != 'success' || ( needs.selenium.result != 'success' && needs.selenium.result != 'skipped' ) }}; then exit 1; fi