-
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test & deploy with Github Actions (#379)
- Loading branch information
1 parent
80c7d5a
commit b5b7473
Showing
11 changed files
with
139 additions
and
189 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: [evantahler] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Publish Docs | ||
on: | ||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
publish_docs: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: node | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js 14.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
- run: npm ci | ||
- run: ./bin/deploy-docs | ||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: gh-pages | ||
directory: gh-pages | ||
force: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Test | ||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js 14.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
- run: npm ci | ||
- name: save cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
node_modules | ||
dist | ||
key: ${{ runner.os }}-cache-${{ hashFiles('**/package-lock.json') }} | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js 14.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
- name: download cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
node_modules | ||
dist | ||
key: ${{ runner.os }}-cache-${{ hashFiles('**/package-lock.json') }} | ||
- run: npm run lint | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
services: | ||
redis: | ||
image: redis | ||
options: >- | ||
--health-cmd "redis-cli ping" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 6379:6379 | ||
|
||
strategy: | ||
matrix: | ||
node-version: [12.x, 14.x, 16.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: download cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
node_modules | ||
dist | ||
key: ${{ runner.os }}-cache-${{ hashFiles('**/package-lock.json') }} | ||
- run: npm rebuild | ||
- run: ./node_modules/.bin/jest --ci --forceExit | ||
env: | ||
REDIS_HOST: localhost | ||
REDIS_PORT: 6379 | ||
|
||
complete: | ||
runs-on: ubuntu-latest | ||
needs: [test, lint] | ||
steps: | ||
- run: echo "Done!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,16 +6,14 @@ cd "$(dirname "$0")" | |
cd .. | ||
|
||
## git config | ||
GIT_REMOTE=$(git config remote.origin.url) | ||
GIT_USER_NAME='CircleCI for ActionHero' | ||
GIT_USER_EMAIL='[email protected]' | ||
|
||
## Configure a new direcotry to hold the site | ||
rm -rf gh-pages-branch | ||
mkdir gh-pages-branch | ||
cd gh-pages-branch | ||
rm -rf gh-pages | ||
mkdir gh-pages | ||
cd gh-pages | ||
git init | ||
git remote add --fetch origin "$GIT_REMOTE" | ||
if git rev-parse --verify origin/gh-pages > /dev/null 2>&1 | ||
then | ||
git checkout gh-pages | ||
|
@@ -28,21 +26,13 @@ cd .. | |
## build master's docs | ||
git checkout "master" | ||
rm -rf docs | ||
mkdir docs | ||
mkdir -p docs | ||
npm run docs | ||
cp -a docs/. gh-pages-branch/ | ||
touch gh-pages-branch/.nojekyll | ||
mkdir gh-pages-branch/.circleci && cp .circleci/config.yml gh-pages-branch/.circleci/config.yml | ||
cp images/favicon.ico gh-pages-branch/favicon.ico | ||
cp -a docs/. gh-pages/ | ||
touch gh-pages/.nojekyll | ||
cp images/favicon.ico gh-pages/favicon.ico | ||
cp CNAME gh-pages-branch/CNAME | ||
|
||
## push it | ||
cd gh-pages-branch | ||
## make the commmit | ||
git add -A | ||
git -c user.name="$GIT_USER_NAME" -c user.email="$GIT_USER_EMAIL" commit --allow-empty -m "deploy static site @ $(date)" | ||
git push --force origin gh-pages | ||
cd .. | ||
|
||
## clean up | ||
rm -rf gh-pages-branch | ||
echo "Deployment Complete" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
maxWorkers: "50%", | ||
testPathIgnorePatterns: ["<rootDir>/__tests__/utils"], | ||
transform: { | ||
"^.+\\.ts?$": "ts-jest", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters