Skip to content

Create bl

Create bl #280

Workflow file for this run

name: pipeline
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
run: yarn --immutable
- name: Lint
run: yarn lint:all
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
run: yarn --immutable --mode=skip-build
- name: Format
run: yarn fmt:check
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
run: yarn --immutable
- name: Test
run: yarn test --coverage
env:
CI: true
- name: Publish Coverage
uses: codecov/codecov-action@v2
test-types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
run: yarn --immutable
- name: Test types
run: yarn test:types
env:
CI: true
storybook:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
run: yarn --immutable
- name: Build
run: yarn build:storybook
- name: Store storybook
uses: actions/upload-artifact@v2
with:
name: storybook-static
retention-days: 1
if-no-files-found: error
path: storybook-static
compile:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 3
matrix:
os: [macos-latest, ubuntu-20.04, windows-latest]
steps:
- uses: actions/checkout@v1
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
run: yarn --immutable
- name: Install build deps (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update && sudo apt-get install -y libudev-dev
- name: Build
run: yarn compile:production
env:
GITHUB_PR_BUILDS_KEY: ${{ secrets.PR_BUILDS_TOKEN }}
- name: Store compiled source
uses: actions/upload-artifact@v2
with:
name: compiled-${{ matrix.os }}
retention-days: 1
if-no-files-found: error
path: build
build-and-test-app:
runs-on: ${{ matrix.os }}
env:
DISPLAY: :0
strategy:
fail-fast: false
max-parallel: 3
matrix:
os: [macos-latest, ubuntu-20.04, windows-latest]
needs: compile
steps:
- uses: actions/checkout@v1
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
run: yarn --immutable
- name: Fetch compiled source
uses: actions/download-artifact@v2
with:
name: compiled-${{ matrix.os }}
path: build
- name: Build
run: yarn run pack
- name: Upload build
uses: actions/upload-artifact@v2
with:
name: app-builds
retention-days: 15
if-no-files-found: error
path: |
dist/*.snap
dist/*.AppImage
dist/*.msi
dist/*.dmg
dist/latest-mac.yml
dist/latest-linux.yml
- run: yarn playwright install --with-deps chromium chromium
- name: Setup xvfb (Linux)
if: runner.os == 'Linux'
run: |
# start xvfb in the background
sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 &
- name: Run tests
run: yarn e2e:app
env:
CI: "true"
PWTEST_VIDEO: "true"
HEADFUL: "true"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload test results
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: electron-${{ matrix.os }}-test-results
path: playwright-report
- name: Upload video recordings
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: electron-${{ matrix.os }}-recordings
path: e2e-recordings
# - name: Setup xvfb (Linux)
# if: runner.os == 'Linux'
# run: |
# sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0
# # start xvfb in the background
# sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 &
# - name: E2E
# run: yarn e2e:production
# - name: Upload failure artifacts
# if: ${{ failure() }}
# uses: actions/upload-artifact@v2-preview
# with:
# name: diff
# path: |
# packages/configurator/e2e/output/*.png
# packages/configurator/e2e/output/*.webm
# packages/configurator/e2e/output/trace/*.zip
# - name: Preview demo
e2e-web:
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: yarn --immutable --mode=skip-build
- name: Install browsers
run: yarn playwright install --with-deps
- name: Fetch compiled source
uses: actions/download-artifact@v2
with:
name: compiled-ubuntu-20.04
path: build
- name: Run tests
run: yarn e2e:web
env:
CI: "true"
PWTEST_VIDEO: "true"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v1
if: ${{ failure() }}
with:
name: video-web-linux-test-results
path: playwright-report
preview-web:
needs: [compile, storybook]
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Fetch compiled source
uses: actions/download-artifact@v2
with:
name: compiled-ubuntu-20.04
path: build
- name: Fetch storybook build
uses: actions/download-artifact@v2
with:
name: storybook-static
path: build/renderer/storybook
- name: Preview
id: cloudflare-preview
uses: cloudflare/pages-action@1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: buddy
directory: build/renderer
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref || github.ref_name }}
- name: Comment preview URL
uses: thollander/actions-comment-pull-request@v2
with:
message: |
EdgeTX Buddy has been automatically deployed to Cloudflare.
✅ Preview: ${{ steps.cloudflare-preview.outputs.url }}
✅ Storybook: ${{ steps.cloudflare-preview.outputs.url }}/storybook
release-web-prod:
needs: [e2e-web, test, storybook]
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- name: Fetch compiled source
uses: actions/download-artifact@v2
with:
name: compiled-ubuntu-20.04
path: build
- name: Publish
uses: cloudflare/pages-action@1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: buddy
directory: build/renderer
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
release-app:
needs: [build-and-test-app, test]
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- name: Fetch binaries
uses: actions/download-artifact@v2
with:
name: app-builds
path: app-builds
- name: Release latest build
if: startsWith(github.ref, 'refs/tags/v') != true
uses: marvinpinto/action-automatic-releases@4edd7a5aabb1bc62e6dc99b3302d587bf3134e20
with:
title: "Latest Build"
repo_token: "${{ secrets.GITHUB_TOKEN }}"
files: app-builds/*
automatic_release_tag: "latest"
prerelease: true
- name: Release tagged build
if: startsWith(github.ref, 'refs/tags/v')
uses: marvinpinto/action-automatic-releases@4edd7a5aabb1bc62e6dc99b3302d587bf3134e20
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
files: app-builds/*
prerelease: false