Update GH action #328
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: Build | |
on: [push] | |
jobs: | |
build: | |
name: Build and test lab.js library and builder | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Setup yarn cache | |
uses: actions/cache@v2 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn && yarn bootstrap | |
- name: Build library | |
run: (cd packages/library && yarn build:starterkit) | |
- name: Run library unit tests | |
run: (cd packages/library && yarn test) | |
- name: Run library core tests | |
run: (cd packages/library && yarn test:base) | |
- name: Connect to saucelabs for automated browser testing | |
if: ${{ github.event_name == 'push' }} | |
uses: saucelabs/sauce-connect-action@v1 | |
with: | |
username: ${{ secrets.SAUCE_USERNAME }} | |
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }} | |
tunnelIdentifier: github-action-tunnel-${{ github.run_id }} | |
scVersion: 4.6.2 | |
- name: Run library cross-browser tests | |
run: (cd packages/library && yarn test:sauce) || (cd packages/library && yarn test:sauce) || (cd packages/library && yarn test:sauce) | |
if: ${{ github.event_name == 'push' }} | |
env: | |
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} | |
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} | |
TUNNEL_IDENTIFIER: github-action-tunnel-${{ github.run_id }} | |
- name: Upload library starterkit as build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: labjs-starterkit | |
path: packages/library/dist/labjs-starterkit.zip | |
- name: Bundle builder | |
run: (cd packages/builder && yarn build) | |
- name: Test builder | |
run: (cd packages/builder && yarn test) | |
- name: Deploy builder beta | |
run: (cd packages/builder && yarn deploy) | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
env: | |
NETLIFY_ACCESS_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
PUBLIC_URL: https://labjs-beta.netlify.app |