Skip to content

Commit

Permalink
Initial (#1)
Browse files Browse the repository at this point in the history
feat: initial version
  • Loading branch information
Lee Staples authored Aug 18, 2022
1 parent d2390ea commit 5d36ead
Show file tree
Hide file tree
Showing 23 changed files with 500 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: 2.1

setup: true

orbs:
orb-tools: circleci/[email protected]
shellcheck: circleci/[email protected]

filters: &filters
tags:
only: /.*/

workflows:
lint-pack:
jobs:
- orb-tools/lint:
filters: *filters

- orb-tools/pack:
filters: *filters

- orb-tools/review:
filters: *filters

- shellcheck/check:
filters: *filters

- orb-tools/publish:
orb-name: zygopleural/snaplet
vcs-type: << pipeline.project.type >>
requires:
- orb-tools/lint
- orb-tools/review
- orb-tools/pack
- shellcheck/check
# Use a context to hold your publishing token.
context: orb-publishing
filters: *filters

# Triggers the next workflow in the Orb Development Kit.
- orb-tools/continue:
pipeline-number: << pipeline.number >>
vcs-type: << pipeline.project.type >>
requires:
- orb-tools/publish
filters: *filters
73 changes: 73 additions & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
version: 2.1

orbs:
snaplet: zygopleural/snaplet@dev:<<pipeline.git.revision>>
orb-tools: circleci/[email protected]

filters: &filters
tags:
only: /.*/

jobs:
restore-test:
working_directory: ~/repo/app
docker:
- image: cimg/base:current
- image: cimg/postgres:14.0
environment:
POSTGRES_USER: snaplet
POSTGRES_PASSWORD: snaplet
POSTGRES_DB: snaplet
environment:
PGPASSWORD: snaplet
steps:
- checkout:
path: ~/repo
- run:
name: Waiting for Postgres to be ready
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: Initial migration
command: psql --host localhost --username snaplet --dbname snaplet --echo-all --file ./migration.sql
- run:
name: Assert empty
command: |
COUNT=$(psql -h localhost -U snaplet -d snaplet -AXqtc "SELECT COUNT(*) FROM cats;")
exit $COUNT
- snaplet/restore
- run:
name: Assert not-empty
command: |
COUNT=$(psql -h localhost -U snaplet -d snaplet -AXqtc "SELECT COUNT(*) FROM cats;")
if [ "${COUNT}" -eq "0" ]
then
exit 1
else
echo "#cats = ${COUNT}"
exit 0
fi
workflows:
test-deploy:
jobs:
# Make sure to include "filters: *filters" in every test job you want to run as part of your deployment.
- restore-test:
filters: *filters
context: snaplet-orb-tests

- orb-tools/pack:
filters: *filters

- orb-tools/publish:
orb-name: zygopleural/snaplet
vcs-type: << pipeline.project.type >>
pub-type: production
requires:
- orb-tools/pack
- restore-test
context: orb-publishing
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "\U0001F41E Bug Report"
description: Report any identified bugs.
title: 'Bug: '
labels: [bug]
# assignees: ''
body:
- type: checkboxes
attributes:
label: "Is there an existing issue for this?"
description: "Please search [here](https://github.com/zygopleural/snaplet-circleci-orb/issues?q=is%3Aissue) to see if an issue already exists for the bug you encountered"
options:
- label: "I have searched the existing issues"
required: true

- type: input
attributes:
label: "Orb version"
description: |
Which version of `zygopleural/snaplet` are you using?
placeholder: "1.0.0"

- type: textarea
validations:
required: true
attributes:
label: "Current behavior"
description: "How does the issue manifest?"

- type: textarea
validations:
required: true
attributes:
label: "Minimum reproduction config"
description: "Enter a URL to a failed build or write a config example to reproduce the issue"
placeholder: "https://app.circleci.com/..."

- type: textarea
attributes:
label: "Other"
description: |
Anything else you want to share?
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "\U0001F4A1 Feature Request"
description: Have an idea for a new feature? Begin by submitting a Feature Request
title: 'Request: '
labels: [enhancement]
# assignees: ''
body:
- type: checkboxes
attributes:
label: "Is there an existing issue that is already proposing this?"
description: "Please search [here](https://github.com/CircleCI-Public/circleci-config-sdk-ts/issues?q=is%3Aissue) to see if an issue already exists for the feature you are requesting"
options:
- label: "I have searched the existing issues"
required: true

- type: textarea
validations:
required: true
attributes:
label: "Describe the problem imposed by not having this feature"
description: "Please describe the use-case you are attempting to implement, and the current limitations you are facing."

- type: textarea
validations:
required: true
attributes:
label: "Describe the solution you'd like"
description: "A clear and concise description of what you want to happen. Add any considered drawbacks"


- type: textarea
attributes:
label: "Other"
description: |
Anything else you want to share?
25 changes: 25 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/PULL_REQUEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## PR Type
What kind of change does this PR introduce?

<!-- Please check the one that applies to this PR using "x". -->
- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting)
- [ ] Refactoring (no functional changes)
- [ ] CI related changes
- [ ] Other... Please describe:

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->

Issue Number: N/A

## What is the new behavior?

## Does this PR introduce a breaking change?
- [ ] Yes
- [ ] No

<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->

## Other information
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# orb.yml is "packed" from source, and not published directly from the repository.
orb.yml
.DS_Store
7 changes: 7 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: relaxed

rules:
line-length:
max: 200
allow-non-breakable-inline-mappings: true

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 zygopleural

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# snaplet-circleci-orb

<!---
[![CircleCI Build Status](https://circleci.com/gh/zygopleural/snaplet-circleci-orb.svg?style=shield "CircleCI Build Status")](https://circleci.com/gh/zygopleural/snaplet-circleci-orb) [![CircleCI Orb Version](https://badges.circleci.com/orbs/zygopleural/snaplet.svg)](https://circleci.com/orbs/registry/orb/zygopleural/snaplet) [![GitHub License](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://raw.githubusercontent.com/zygopleural/snaplet-circleci-orb/master/LICENSE) [![CircleCI Community](https://img.shields.io/badge/community-CircleCI%20Discuss-343434.svg)](https://discuss.circleci.com/c/ecosystem/orbs)
--->

[Snaplet] gives developers production-accurate PostgreSQL data and preview databases that they can code against.
It does this by capturing a 'snapshot' of a database, copying the schema, and providing a JavaScript runtime for transforming, reducing (subsetting) and generating synthetic data.
Developers can then share these snapshots with their team for collaborative development.

---

## Resources

[CircleCI Orb Registry Page](https://circleci.com/orbs/registry/orb/zygopleural/snaplet) - The official registry page of this orb for all versions, executors, commands, and jobs described.

[CircleCI Orb Docs](https://circleci.com/docs/2.0/orb-intro/#section=configuration) - Docs for using, creating, and publishing CircleCI Orbs.

### How to Contribute

We welcome [issues](https://github.com/zygopleural/snaplet-circleci-orb/issues) to and [pull requests](https://github.com/zygopleural/snaplet-circleci-orb/pulls) against this repository!

### How to Publish An Update
1. Merge pull requests with desired changes to the main branch.
- For the best experience, squash-and-merge and use [Conventional Commit Messages](https://conventionalcommits.org/).
2. Find the current version of the orb.
- You can run `circleci orb info zygopleural/snaplet | grep "Latest"` to see the current version.
3. Create a [new Release](https://github.com/zygopleural/snaplet-circleci-orb/releases/new) on GitHub.
- Click "Choose a tag" and _create_ a new [semantically versioned](http://semver.org/) tag. (ex: v1.2.3)
- We will have an opportunity to change this before we publish if needed after the next step.
4. Click _"+ Auto-generate release notes"_.
- This will create a summary of all of the merged pull requests since the previous release.
- If you have used _[Conventional Commit Messages](https://conventionalcommits.org/)_ it will be easy to determine what types of changes were made, allowing you to ensure the correct version tag is being published.
5. Now ensure the version tag selected is semantically accurate based on the changes included.
6. Click _"Publish Release"_.
- This will push a new tag and trigger your publishing pipeline on CircleCI.

[Snaplet]: https://www.snaplet.dev/
2 changes: 2 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.snaplet/snapshots
.snaplet/structure.d.ts
5 changes: 5 additions & 0 deletions app/.snaplet/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projectId": "cl6z5sjbk17740357lyeea4w7jj",
"databaseUrl": "postgresql://snaplet:snaplet@localhost:5432/snaplet",
"publicKey": "-----BEGIN RSA PUBLIC KEY-----\nMIIBigKCAYEAu4Rb//5qrpqkywKuo8nfJZU+aYzg2DUn9+UpIrJnoqjh/1kBzWEZ\nT7cbw85Kk3+wTTIfGJrZAISEzTgGZpO380uKIOL//LeeZhQFE4jVokjcb35suKb2\nrho7YceaDxDJxrEDeFliZDs5sh9vZ++cN+IkEpBzT598bNdrOWVe6K/uKiy/mSd0\nCtz3kWqfPatUjcZRG5RxlTC8t5nBdnKJ3VvCjJF4xvfDas9fm0v1lyrylc8xPuhC\ndgrhNu2Blwwi1D4xVAM0tn5MVnWVPz+zQSBG5/P3f5i9QFEa1LxzPwCapoxjPvaJ\nlaFnVDogzilbeg9ATT/OMAxTcpx7ACLVYdsmpdCEtsnFOJyeBlcd8yKl9tq8XDG9\nivzcpBjskdgj4b3QsWGylN8BOuCHvNotH2psLJvO/NHhvSDWoEy+EPW/XL4vK3Hz\nJPoPYhpz7WjQOBg6KoVb1yNQdaNFXAB2V3fq6Daj3OBKksOSRuuG5VwkAGR19OCE\nJMO+5o4DmbIdAgMBAAE=\n-----END RSA PUBLIC KEY-----\n"
}
42 changes: 42 additions & 0 deletions app/.snaplet/id_rsa
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
NOTE: This private key is used to decrypt snapshots.
Do not share this with entities that should not be able to decrypt your snapshots.

-----BEGIN RSA PRIVATE KEY-----
MIIG5AIBAAKCAYEAu4Rb//5qrpqkywKuo8nfJZU+aYzg2DUn9+UpIrJnoqjh/1kB
zWEZT7cbw85Kk3+wTTIfGJrZAISEzTgGZpO380uKIOL//LeeZhQFE4jVokjcb35s
uKb2rho7YceaDxDJxrEDeFliZDs5sh9vZ++cN+IkEpBzT598bNdrOWVe6K/uKiy/
mSd0Ctz3kWqfPatUjcZRG5RxlTC8t5nBdnKJ3VvCjJF4xvfDas9fm0v1lyrylc8x
PuhCdgrhNu2Blwwi1D4xVAM0tn5MVnWVPz+zQSBG5/P3f5i9QFEa1LxzPwCapoxj
PvaJlaFnVDogzilbeg9ATT/OMAxTcpx7ACLVYdsmpdCEtsnFOJyeBlcd8yKl9tq8
XDG9ivzcpBjskdgj4b3QsWGylN8BOuCHvNotH2psLJvO/NHhvSDWoEy+EPW/XL4v
K3HzJPoPYhpz7WjQOBg6KoVb1yNQdaNFXAB2V3fq6Daj3OBKksOSRuuG5VwkAGR1
9OCEJMO+5o4DmbIdAgMBAAECggGAD+5u4pD6/1qkJZtUuxWrn8XOR6lwcO4TNzyB
AjGmHGu8x7UIMirNu7gS48/jBiUTFXvsqGp/hUu8/LKF2LE0L7d7RNAEb7QqAQIy
bDZz8BXApLhZBFcrHh+ca/JJZH5IpljjspXlhh6CCGAjVvFElHriFbG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FIAN9y2aylC5VQWMOOQIM+rgzJsPbNilOSPoXLpr4YW4hA
NbAhv/onCZ7yv7zi1b3G07VOnGn9Cf/KH4DXt74fuo0CgcEAoy8bIXi2qsYKg4Ne
5I0lG72RHZZFuvqxGmP6X2HV/BD985B77myLtAAqb9eICCFTR3vH+LaWhnsXuDRj
7KHPjkhnJv81UvrWfllNsptT+rdcwkLGIU66AbabTrdD6f8KRjWrsAinkqSV0jMI
bSKmSY2dukCrcnv1SLCLwh7zADmfBqtHzzRPdNRyWX+HtP863DfQjno9wqee47Z8
KoI9lAQRS/PJXycquknlqsGOu6TwuvXWLJdRdy4V11GwkR4rAoHBAN9IG4MQHK9O
HJ5WH1mjTLN2A2DbzDA0SHmiS24iSBp6abIXFntPeh7MjAUqsLUp0nZvI9NNY/sM
F5V9Q3FTMTf7wmhyM2EhhyUnOfDjvXKCM8xqD3q0pBE3ED5Nv88CMZh+onIg8rUs
qTbZmzLOb+sBs0EWYtM6/DNW06WFDi4bSicDkWpDDWVZWP1rRcWESoh6p5obpfrj
CEUrEDRpH1y+eajCcK8fbeL6T+lZ7VOXjNxEyoLpY7zlIDOqZrcMcg==
-----END RSA PRIVATE KEY-----
3 changes: 3 additions & 0 deletions app/.snaplet/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"version": "0.13.4"
}
6 changes: 6 additions & 0 deletions app/.snaplet/transform.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// This transform config was generated by Snaplet.
// Snaplet found fields that may contain personally identifiable information (PII)
// and used that to populate this file.
import { copycat, faker } from "@snaplet/copycat";
import type { Transform } from "./structure";
export const config: Transform = () => ({});
22 changes: 22 additions & 0 deletions app/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: "3"

services:
postgres:
image: postgres:14-alpine
environment:
POSTGRES_USER: snaplet
POSTGRES_PASSWORD: snaplet
POSTGRES_DB: snaplet
ports:
- "5432:5432"
volumes:
- ./migration.sql:/docker-entrypoint-initdb.d/docker_postgres_init.sql
- app-volume:/var/lib/postgresql/data
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 10s
timeout: 5s
retries: 5

volumes:
app-volume: #
Loading

0 comments on commit 5d36ead

Please sign in to comment.