Upgrade remix themes deps #160
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: π Deploy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: {} | |
jobs: | |
changes: | |
name: π Determine deployable changes | |
runs-on: ubuntu-latest | |
outputs: | |
DEPLOYABLE: ${{steps.changes.outputs.DEPLOYABLE}} | |
steps: | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: '50' | |
- name: β Setup node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
- name: π Determine deployable changes | |
id: changes | |
run: >- | |
echo ::set-output name=DEPLOYABLE::$(node ./other/is-deployable.js ${{ | |
github.sha }}) | |
- name: β Deployable | |
run: >- | |
echo "DEPLOYABLE: ${{steps.changes.outputs.DEPLOYABLE}}" | |
lint: | |
name: ⬣ ESLint | |
needs: [changes] | |
if: needs.changes.outputs.DEPLOYABLE == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.6.0 | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v2 | |
- name: β Setup node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
- name: π₯ Download deps | |
uses: bahmutov/npm-install@v1 | |
- name: π¬ Lint | |
run: npm run lint | |
typecheck: | |
name: Κ¦ TypeScript | |
needs: [changes] | |
if: needs.changes.outputs.DEPLOYABLE == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.6.0 | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v2 | |
- name: β Setup node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
- name: π₯ Download deps | |
uses: bahmutov/npm-install@v1 | |
- name: π Type check | |
run: npm run typecheck | |
jest: | |
name: π Jest | |
needs: [changes] | |
if: needs.changes.outputs.DEPLOYABLE == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.6.0 | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v2 | |
- name: β Setup node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
- name: π₯ Download deps | |
uses: bahmutov/npm-install@v1 | |
- name: π Run jest | |
run: npm run test -- --coverage | |
cypress: | |
name: β«οΈ Cypress | |
needs: [changes] | |
if: needs.changes.outputs.DEPLOYABLE == 'true' | |
runs-on: ubuntu-latest | |
strategy: | |
# when one test fails, DO NOT cancel the other | |
# containers, because this will kill Cypress processes | |
# leaving the Dashboard hanging ... | |
# https://github.com/cypress-io/github-action/issues/48 | |
fail-fast: false | |
matrix: | |
# run 3 copies of the current job in parallel | |
containers: ['π€ Job #1', 'π€ Job #2', 'π₯· Job #3'] | |
steps: | |
- name: π Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.9.1 | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v2 | |
- name: π Copy test env vars | |
run: cp .env.example .env | |
- name: β Setup node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: π₯ Download deps | |
uses: bahmutov/npm-install@v1 | |
- name: βοΈ Build | |
run: npm run build | |
env: | |
ENABLE_TEST_ROUTES: 'true' | |
COMMIT_SHA: ${{ github.sha }} | |
- name: π³ Docker compose | |
run: docker-compose up -d && sleep 3 && npx prisma migrate reset --force | |
env: | |
DATABASE_URL: 'postgresql://alex:alex_rocks@localhost:5432/bereghici_dev_db?schema=public' | |
- name: π³ Cypress run | |
uses: cypress-io/github-action@v2 | |
continue-on-error: true | |
with: | |
start: npm run start:mocks | |
wait-on: 'http://localhost:8811' | |
record: true | |
parallel: true | |
group: 'bereghici.dev' | |
env: | |
PORT: '8811' | |
RUNNING_E2E: 'true' | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
DISABLE_TELEMETRY: 'true' | |
build: | |
name: π³ Build | |
needs: [changes] | |
if: | |
${{ github.ref == 'refs/heads/main' && github.event_name == 'push' && | |
needs.changes.outputs.DEPLOYABLE == 'true' }} | |
runs-on: ubuntu-latest | |
# only build/deploy main branch on pushes | |
steps: | |
- name: π Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.6.0 | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v2 | |
- name: π³ Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
# Setup cache | |
- name: β‘οΈ Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: π Fly Registry Auth | |
uses: docker/login-action@v1 | |
with: | |
registry: registry.fly.io | |
username: x | |
password: ${{ secrets.FLY_API_TOKEN }} | |
- name: π³ Docker build | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: registry.fly.io/bereghici-dev:${{ github.sha }} | |
build-args: | | |
COMMIT_SHA=${{ github.sha }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new | |
# 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 | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
deploy: | |
name: π Deploy | |
runs-on: ubuntu-latest | |
needs: [changes, lint, typecheck, jest, build] | |
# only build/deploy main branch on pushes | |
if: | |
${{ github.ref == 'refs/heads/main' && github.event_name == 'push' && | |
needs.changes.outputs.DEPLOYABLE == 'true' }} | |
steps: | |
- name: π Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.6.0 | |
with: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: β¬οΈ Checkout repo | |
uses: actions/checkout@v2 | |
- name: π Deploy | |
uses: superfly/flyctl-actions@1.3 | |
with: | |
args: 'deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }}' | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |