Update flair tests and fix flair badge input validation #650
Workflow file for this run
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
name: Build and Test | |
on: | |
workflow_dispatch: | |
push: | |
merge_group: | |
env: | |
IMAGE_REPOSITORY: 'gcr.io/the-coral-project/coral' | |
IMAGE_CACHE_REPOSITORY: 'coralproject/ci' | |
DOCKERHUB_USERNAME: 'coralproject' | |
jobs: | |
build-and-test: | |
name: Build and Test | |
runs-on: ubuntu-22.04 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
uses: webfactory/ssh-agent@v0.7.0 | |
with: | |
ssh-private-key: ${{ secrets.REPO_PATCHED_DEPLOY_KEY }} | |
- | |
name: Login to GCR | |
uses: docker/login-action@v2 | |
with: | |
registry: gcr.io | |
username: _json_key | |
password: ${{ secrets.GCR_JSON_KEY }} | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ env.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- | |
name: Define SHORT_SHA with commit short sha | |
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV | |
- | |
name: Setup Node14.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '14.x' | |
- | |
name: Install npm 8 | |
run: npm i -g npm@8.0.0 --registry=https://registry.npmjs.org | |
- | |
name: npm Lockfile Version | |
uses: mansona/npm-lockfile-version@v1 | |
with: | |
version: 2 | |
- | |
name: Cache Dependencies | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: ./node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
restore-keys: npm- | |
- | |
name: npm ci | |
run: npm ci | |
- | |
name: Generate schemas and types | |
run: npm run generate | |
- | |
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 | |
- | |
name: Run Server Unit Tests | |
run: 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 | |
- | |
name: Run Client Admin Unit Tests | |
run: 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 | |
- | |
name: Build | |
env: | |
NODE_OPTIONS: "--max-old-space-size=8192" | |
run: npm run build | |
- | |
name: Verify Bundle Size | |
run: ./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 | |
# 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 |