summaryrefslogtreecommitdiffhomepage
path: root/.github/workflows/frontend.yml
blob: 6862e2922cc0727ae5bd7f32d7d40f939e2f8358 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Electron frontend CI
on:
    # Build whenever a file that affects the frontend is changed by a push
    push:
        paths:
            - .github/workflows/frontend.yml
            - gui/**
            - mullvad-management-interface/proto/**
    # Build if requested manually from the Actions tab
    workflow_dispatch:
jobs:
    check-frontend:
        strategy:
            matrix:
                os: [ubuntu-latest, windows-latest]

        runs-on: ${{ matrix.os }}
        steps:
            # Prevent conversion of line-breaks on Windows
            - run: git config --global core.autocrlf input

            - name: Checkout repository
              uses: actions/checkout@v2

            - name: Setup Node.js environment
              uses: actions/setup-node@v2.1.5
              with:
                  node-version: '12'

            - name: Update NPM
              run: npm i -g npm

            - name: Install and cache dependencies
              uses: bahmutov/npm-install@v1
              with:
                  working-directory: gui
                  install-command: npm ci

            - name: Check formatting
              working-directory: gui
              run: npm run lint

            - name: Build
              working-directory: gui
              run: npm run build

            - name: Run headless test
              uses: GabrielBB/xvfb-action@v1
              with:
                  working-directory: gui
                  run: npm test