Skip to content

Commit

Permalink
🎉 Init with templatus-vue
Browse files Browse the repository at this point in the history
  • Loading branch information
ledermann committed Jun 9, 2022
0 parents commit fe87e78
Show file tree
Hide file tree
Showing 184 changed files with 10,396 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.byebug_history
.dockerignore
.env*
.eslintignore
.eslintrc.js
.eslintcache
.foreman
.git
.github
.gitignore
.gitattributes
.rspec
.rubocop.yml
.vscode
.yarnclean
.prettierignore
.prettierrc.json
docs
coverage
**/*.DS_Store
Brewfile
Brewfile.lock.json
Dockerfile
docker-compose.yml
docker-volumes
Procfile*
Guardfile
log/*
node_modules
public/assets
tmp/*
!/tmp/pids/
!/tmp/pids/.keep
yarn-error.log
config/environments/test.rb
config/environments/development.rb
jest.config.js
cypress.config.json
spec
README.md
bin/bundle
bin/cypress
bin/dev
bin/rspec
bin/rubocop
bin/setup
bin/yarn
17 changes: 17 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Hostname of the application
APP_HOST=templatus.test

# Timezone
TIME_ZONE=Berlin

# Honeybadger.io error tracking
HONEYBADGER_API_KEY=1234567890

# Redis, used for Caching, ActionCable and Sidekiq
REDIS_URL=redis://myredis:6379/0

# Redirect to HTTPS
FORCE_SSL=true

# Analytics
PLAUSIBLE_URL=https://plausible.io
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APP_HOST=templatus.test
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/node_modules
/coverage
/public
/vendor
/tmp
/log
/db
/config
44 changes: 44 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
module.exports = {
root: true,
env: {
browser: true,
jest: true,
node: true,
},
plugins: [],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jest/recommended',
'plugin:vue/base',
'plugin:vue/vue3-essential',
'plugin:vue/vue3-recommended',
'plugin:vue/vue3-strongly-recommended',
'prettier',
'plugin:prettier/recommended',
],
globals: {
defineProps: 'readonly',
defineEmits: 'readonly',
defineExpose: 'readonly',
withDefaults: 'readonly',
},
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-var-requires': 'off',
'vue/no-v-html': 'off',
'vue/script-setup-uses-vars': 'error',
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
},
parserOptions: {
parser: '@typescript-eslint/parser', // the typescript-parser for eslint, instead of tslint
sourceType: 'module', // allow the use of imports statements
ecmaVersion: 2020, // allow the parsing of modern ecmascript
},
};
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# See https://git-scm.com/docs/gitattributes for more about git attribute files.

# Mark the database schema as having been generated.
db/schema.rb linguist-generated

# Mark the yarn lockfile as having been generated.
yarn.lock linguist-generated

# Mark any vendored files as having been vendored.
vendor/* linguist-vendored
43 changes: 43 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: bundler
directory: '/'
schedule:
interval: daily
time: '01:00'
timezone: Europe/Berlin
open-pull-requests-limit: 10
versioning-strategy: lockfile-only
allow:
- dependency-type: direct
- dependency-type: indirect
labels:
- 'dependencies'
- 'ruby'

- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
time: '01:00'
timezone: Europe/Berlin
open-pull-requests-limit: 10
versioning-strategy: auto
labels:
- 'dependencies'
- 'javascript'

- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
time: '01:00'
timezone: Europe/Berlin
labels:
- 'dependencies'
- 'gh-action'
24 changes: 24 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Dependabot auto-merge
on: pull_request_target

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: '${{ secrets.PAT }}'

- name: Enable auto-merge for Dependabot PRs
if: ${{ steps.metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.PAT}}
151 changes: 151 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
name: CI
on: push

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-20.04

services:
postgres:
image: postgres:14-alpine
ports: ['5432:5432']
env:
POSTGRES_PASSWORD: postgres

redis:
image: redis:alpine
ports: ['6379:6379']

env:
DB_HOST: localhost
DB_USER: postgres
DB_PASSWORD: postgres
REDIS_URL: redis://localhost:6379/0
RAILS_ENV: test
CI: true

steps:
- uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Setup Node.js
uses: actions/[email protected]
with:
cache: yarn

- name: Install Yarn packages
run: bin/yarn install --frozen-lockfile

- name: Lint with RuboCop
run: bin/rubocop --parallel

- name: Run ESLint
run: bin/yarn lint

- name: Check for TypeScript errors
run: bin/yarn tsc

- name: Setup PostgreSQL
run: bin/rails db:create

- name: Compile assets
run: bin/rails assets:precompile

- name: Run Ruby Tests
run: bin/rspec

- name: Run JavaScript tests
run: bin/yarn test

- name: End-to-end tests
uses: cypress-io/github-action@v4
with:
start: bundle exec rails server
wait-on: http://localhost:3000
browser: chrome
record: true
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_BASE_URL: http://localhost:3000
CYPRESS: true
if: env.CYPRESS_RECORD_KEY != null

- name: Check JS size limit
run: yarn size-limit

- uses: actions/upload-artifact@v3
if: failure()
with:
name: Cypress screenshots and videos
path: |
tmp/cypress_screenshots/
tmp/cypress_videos/
if-no-files-found: ignore

deploy:
runs-on: ubuntu-20.04

if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags')

needs: test

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Fetch tag annotations
# https://github.com/actions/checkout/issues/290
run: git fetch --tags --force

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build the production image
run: |
export COMMIT_TIME=$(git show -s --format=%cI ${GITHUB_SHA})
export COMMIT_VERSION=$(git describe --always)
echo $GITHUB_SHA
echo $COMMIT_TIME
echo $COMMIT_VERSION
docker buildx build --build-arg COMMIT_TIME --build-arg COMMIT_VERSION -t app .
- name: Push the image tagged as LATEST to the container registry
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags')
run: |
docker tag app ghcr.io/${{ github.repository }}:latest
docker push ghcr.io/${{ github.repository }}:latest
- name: Push the image tagged with version to the container registry
if: startsWith(github.ref, 'refs/tags')
run: |
docker tag app ghcr.io/${{ github.repository }}:${GITHUB_REF##*/}
docker push ghcr.io/${{ github.repository }}:${GITHUB_REF##*/}
- name: Send webhook to start deployment
env:
DEPLOY_HOOK: ${{ secrets.DEPLOY_HOOK }}
if: env.DEPLOY_HOOK != null
run: curl -X POST ${{ env.DEPLOY_HOOK }}

- name: Notify Honeybadger about deployment
env:
DEPLOY_HOOK: ${{ secrets.DEPLOY_HOOK }}
HONEYBADGER_API_KEY: ${{ secrets.HONEYBADGER_API_KEY }}
if: env.DEPLOY_HOOK != null && env.HONEYBADGER_API_KEY != null
uses: honeybadger-io/github-notify-deploy-action@v1
with:
api_key: ${{ secrets.HONEYBADGER_API_KEY }}
22 changes: 22 additions & 0 deletions .github/workflows/size-limit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'size'

on:
pull_request:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
size:
runs-on: ubuntu-latest
env:
CI_JOB_NUMBER: 1
steps:
- uses: actions/checkout@v3
- uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
build_script: vite build
Loading

0 comments on commit fe87e78

Please sign in to comment.