Skip to content

Commit

Permalink
feat: github CI with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
activescott committed Feb 7, 2021
1 parent 55819ba commit 799f23a
Show file tree
Hide file tree
Showing 6 changed files with 255 additions and 3 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: ci

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v1
- name: "Use Node.js (deliberately not using matrix)"
uses: actions/setup-node@v1
with:
node-version: v12.x

- name: install dependencies
run: |
npm i
npm run lint
- name: lint
run: |
npm run lint
server_build_and_test:
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [10.x, 12.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: build package
run: |
cd server
npm i
npm run build-server
- name: test package
run: |
cd server
npm run test
client_build_and_test:
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [10.x, 12.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: build package
run: |
cd client
npm i
npm run build
env:
# this is because I have a couple pending warnings in the client that I way to leave there to fix later but not fail this build :/
CI: false

- name: test package
run: |
cd client
npm run test
release_notes:
runs-on: ubuntu-20.04
needs: [lint, server_build_and_test, client_build_and_test]

steps:
- uses: actions/checkout@v1

- name: "Use Node.js (deliberately not using matrix)"
uses: actions/setup-node@v1
with:
node-version: v12.x

- name: Publish Release Notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm i semantic-release@17
./node_modules/.bin/semantic-release
137 changes: 137 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
"scripts": {
"test-server": "pushd .; cd server; npm run -s test; popd",
"test-client": "pushd .; cd client; npm run -s test; popd",
"test": "npm run -s test-server && npm run -s test-client",
"test-all": "npm run -s test-server && npm run -s test-client",
"deploy-staging": "pushd .; cd server; npm run -s deploy-staging; popd",
"deploy-production": "pushd .; cd server; npm run -s deploy-production; popd",
"deploy": "echo 'Use either `deploy-staging` or `deploy-production`'",
"install-server": "pushd .; cd server; npm install; popd",
"install-client": "pushd .; cd client; npm install; popd",
"install-all": "npm run install-server; npm run install-client;",
"postinstall": "npm run -s install-server && npm run -s install-client",
"eslint": "./node_modules/.bin/eslint . --ext ts,tsx",
"lint": "./node_modules/.bin/prettier -l \"{,!(node_modules)/**/}*.{ts,tsx,md,yml,json,html}\" && npm run eslint",
"lint-fix": "./node_modules/.bin/prettier --write \"{,!(node_modules)/**/}*.{ts,tsx,md,yml,json,html}\" && npm run eslint --fix",
Expand Down
19 changes: 19 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
branches: ["main"],
plugins: [
[
"@semantic-release/commit-analyzer",
{
preset: "angular",
},
],
[
"@semantic-release/release-notes-generator",
{
preset: "angular",
},
],
// github config docs: https://github.com/semantic-release/github
["@semantic-release/github", {}],
],
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("upsert", () => {
it("should overwrite an existing identity", async () => {
const proposed = randomIdentity()

await Promise.allSettled([repo.upsert(proposed), repo.upsert(proposed)])
await Promise.all([repo.upsert(proposed), repo.upsert(proposed)])

const list = await repo.list()
expect(list).toHaveLength(1)
Expand Down
File renamed without changes.

0 comments on commit 799f23a

Please sign in to comment.