This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
Merge branch 'master' into fix/DEV-1367/image-width #4277
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 and Test | |
on: | |
push: | |
branches: [master, "**"] | |
env: | |
# increment it in case if you need to reset cache | |
CACHE_NAME_PREFIX: v2 | |
NODE: '12' | |
jobs: | |
build: | |
# ci can be skipped with `[skip ci]` prefix in message | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
node-version: "${{ env.NODE }}" | |
- name: Upgrade Yarn | |
run: npm install -g [email protected] | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Configure yarn cache | |
uses: actions/[email protected] | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ env.CACHE_NAME_PREFIX }}-${{ runner.os }}-node-${{ env.NODE }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }} | |
- name: Print Yarn cache size | |
run: du -d 0 -h ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
- name: Install dependencies | |
run: rm package-lock.json && yarn install | |
- name: Unit tests | |
run: yarn test | |
- name: Build distribution package | |
timeout-minutes: 10 | |
run: yarn run build:module | |
env: | |
CI: false # on true webpack breaks on warnings, and we have them a lot | |
NODE_ENV: 'production' | |
# run http-server with build in background (will be killed after job ends) | |
# do this only for master branch (so only for push event) | |
# because pr can contain unfinished job | |
- run: npx serve -l tcp://localhost:3000 build & | |
if: github.event_name == 'push' | |
- id: wait_for_npx_server | |
timeout-minutes: 1 | |
run: | | |
while [ "$(curl -s -o /dev/null -L -w ''%{http_code}'' "http://localhost:3000/")" != "200" ]; do | |
echo "=> Waiting for service to become available" && sleep 2s | |
done | |
- run: yarn run test:e2e:headless | |
timeout-minutes: 15 | |
if: github.event_name == 'push' | |
- uses: actions/[email protected] | |
if: ${{ failure() }} | |
with: | |
name: e2e output | |
path: e2e/output/ | |
# upload this build as artifact to current Action | |
- uses: actions/[email protected] | |
with: | |
name: build ${{ github.event.pull_request.head.sha || github.sha }} | |
path: build/ |