Files
web/.github/workflows/ci.yml
XhmikosR 973a90d32a Switch to GitHub Actions CI (#587)
* Switch to GitHub Actions CI

* node-fetch is needed in jest-resolve

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
2020-03-04 09:28:55 -08:00

96 lines
2.4 KiB
YAML

name: CI
on: [push, pull_request]
env:
CI: true
NODE: 12.x
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set Node.js version
uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE }}"
- run: node --version
- run: npm --version
- name: Set up npm cache
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-v${{ env.NODE }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-v${{ env.NODE }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
${{ runner.OS }}-node-v${{ env.NODE }}-
- name: Install npm dependencies
run: npm ci
- name: Check Formatting
run: npm run check-format
- name: Test
run: npm run coverage
- name: Build
run: |
rm -r public/fakeAPI
npm run build
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
deploy:
runs-on: ubuntu-latest
needs: [build]
if: github.ref == 'refs/heads/master'
env:
PUBLIC_URL: /
steps:
- uses: actions/checkout@v2
- name: Set Node.js version
uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE }}"
- run: node --version
- run: npm --version
- name: Set up npm cache
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-v${{ env.NODE }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-v${{ env.NODE }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
${{ runner.OS }}-node-v${{ env.NODE }}-
- name: Install npm dependencies
run: npm ci
- name: Build
run: |
rm public/fakeAPI/.gitignore # Make sure that the fakeAPI data is deployed
npm run build-fake
echo "web.pi-hole.net" > build/CNAME
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
if: success()
env:
PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./build/
with:
emptyCommits: false