Skip to content

Commit

Permalink
create a preliminary github build/test workflow
Browse files Browse the repository at this point in the history
will need to finish this, but we need to check the
workflow out on a PR now.
  • Loading branch information
nick-funk committed Jul 25, 2023
1 parent af6d135 commit e227498
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 41 deletions.
93 changes: 52 additions & 41 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,67 +60,78 @@ jobs:
id: cache
uses: actions/cache@v3
with:
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
path: ./client/node_modules
key: modules-client-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
-
name: Cache Dependencies
id: cache
uses: actions/cache@v3
with:
path: ./common/node_modules
key: modules-common-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
-
name: Cache Dependencies
id: cache
uses: actions/cache@v3
with:
path: ./server/node_modules
key: modules-server-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
-
name: npm ci
run: npm ci
run: sh npm-ci.sh
-
name: Generate schemas and types
run: npm run generate
run: sh generate.sh
-
name: Lint Source Code
run: npm run lint
-
name: Lint Markdown
run: |
npm run doctoc
git diff --exit-code
-
name: Lint Versions
run: npx @coralproject/package-version-lint
run: sh lint.sh
# -
# name: Lint Versions
# run: npx @coralproject/package-version-lint
-
name: Run Server Unit Tests
run: npm run test:server -- --ci --runInBand --reporters=default --reporters=jest-junit
run: cd server && npm run test:server -- --ci --runInBand --reporters=default --reporters=jest-junit
-
name: Run Client Stream Unit Tests
run: npm run test:client:stream -- --ci --runInBand --reporters=default --reporters=jest-junit
run: cd client && npm run test:client:stream -- --ci --runInBand --reporters=default --reporters=jest-junit
-
name: Run Client Admin Unit Tests
run: npm run test:client:admin -- --ci --runInBand --reporters=default --reporters=jest-junit
run: cd client && npm run test:client:admin -- --ci --runInBand --reporters=default --reporters=jest-junit
-
name: Run Client Other Unit Tests
run: npm run test:client:other -- --ci --runInBand --reporters=default --reporters=jest-junit
run: cd client && npm run test:client:other -- --ci --runInBand --reporters=default --reporters=jest-junit
-
name: Build
env:
NODE_OPTIONS: "--max-old-space-size=8192"
run: npm run build
run: sh build.sh
-
name: Verify Bundle Size
run: ./node_modules/.bin/bundlesize --enable-github-checks
run: cd client && ./node_modules/.bin/bundlesize --enable-github-checks
# Build tag push the image after a merge to develop
-
name: Build, Tag, Push
uses: docker/build-push-action@v4
if: github.ref == 'refs/heads/develop'
with:
push: true
tags: ${{ env.IMAGE_REPOSITORY }}:develop-latest
build-args: |
REVISION_HASH=${GITHUB_SHA}
cache-from: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-develop
cache-to: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-develop
# -
# name: Build, Tag, Push
# uses: docker/build-push-action@v4
# if: github.ref == 'refs/heads/develop'
# with:
# push: true
# tags: ${{ env.IMAGE_REPOSITORY }}:develop-latest
# build-args: |
# REVISION_HASH=${GITHUB_SHA}
# cache-from: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-develop
# cache-to: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-develop
# Build tag push the release candidate image when the branch name begins with release-
-
name: Build, Tag, Push RC
uses: docker/build-push-action@v4
if: startsWith( github.ref, 'refs/heads/release-')
with:
push: true
tags: ${{ env.IMAGE_REPOSITORY }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}
build-args: |
REVISION_HASH=${GITHUB_SHA}
cache-from: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-release
cache-to: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-release
# -
# name: Build, Tag, Push RC
# uses: docker/build-push-action@v4
# if: startsWith( github.ref, 'refs/heads/release-')
# with:
# push: true
# tags: ${{ env.IMAGE_REPOSITORY }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}
# build-args: |
# REVISION_HASH=${GITHUB_SHA}
# cache-from: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-release
# cache-to: type=registry,ref=${{ env.IMAGE_CACHE_REPOSITORY }}:cache-release
15 changes: 15 additions & 0 deletions generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
echo "generating schema types for client, common"

cd server
npm run generate
cd ..

echo "running \`npm run build\` for \`common\`"
cd common
npm run build
cd ..

echo "running \`npm run build\` for \`client\`"
cd client
npm run generate
cd ..

0 comments on commit e227498

Please sign in to comment.