mirror of
https://github.com/gosticks/web.git
synced 2026-08-12 20:20:25 +00:00
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>
This commit is contained in:
@@ -1,98 +0,0 @@
|
||||
version: 2
|
||||
|
||||
.install_packages: &install_packages
|
||||
run:
|
||||
name: "Install Packages"
|
||||
command: npm ci
|
||||
|
||||
.test: &test
|
||||
run:
|
||||
name: "Test"
|
||||
command: npm run coverage -- --maxWorkers=4
|
||||
|
||||
.store_version: &store_version
|
||||
run:
|
||||
name: "Store Version"
|
||||
command: |
|
||||
BRANCH=$([ -z "$CIRCLE_TAG" ] && echo "$CIRCLE_BRANCH" || echo "master")
|
||||
echo "$CIRCLE_TAG $BRANCH ${CIRCLE_SHA1::7}" > build/VERSION
|
||||
cat build/VERSION
|
||||
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: pihole/web-build:12
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- npm-deps-{{ .Branch }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "package-lock.json" }}
|
||||
- npm-deps-{{ checksum ".circleci/config.yml" }}-{{ checksum "package-lock.json" }}
|
||||
- *install_packages
|
||||
- run:
|
||||
name: "Check Formatting"
|
||||
command: npm run check-format
|
||||
- *test
|
||||
- run:
|
||||
name: "Build"
|
||||
command: |
|
||||
rm -r public/fakeAPI
|
||||
npm run build
|
||||
- *store_version
|
||||
- run:
|
||||
name: "Upload"
|
||||
command: |
|
||||
[[ -z "$FTL_SECRET" || "$CIRCLE_PR_NUMBER" != "" ]] && exit 0
|
||||
DIR="${CIRCLE_TAG:-${CIRCLE_BRANCH}}"
|
||||
tar -czvf pihole-web.tar.gz -C build .
|
||||
mkdir -p ~/.ssh
|
||||
ssh-keyscan -H $SSH_HOST >> ~/.ssh/known_hosts
|
||||
sftp -b - $SSH_USER@$SSH_HOST <<< "-mkdir ${DIR}
|
||||
put pihole-web.tar.gz ${DIR}"
|
||||
- run:
|
||||
name: "Upload Code Coverage"
|
||||
command: npm run codecov
|
||||
- save_cache:
|
||||
key: npm-deps-{{ .Branch }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "package-lock.json" }}
|
||||
paths:
|
||||
- ~/.npm/
|
||||
|
||||
deploy:
|
||||
environment:
|
||||
PUBLIC_URL: /
|
||||
docker:
|
||||
- image: node:12
|
||||
steps:
|
||||
- checkout
|
||||
- *install_packages
|
||||
- *test
|
||||
- run:
|
||||
name: "Build"
|
||||
command: |
|
||||
rm public/fakeAPI/.gitignore # Make sure that the fakeAPI data is deployed
|
||||
npm run build-fake
|
||||
echo "web.pi-hole.net" > build/CNAME
|
||||
- *store_version
|
||||
- run:
|
||||
name: "Deploy"
|
||||
command: |
|
||||
git clone --quiet --depth 1 -b gh-pages https://pralor:$GITHUB_TOKEN@github.com/pi-hole/web.git deploy
|
||||
shopt -s extglob # Enable extra globs, like !()
|
||||
rm -rf deploy/!(.|..|.git)
|
||||
cp -r build/* deploy/
|
||||
cd deploy
|
||||
git config user.email "36384445+pralor@users.noreply.github.com"
|
||||
git config user.name "pralor"
|
||||
git add -A
|
||||
git commit -m "Deploy pi-hole/web to web.pi-hole.net"
|
||||
git push --quiet
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build:
|
||||
jobs:
|
||||
- build
|
||||
- deploy:
|
||||
filters:
|
||||
branches:
|
||||
only: master
|
||||
@@ -0,0 +1,95 @@
|
||||
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
|
||||
Generated
-106
@@ -1604,12 +1604,6 @@
|
||||
"loader-utils": "^1.2.3"
|
||||
}
|
||||
},
|
||||
"@tootallnate/once": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.0.0.tgz",
|
||||
"integrity": "sha512-KYyTT/T6ALPkIRd2Ge080X/BsXvy9O0hcWTtMWkPvwAwF99+vn6Dv4GzrFT/Nn1LePr+FFDbRXXlqmsy9lw2zA==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/babel__core": {
|
||||
"version": "7.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.4.tgz",
|
||||
@@ -2412,15 +2406,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"agent-base": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz",
|
||||
"integrity": "sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"debug": "4"
|
||||
}
|
||||
},
|
||||
"aggregate-error": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz",
|
||||
@@ -2602,12 +2587,6 @@
|
||||
"sprintf-js": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"argv": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/argv/-/argv-0.0.2.tgz",
|
||||
"integrity": "sha1-7L0W+JSbFXGDcRsb2jNPN4QBhas=",
|
||||
"dev": true
|
||||
},
|
||||
"aria-query": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/aria-query/-/aria-query-3.0.0.tgz",
|
||||
@@ -4094,19 +4073,6 @@
|
||||
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
|
||||
"dev": true
|
||||
},
|
||||
"codecov": {
|
||||
"version": "3.6.5",
|
||||
"resolved": "https://registry.npmjs.org/codecov/-/codecov-3.6.5.tgz",
|
||||
"integrity": "sha512-v48WuDMUug6JXwmmfsMzhCHRnhUf8O3duqXvltaYJKrO1OekZWpB/eH6iIoaxMl8Qli0+u3OxptdsBOYiD7VAQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"argv": "0.0.2",
|
||||
"ignore-walk": "3.0.3",
|
||||
"js-yaml": "3.13.1",
|
||||
"teeny-request": "6.0.1",
|
||||
"urlgrey": "0.4.4"
|
||||
}
|
||||
},
|
||||
"collection-visit": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",
|
||||
@@ -8325,17 +8291,6 @@
|
||||
"requires-port": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"http-proxy-agent": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz",
|
||||
"integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@tootallnate/once": "1",
|
||||
"agent-base": "6",
|
||||
"debug": "4"
|
||||
}
|
||||
},
|
||||
"http-proxy-middleware": {
|
||||
"version": "0.19.1",
|
||||
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.19.1.tgz",
|
||||
@@ -8365,24 +8320,6 @@
|
||||
"integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=",
|
||||
"dev": true
|
||||
},
|
||||
"https-proxy-agent": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz",
|
||||
"integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"agent-base": "5",
|
||||
"debug": "4"
|
||||
},
|
||||
"dependencies": {
|
||||
"agent-base": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz",
|
||||
"integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"i18next": {
|
||||
"version": "19.3.2",
|
||||
"resolved": "https://registry.npmjs.org/i18next/-/i18next-19.3.2.tgz",
|
||||
@@ -8452,15 +8389,6 @@
|
||||
"integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==",
|
||||
"dev": true
|
||||
},
|
||||
"ignore-walk": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz",
|
||||
"integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"immer": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/immer/-/immer-4.0.2.tgz",
|
||||
@@ -15536,15 +15464,6 @@
|
||||
"stream-shift": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"stream-events": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/stream-events/-/stream-events-1.0.5.tgz",
|
||||
"integrity": "sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"stubs": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"stream-http": {
|
||||
"version": "2.8.3",
|
||||
"resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz",
|
||||
@@ -15757,12 +15676,6 @@
|
||||
"integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==",
|
||||
"dev": true
|
||||
},
|
||||
"stubs": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz",
|
||||
"integrity": "sha1-6NK6H6nJBXAwPAMLaQD31fiavls=",
|
||||
"dev": true
|
||||
},
|
||||
"style-loader": {
|
||||
"version": "0.23.1",
|
||||
"resolved": "https://registry.npmjs.org/style-loader/-/style-loader-0.23.1.tgz",
|
||||
@@ -15956,19 +15869,6 @@
|
||||
"inherits": "2"
|
||||
}
|
||||
},
|
||||
"teeny-request": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-6.0.1.tgz",
|
||||
"integrity": "sha512-TAK0c9a00ELOqLrZ49cFxvPVogMUFaWY8dUsQc/0CuQPGF+BOxOQzXfE413BAk2kLomwNplvdtMpeaeGWmoc2g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"http-proxy-agent": "^4.0.0",
|
||||
"https-proxy-agent": "^4.0.0",
|
||||
"node-fetch": "^2.2.0",
|
||||
"stream-events": "^1.0.5",
|
||||
"uuid": "^3.3.2"
|
||||
}
|
||||
},
|
||||
"terser": {
|
||||
"version": "4.6.3",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-4.6.3.tgz",
|
||||
@@ -16622,12 +16522,6 @@
|
||||
"requires-port": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"urlgrey": {
|
||||
"version": "0.4.4",
|
||||
"resolved": "https://registry.npmjs.org/urlgrey/-/urlgrey-0.4.4.tgz",
|
||||
"integrity": "sha1-iS/pWWCAXoVRnxzUOJ8stMu3ZS8=",
|
||||
"dev": true
|
||||
},
|
||||
"use": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz",
|
||||
|
||||
+1
-1
@@ -21,7 +21,6 @@
|
||||
"@types/react-table": "^6.8.5",
|
||||
"@types/reactstrap": "^8.4.2",
|
||||
"@types/sha.js": "^2.4.0",
|
||||
"codecov": "^3.6.5",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.2",
|
||||
"faker": "^4.1.0",
|
||||
@@ -30,6 +29,7 @@
|
||||
"iso-639-1": "^2.1.0",
|
||||
"jest-enzyme": "^7.1.2",
|
||||
"jest-localstorage-mock": "^2.4.0",
|
||||
"node-fetch": "^2.6.0",
|
||||
"node-sass": "^4.13.1",
|
||||
"prettier": "^1.19.1",
|
||||
"react-scripts": "^3.4.0",
|
||||
|
||||
Reference in New Issue
Block a user