1
mirror of https://github.com/home-assistant/frontend synced 2024-09-22 18:30:59 +02:00
ha-frontend/.github/workflows/ci.yaml

118 lines
3.2 KiB
YAML
Raw Permalink Normal View History

2020-02-21 13:59:09 +01:00
name: CI
on:
push:
branches:
- dev
- master
pull_request:
branches:
- dev
- master
2020-02-21 13:59:09 +01:00
2021-07-07 16:33:24 +02:00
env:
NODE_OPTIONS: --max_old_space_size=6144
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2021-07-07 16:33:24 +02:00
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
2020-02-21 13:59:09 +01:00
jobs:
lint:
name: Lint and check format
2020-02-21 13:59:09 +01:00
runs-on: ubuntu-latest
steps:
- name: Check out files from GitHub
uses: actions/checkout@v4.1.1
2023-05-22 10:38:54 +02:00
- name: Setup Node
uses: actions/setup-node@v4.0.0
2020-02-21 13:59:09 +01:00
with:
2023-05-22 10:38:54 +02:00
node-version-file: ".nvmrc"
2021-07-07 16:33:24 +02:00
cache: yarn
2020-02-21 13:59:09 +01:00
- name: Install dependencies
run: yarn install --immutable
- name: Check for duplicate dependencies
run: yarn dedupe --check
2020-06-22 19:24:01 +02:00
- name: Build resources
run: ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data gather-gallery-pages
- name: Setup lint cache
uses: actions/cache@v3.3.2
with:
path: |
node_modules/.cache/prettier
node_modules/.cache/eslint
key: lint-${{ github.sha }}
restore-keys: lint-
2020-02-21 13:59:09 +01:00
- name: Run eslint
run: yarn run lint:eslint --quiet
2020-02-21 13:59:09 +01:00
- name: Run tsc
2021-04-30 21:15:31 +02:00
run: yarn run lint:types
- name: Run prettier
run: yarn run lint:prettier
2020-02-21 13:59:09 +01:00
test:
name: Run tests
2020-02-21 13:59:09 +01:00
runs-on: ubuntu-latest
steps:
- name: Check out files from GitHub
uses: actions/checkout@v4.1.1
2023-05-22 10:38:54 +02:00
- name: Setup Node
uses: actions/setup-node@v4.0.0
2020-02-21 13:59:09 +01:00
with:
2023-05-22 10:38:54 +02:00
node-version-file: ".nvmrc"
2021-07-07 16:33:24 +02:00
cache: yarn
2020-02-21 13:59:09 +01:00
- name: Install dependencies
run: yarn install --immutable
- name: Build resources
run: ./node_modules/.bin/gulp build-translations build-locale-data
- name: Run Tests
run: yarn run test
2020-02-21 13:59:09 +01:00
build:
name: Build frontend
2020-02-21 13:59:09 +01:00
needs: [lint, test]
runs-on: ubuntu-latest
2020-02-21 13:59:09 +01:00
steps:
- name: Check out files from GitHub
uses: actions/checkout@v4.1.1
2023-05-22 10:38:54 +02:00
- name: Setup Node
uses: actions/setup-node@v4.0.0
2020-02-21 13:59:09 +01:00
with:
2023-05-22 10:38:54 +02:00
node-version-file: ".nvmrc"
2021-07-07 16:33:24 +02:00
cache: yarn
2020-02-21 13:59:09 +01:00
- name: Install dependencies
run: yarn install --immutable
2020-02-21 13:59:09 +01:00
- name: Build Application
run: ./node_modules/.bin/gulp build-app
env:
IS_TEST: "true"
- name: Upload bundle stats
uses: actions/upload-artifact@v3.1.3
with:
name: frontend-bundle-stats
path: build/stats/*.json
if-no-files-found: error
2020-02-21 13:59:09 +01:00
supervisor:
name: Build supervisor
2020-02-21 13:59:09 +01:00
needs: [lint, test]
runs-on: ubuntu-latest
2020-02-21 13:59:09 +01:00
steps:
- name: Check out files from GitHub
uses: actions/checkout@v4.1.1
2023-05-22 10:38:54 +02:00
- name: Setup Node
uses: actions/setup-node@v4.0.0
2020-02-21 13:59:09 +01:00
with:
2023-05-22 10:38:54 +02:00
node-version-file: ".nvmrc"
2021-07-07 16:33:24 +02:00
cache: yarn
2020-02-21 13:59:09 +01:00
- name: Install dependencies
run: yarn install --immutable
2020-02-21 13:59:09 +01:00
- name: Build Application
run: ./node_modules/.bin/gulp build-hassio
env:
IS_TEST: "true"
- name: Upload bundle stats
uses: actions/upload-artifact@v3.1.3
with:
name: supervisor-bundle-stats
path: build/stats/*.json
if-no-files-found: error