From 5ba73d1706fbc431b7387c0162286b22ad892d67 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Mon, 26 Feb 2024 01:06:25 +0200 Subject: [PATCH] ci: Update yaml-playground build & BrowserStack tests (#524) --- .github/workflows/browsers.yml | 30 ++++++++++++-------- .github/workflows/update-playground.yml | 37 +++++++++++++++++++++++++ playground | 2 +- 3 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/update-playground.yml diff --git a/.github/workflows/browsers.yml b/.github/workflows/browsers.yml index 89cf3917..e72a7efe 100644 --- a/.github/workflows/browsers.yml +++ b/.github/workflows/browsers.yml @@ -13,23 +13,31 @@ jobs: with: { submodules: true } - uses: actions/setup-node@v4 with: { node-version: 20 } - - name: Cache BrowserStackLocal - uses: actions/cache@v4 + - uses: browserstack/github-actions/setup-env@master with: - path: ~/.browserstack - key: bsl-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - bsl-${{ runner.os }}- + username: ${{ secrets.BROWSERSTACK_USERNAME }} + access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} + project-name: yaml + - uses: browserstack/github-actions/setup-local@master + with: + local-testing: start + local-identifier: random - run: npm ci - run: npm run build:browser - name: Playground setup working-directory: ./playground run: npm ci + - name: Playground build + working-directory: ./playground + run: npm run build + - run: npx http-server site & + working-directory: ./playground - - name: Run tests on BrowserStack + - run: npx browserstack-node-sdk jest working-directory: ./playground - run: npm test - env: - BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} - BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} + + - uses: browserstack/github-actions/setup-local@master + if: always() + with: + local-testing: stop diff --git a/.github/workflows/update-playground.yml b/.github/workflows/update-playground.yml new file mode 100644 index 00000000..6c4984e1 --- /dev/null +++ b/.github/workflows/update-playground.yml @@ -0,0 +1,37 @@ +name: Update playground + +on: + - workflow_dispatch + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: { submodules: true } + - uses: actions/setup-node@v4 + with: { node-version: 20 } + - run: npm ci + - run: npm run build:browser + - name: Playground setup + working-directory: ./playground + run: npm ci + - name: Playground build + working-directory: ./playground + run: npm run build + + - uses: actions/checkout@v4 + with: + repository: eemeli/yaml-playground + ref: gh-pages + path: ./gh-pages + - run: rm gh-pages/* + - run: cp playground/site/* gh-pages/ + + - name: git config + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + - run: git add . && git commit -m 'Update playground' && git push + working-directory: ./gh-pages diff --git a/playground b/playground index 26c1d2df..be656fe4 160000 --- a/playground +++ b/playground @@ -1 +1 @@ -Subproject commit 26c1d2df98d59bce6adc9c80a8b588146ca2603e +Subproject commit be656fe4890c30ddd13a8074790de1d9d643ac4b