Skip to content

Commit

Permalink
✨ feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Cambis committed Jul 12, 2024
0 parents commit 69abe33
Show file tree
Hide file tree
Showing 41 changed files with 1,390 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# For more information about the properties used in this file,
# please see the EditorConfig documentation:
# https://editorconfig.org/

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,js,json,css,scss}]
indent_size = 2

[composer.json]
indent_size = 4
34 changes: 34 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# IDE
.editorconfig export-ignore

# Git
.gitattributes export-ignore
.gitignore export-ignore
.github export-ignore

# Quality tools
.changeset export-ignore
.husky export-ignore
commitlint.config.js export-ignore
lint-staged.config.js export-ignore

# Tests
phpunit.xml.dist export-ignore
tests export-ignore

# Coding standards
ecs.php export-ignore
phpstan.neon.dist export-ignore
rector.php export-ignore
stubs export-ignore

# Documentation
CHANGELOG.md export
CONTRIBUTING.md export-ignore

# Docker
compose.yml export-ignore
docker export-ignore

# Extra
package.json export-ignore
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/1_Bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: "Bug report \U0001F41B"
about: "If something isn't working as expected \U0001F914."
title: ''
labels: 'i: bug'
assignees: ''
---

## Bug report 🐛

<!-- Kia ora, thank you for taking the time to report a bug. -->

| Subject | Details |
| :------------- | :--------------------------------------------------------------------------------|
| Version | e.g. v1.0.0 (invoke `composer show dnadesign/silverstripe-browser-update \| grep versions`) |

<!-- Please provide a clear and concise description of the problem. -->

### Minimal affected code 🚨

<!-- Please provide a minimal reproduction of the affected code here. -->
```php
```

### Current behaviour 😢

<!-- Please provide a minimal reproduction of the current processed code -->
```php
```

### Expected behaviour 🙂

<!-- Please provide a minimal reproduction of what the processed code should be. -->
```php
```
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/2_Feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: "Feature request \U00002728"
about: "I have a suggestion (and may want to implement it \U0001F642)!"
title: ''
labels: 'i: enhancement'
assignees: ''
---

## Feature request ✨

<!-- Kia ora, thank you for taking the time to create a request. -->

<!-- Please provide a clear and concise description of your requested feature. -->
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Support question 🙋
url: https://github.com/dnadesign/silverstripe-browser-update/discussions/new
about: Please ask and answer questions here.
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Description ✍️

<!-- Please provide a clear and concise description of the changes. -->

## Fixes 🐛

- Link to github issue(s) here.

## DoD checklist ✅

- [ ] I have performed a self-review of my code
- [ ] My code adheres to the [coding standards](../CONTRIBUTING.md#coding-standards-️)
- [ ] My commit messages adhere to the [commit standards](../CONTRIBUTING.md#commit-standards-️).
- [ ] My code has been [tested](../CONTRIBUTING.md#testing-).
- [ ] I have added a [changeset](../CONTRIBUTING.md#making-a-pull-request-).
28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Lint 👮

on:
pull_request:
branches:
- main
push:
branches:
- main

env:
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
COMPOSER_ROOT_VERSION: dev-main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
with:
php-version: 8.3
coverage: none

- uses: ramsey/composer-install@v2

- run: composer lint
38 changes: 38 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish 🔖
on:
workflow_run:
workflows:
- lint
- test
branches:
- main
types:
- completed

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
pull-requests: write

jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18

- run: yarn install

- name: Create release pull request or publish
id: changesets
uses: changesets/action@v1
with:
commit: ":memo: ci: update changelog"
title: ":memo: ci: update changelog"
publish: "echo 'versioned'"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release 🚀

# https://tomasvotruba.com/blog/how-to-release-php-81-and-72-package-in-the-same-repository/
# https://github.com/TomasVotruba/cognitive-complexity/blob/main/.github/workflows/downgraded_release.yaml
# https://github.com/symplify/config-transformer/blob/main/.github/workflows/downgraded_release.yaml
# https://github.com/driftingly/rector-laravel/blob/main/.github/workflows/downgraded_release.yaml

on:
push:
tags:
- "*"

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: shivammathur/setup-php@v2
with:
php-version: 8.3
coverage: none

- uses: ramsey/composer-install@v2

# Downgrade to PHP 7.4
- run: vendor/bin/rector process src --config build/rector-downgrade-php-81.php --ansi

# Copy composer
- run: cp build/composer-php-81.json composer.json

# Clear the dev files
- run: |
rm -rf \
.editorconfig \
.gitattributes \
.gitignore \
.github \
.changeset \
.husky \
commitlint.config.js \
lint-staged.config.js \
phpunit.xml.dist \
tests \
ecs.php \
phpstan.neon.dist \
rector.php \
build \
stubs \
package.json \
CHANGELOG.md \
CONTRIBUTING.md \
docker \
compose.yml \
# Setup git bot user
- run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
# Publish to the same repository with a new tag
- name: Tag downgraded code
run: |
git commit -a -m ":package: ci: php-8.1 downgraded ${GITHUB_REF#refs/tags/}"
# Force push tag, so there is only a single version
git tag "${GITHUB_REF#refs/tags/}" --force
git push origin "${GITHUB_REF#refs/tags/}" --force
52 changes: 52 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Test 🧑‍🔬

on:
pull_request:
branches:
- main
push:
branches:
- main

env:
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
COMPOSER_ROOT_VERSION: dev-main

jobs:
test:
runs-on: ubuntu-latest

services:
mysql:
image: mysql:8.0
env:
MYSQL_HOST: 127.0.0.1
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: SS_mysite
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10

steps:
- uses: actions/checkout@v3

- uses: shivammathur/setup-php@v2
with:
php-version: 8.3
coverage: none

- uses: ramsey/composer-install@v2

- run: vendor/bin/sake dev/build flush=1
env:
SS_DATABASE_SERVER: 127.0.0.1
SS_DATABASE_NAME: SS_mysite
SS_DATABASE_USERNAME: root
SS_DATABASE_PASSWORD: root

- run: vendor/bin/phpunit -d flush=1
env:
SS_DATABASE_SERVER: 127.0.0.1
SS_DATABASE_NAME: SS_mysite
SS_DATABASE_USERNAME: root
SS_DATABASE_PASSWORD: root
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# OS
.DS_Store

# IDE
.idea
.vscode

# Silverstripe
public/
app/

# Dependencies
node_modules/
vendor/
composer.lock
yarn-error.log
yarn.lock

# Tests
.phpunit.result.cache
coverage/

# Docker
docker
compose.yml
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
Loading

0 comments on commit 69abe33

Please sign in to comment.