Skip to content

Commit 06ec51e

Browse files
authored
aded fix for workflows github config (#79)
1 parent 72714c4 commit 06ec51e

File tree

10 files changed

+32
-121
lines changed

10 files changed

+32
-121
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ README.md
55
.gitignore
66
.git
77
example/
8+
tmp/

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ENV GOLANG_PROTOBUF_VERSION=1.3.1
55
ENV GRPC_GATEWAY_VERSION=1.11.3
66
ENV GRPC_WEB_VERSION=1.0.6
77
ENV PROTOBUF_VERSION=3.6.1
8-
ENV TERRAFORM_VERSION=0.12.12
8+
ENV TERRAFORM_VERSION=0.12.13
99
ENV K8S_VERSION=1.14.8
1010

1111
RUN apk add --update --no-cache build-base curl git upx && \

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,26 @@ In order to use this you need ensure you have these installed.
123123
* protoc-gen-swagger [Swagger]
124124

125125

126+
### Commit0 Demo
127+
- clone the repo
128+
- run `make build-docker-local`
129+
- add an alias `alias commit0='docker run -it -v "$(pwd):/project" -v "${HOME}/.aws:/root/.aws" commit0:v0'`
130+
- remember to also add this alias to your bash profile if you want it to persist when you open a new terminal
131+
- create a temporary directory `mkdir tmp; cd tmp`
132+
- create the project `commit0 create beier-demo`
133+
- when prompted, select `Amazon AWS`, `us-west-2`, and your commit AWS profile
134+
- `cd beier-demo`
135+
- generate the codebase `commit0 generate --apply`
136+
- go to the react repo `cd react`
137+
- push to the prepped Github Repo. This repo already has AWS credentials loaded in Github Secrets
138+
```
139+
git init
140+
git add -A
141+
git commit -m commit0
142+
git remote add origin git@github.com:commitdev/commit0-demo.git
143+
git push -u origin master --force
144+
```
145+
- Wait for Github Actions to finish
146+
- View the site at http://beier-demo-staging.s3-website-us-west-2.amazonaws.com/
147+
- go to signup, just ensure you have a strong enough password it needs caps, symbol and numerics ex `@Testing123`
148+
- Alternatively you can run the app locally `npm install; npm start`

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ go 1.12
44

55
require (
66
github.com/aws/aws-sdk-go v1.25.33
7-
github.com/aws/aws-sdk-go-v2 v0.16.0
87
github.com/chzyer/logex v1.1.10 // indirect
98
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
109
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 // indirect

go.sum

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5
33
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
44
github.com/aws/aws-sdk-go v1.25.33 h1:8muvpP+Bq5e0CDkM9PDZ6tN74fVUq5v3zSCRaZ93ykM=
55
github.com/aws/aws-sdk-go v1.25.33/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
6-
github.com/aws/aws-sdk-go-v2 v0.16.0 h1:X5pkFnjRNdDEX18NwDGWMaWL5ocNQX0qIYEhEcsTy64=
7-
github.com/aws/aws-sdk-go-v2 v0.16.0/go.mod h1:pFLIN9LDjOEwHfruGweAXEq0XaD6uRkY8FsRkxhuBIg=
86
github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=
97
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
108
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=
@@ -19,7 +17,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
1917
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2018
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2119
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
22-
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
2320
github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU=
2421
github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
2522
github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs=
@@ -29,8 +26,6 @@ github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4
2926
github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q=
3027
github.com/gobuffalo/packr/v2 v2.5.2 h1:4EvjeIpQLZuRIljwnidYgbRXbr1yIzVRrESiLjqKj6s=
3128
github.com/gobuffalo/packr/v2 v2.5.2/go.mod h1:sgEE1xNZ6G0FNN5xn9pevVu4nywaxHvgup67xisti08=
32-
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
33-
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
3429
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
3530
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
3631
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
@@ -102,8 +97,6 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
10297
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
10398
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=
10499
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
105-
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
106-
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
107100
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
108101
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
109102
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@@ -124,7 +117,6 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0 h1:Dh6fw+p6FyRl5x/FvNswO1j
124117
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0 h1:Dh6fw+p6FyRl5x/FvNswO1ji0lIGzm3KP8Y9VkS9PTE=
125118
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
126119
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
127-
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
128120
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
129121
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
130122
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=

internal/generate/ci/generate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func Generate(t *templator.CITemplator, cfg *config.Commit0Config, ciConfig conf
4848
ciFilename = ".travis.yml"
4949
ciTemp = t.TravisCI
5050
case "github":
51-
ciConfigPath = fmt.Sprintf("%s/%s", basePath, ".github/workflow/")
51+
ciConfigPath = fmt.Sprintf("%s/%s", basePath, ".github/workflows/")
5252
ciFilename = "config.yml"
5353
ciTemp = t.Github
5454
default:

internal/generate/generate_helper.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,12 @@ func GenerateArtifactsHelper(t *templator.Templator, cfg *config.Commit0Config,
6464
// @TODO : This strucuture probably needs to be adjusted. Probably too generic.
6565
switch cfg.Frontend.Framework {
6666
case util.React:
67-
log.Println(aurora.Cyan(emoji.Sprintf("Creating React frontend")))
68-
react.Generate(t, cfg, &wg, pathPrefix)
67+
if cfg.Infrastructure.AWS.Cognito.Enabled && cfg.Frontend.Env.CognitoPoolID != "" {
68+
log.Println(aurora.Cyan(emoji.Sprintf("Creating React frontend")))
69+
react.Generate(t, cfg, &wg, pathPrefix)
70+
} else {
71+
log.Println(aurora.Yellow(emoji.Sprintf(":warning: Missing React environment variables, skipping generation")))
72+
}
6973
}
7074

7175
}

templates/ci/github.tmpl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ jobs:
1818

1919
- run: npm install
2020

21-
- run: npm test
22-
2321
- run: npm run build
2422

2523
- name: upload build artifacts
Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import React from 'react'
22
import hoistNonReactStatic from 'hoist-non-react-statics'
3-
import { getProp, keyBy } from './helpers'
4-
import Interface from './Interface'
5-
import PropTypes from 'prop-types'
63

74
// ref: https://reactjs.org/docs/higher-order-components.html
85
function withSelector(selector) {
@@ -32,83 +29,7 @@ function getDisplayName(WrappedComponent) {
3229
return WrappedComponent.displayName || WrappedComponent.name || 'Component'
3330
}
3431

35-
const FormProgressPropDefs = {
36-
forms: PropTypes.arrayOf(
37-
PropTypes.shape({
38-
formTemplateId: PropTypes.string,
39-
})
40-
).isRequired,
41-
formResponses: PropTypes.arrayOf(
42-
PropTypes.shape({
43-
formTemplateId: PropTypes.string.isRequired,
44-
})
45-
).isRequired,
46-
formTabs: PropTypes.arrayOf(
47-
PropTypes.shape({
48-
index: PropTypes.number.isRequired,
49-
})
50-
).isRequired,
51-
}
52-
53-
class FormProgress extends Interface {
54-
constructor(params) {
55-
super(params, FormProgressPropDefs)
56-
Object.assign(this, params)
57-
// TODO rename all step => tab, too confusing
58-
this.formResponseMap = keyBy(params.formResponses, 'formTemplateId')
59-
this.tabIndices = this.formTabs.map(s => s.index)
60-
}
61-
62-
// returns the index of the first form in formTabs that's incomplete (memoized)
63-
getNextIndex() {
64-
return (
65-
this.nextIndex ||
66-
(this.nextIndex = this.forms.findIndex(
67-
form => !this.formResponseMap[form.formTemplateId]
68-
))
69-
)
70-
}
71-
72-
getNextPath() {
73-
const lastFormIndex = this.forms.length - 1
74-
return this.isComplete() ? lastFormIndex : this.getNextIndex()
75-
}
76-
77-
// form is complete when no more forms to fill
78-
isComplete() {
79-
return this.getNextIndex() < 0
80-
}
81-
82-
// returns the index of the active step tab
83-
getActiveTab() {
84-
if (this.isComplete()) return this.tabIndices.length - 1
85-
86-
// find the latest step that's the form has
87-
let activeForm = this.tabIndices
88-
.slice()
89-
.reverse()
90-
.find(step => this.getNextIndex() >= step)
91-
return this.tabIndices.findIndex(step => step === activeForm)
92-
}
93-
94-
// calculate the step progress based on the number of forms in the current step
95-
getTabProgress() {
96-
const nextIndex = this.getNextIndex()
97-
if (nextIndex < 0) {
98-
return 0
99-
}
100-
const maxIndex = this.tabIndices.findIndex(tabIndex => tabIndex > nextIndex)
101-
const max = this.tabIndices[maxIndex]
102-
const min = this.tabIndices[maxIndex - 1]
103-
if (maxIndex <= 0) {
104-
return 0
105-
}
106-
return Math.floor(((nextIndex - min) / (max - min)) * 100)
107-
}
108-
}
109-
11032
export default {
11133
withSelector,
11234
getDisplayName,
113-
// getFormProgress,
11435
}
Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
import React from 'react'
2-
import Button from '@material-ui/core/Button'
32
import Grid from '@material-ui/core/Grid'
4-
import Card from '@material-ui/core/Card'
5-
import CardActions from '@material-ui/core/CardActions'
63

74
import Centered from '../components/Centered'
85
import { Text } from '../components/Text'
96
import SampleRestQuery from '../components/graphql/SampleRestQuery'
107
import AppNavbar from '../components/AppNavbar'
11-
import { to } from '../utils/router'
12-
import Query from '../components/graphql/Query'
13-
import Queries from '../constants/queries'
148

159
function Dashboard({ location }) {
1610
return (
@@ -28,25 +22,4 @@ function Dashboard({ location }) {
2822
)
2923
}
3024

31-
function Forms(data = {}) {
32-
const { formTemplates = [] } = data
33-
return (
34-
<Grid item xs={12}>
35-
{formTemplates.map(form => (
36-
<Card>
37-
<CardActions>
38-
<Button
39-
onClick={to(`/app/forms/${form.id}/step/0`)}
40-
size="small"
41-
color="primary"
42-
>
43-
<Text>{form.title}</Text>
44-
</Button>
45-
</CardActions>
46-
</Card>
47-
))}
48-
</Grid>
49-
)
50-
}
51-
5225
export default Dashboard

0 commit comments

Comments
 (0)