Skip to content

chore: replace blues.io with blues.com (#126) #763

chore: replace blues.io with blues.com (#126)

chore: replace blues.io with blues.com (#126) #763

name: CI-PRs-and-main
on:
pull_request:
push:
branches:
- main
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: crazy-max/ghaction-dump-context@v1
- uses: actions/checkout@v2
- uses: volta-cli/action@v1
- uses: actions/cache@v2
with:
path: |
node_modules
/home/runner/.cache/Cypress
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-
- run: yarn install
- run: yarn build
- name: Run unit tests
env:
HUB_AUTH_TOKEN: ${{ secrets.HUB_AUTH_TOKEN }}
HUB_BASE_URL: ${{ secrets.HUB_BASE_URL }}
HUB_PROJECTUID: ${{ secrets.HUB_PROJECTUID }}
TEST_NODE_ID: ${{ secrets.TEST_NODE_ID }}
NOTEHUB_PROVIDER: 1
run: yarn test:coverage
- run: yarn lint
- name: Cypress run
uses: cypress-io/github-action@v2
with:
env: configFile=staging
start: yarn start
env:
HUB_AUTH_TOKEN: ${{ secrets.HUB_AUTH_TOKEN }}
HUB_BASE_URL: ${{ secrets.HUB_BASE_URL }}
HUB_PROJECTUID: ${{ secrets.HUB_PROJECTUID }}
TEST_NODE_ID: ${{ secrets.TEST_NODE_ID }}
NOTEHUB_PROVIDER: 1
docker-build:
runs-on: ubuntu-latest
steps:
- uses: crazy-max/ghaction-dump-context@v1
- uses: actions/checkout@v2
# This is the a separate action that sets up buildx runner
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# So now you can use Actions' own caching!
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-buildx-
# And make it available for the builds
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.prod
push: false
tags: user/app:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Move cache
# This ugly bit is necessary if you don't want your cache to grow
# forever till it hits GitHub's limit of 5GB. Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache