Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Reinstate linting and make it automatic #214

Merged
merged 16 commits into from
May 3, 2021
30 changes: 30 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'Lint'
on:
pull_request:

jobs:
lint:
name: Lint fixes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
- uses: volta-cli/action@v1
- uses: actions/cache@v2
id: cache
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package.json', 'yarn.lock') }}
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Lint
run: yarn fix
- name: Save lint fixes
run: >
git config user.email "[email protected]" &&
git config user.name "getsentry-bot" &&
git diff --quiet ||
git commit -anm 'ref: Lint fixes' &&
git push
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coverage/
dist/
node_modules/
4 changes: 0 additions & 4 deletions .prettierrc

This file was deleted.

2 changes: 2 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
singleQuote: true
arrowParens: avoid
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
`statusProvider` and `artifactProvider` to `github` if `minVersion` is greater
or equal to `0.21.0`. If your craft configuration file does not set these
providers explicitly, you can keep the old behavior by modifying your config:

```yaml
minVersion: 0.21.0
artifactProvider:
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ By default, it will use GitHub but you can add more providers if needed.

| Option | Description |
| -------- | -------------------------------------------------------------------------------------------------- |
| `name` | Name of the status provider: either `github` (default) or `zeus` (deprecated) |
| `name` | Name of the status provider: either `github` (default) or `zeus` (deprecated) |
| `config` | In case of `github`: may include `contexts` key that contains a list of required contexts (checks) |

**Example:**
Expand Down Expand Up @@ -955,9 +955,12 @@ Here is how you can integrate your GitHub project with `craft`:

- The name of the artifacts is very important and needs to be `name: ${{ github.sha }}`. Craft uses this as a unique id to fetch the artifacts.
- Keep in mind that this action maintains the folder structure and zips everything together. Craft will download the zip and recursively walk it to find all assets.

3. Add `.craft.yml` configuration file to your project
- List there all the targets you want to publish to
- Configure additional options (changelog management policy, tag prefix, etc.)

- List there all the targets you want to publish to
- Configure additional options (changelog management policy, tag prefix, etc.)

4. Add a [pre-release script](#pre-release-version-bumping-script-conventions) to your project.
5. Get various [configuration tokens](#global-configuration)
6. Run `craft prepare <version> --publish` and profit!
Expand Down
2 changes: 1 addition & 1 deletion cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ steps:
- 'SOURCE_COMMIT=$COMMIT_SHA'
- '--destination=us.gcr.io/$PROJECT_ID/craft:builder-$COMMIT_SHA'
- '-f'
- 'builder.dockerfile'
- 'builder.dockerfile'
- name: 'us.gcr.io/$PROJECT_ID/craft:builder-$COMMIT_SHA'
- name: 'gcr.io/kaniko-project/executor:v1.5.1'
args:
Expand Down
92 changes: 67 additions & 25 deletions docs/_site/assets/main.css
Original file line number Diff line number Diff line change
@@ -1,116 +1,158 @@
body {
font-family: 'Oxygen', serif;
color: #46433a;
background-color: #fcfcfc; }
background-color: #fcfcfc;
}

header,
main {
padding: 0 20px; }
padding: 0 20px;
}

/* ** wrapper div for both header and main ** */
.wrapper {
margin-top: 10%; }
margin-top: 10%;
}

/* ** anchor tags ** */
a:link,
a:visited,
a:hover,
a:active {
color: #ce534d;
text-decoration: none; }
text-decoration: none;
}

a:hover {
text-decoration: underline; }
text-decoration: underline;
}

/* ** main content list ** */
.main-list-item {
font-weight: bold;
font-size: 1.2em;
margin: 0.8em 0; }
margin: 0.8em 0;
}

/* override the left margin added by font awesome for the main content list,
/* override the left margin added by font awesome for the main content list,
since it must be aligned with the content */
.fa-ul.main-list {
margin-left: 0; }
margin-left: 0;
}

/* list icons */
.main-list-item-icon {
width: 36px;
color: #46433a; }
color: #46433a;
}

/* ** logo ** */
.logo-container {
text-align: center; }
text-align: center;
}

.logo {
width: 160px;
height: 160px;
display: inline-block;
background-size: cover;
border: 2px solid #fcfcfc; }
border: 2px solid #fcfcfc;
}

/* ** author ** */
.author-container h1 {
font-size: 1.6em;
margin-top: 0;
margin-bottom: 0;
text-align: center; }
text-align: center;
}

/* ** tagline ** */
.tagline-container p {
font-size: 1.3em;
text-align: center;
margin-bottom: 2em; }
margin-bottom: 2em;
}

/* **** */
hr {
border: 0;
height: 1px;
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0), #46433a, rgba(0, 0, 0, 0));
background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0), #46433a, rgba(0, 0, 0, 0));
background-image: -ms-linear-gradient(left, rgba(0, 0, 0, 0), #46433a, rgba(0, 0, 0, 0));
background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0), #46433a, rgba(0, 0, 0, 0)); }
background-image: -webkit-linear-gradient(
left,
rgba(0, 0, 0, 0),
#46433a,
rgba(0, 0, 0, 0)
);
background-image: -moz-linear-gradient(
left,
rgba(0, 0, 0, 0),
#46433a,
rgba(0, 0, 0, 0)
);
background-image: -ms-linear-gradient(
left,
rgba(0, 0, 0, 0),
#46433a,
rgba(0, 0, 0, 0)
);
background-image: -o-linear-gradient(
left,
rgba(0, 0, 0, 0),
#46433a,
rgba(0, 0, 0, 0)
);
}

/* ** footer ** */
footer {
position: fixed;
bottom: 0;
right: 0;
height: 20px; }
height: 20px;
}

.poweredby {
font-family: 'Arial Narrow', Arial;
font-size: 0.6em;
line-height: 0.6em;
padding: 0 5px; }
padding: 0 5px;
}

/* ** media queries ** */
/* X-Small devices (phones, 480px and up) */
@media (min-width: 480px) {
/* wrapper stays 480px wide past 480px wide and is kept centered */
.wrapper {
width: 480px;
margin: 10% auto 0 auto; } }
margin: 10% auto 0 auto;
}
}
/* All other devices (768px and up) */
@media (min-width: 768px) {
/* past 768px the layout is changed and the wrapper has a fixed width of 760px
to accomodate both the header column and the content column */
.wrapper {
width: 760px; }
width: 760px;
}

/* the header column stays left and has a dynamic width with all contents
/* the header column stays left and has a dynamic width with all contents
aligned right */
header {
float: left;
width: 46%;
text-align: right; }
text-align: right;
}

.author-container h1,
.logo-container,
.tagline-container p {
text-align: right; }
text-align: right;
}

main {
width: 46%;
margin-left: 54%;
padding: 0; } }
padding: 0;
}
}
14 changes: 7 additions & 7 deletions docs/_site/assets/normalize.css
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ input {
* 2. Remove excess padding in IE 8/9/10.
*/

input[type="checkbox"],
input[type="radio"] {
input[type='checkbox'],
input[type='radio'] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
Expand All @@ -343,8 +343,8 @@ input[type="radio"] {
* decrement button to change from `default` to `text`.
*/

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
height: auto;
}

Expand All @@ -354,7 +354,7 @@ input[type="number"]::-webkit-outer-spin-button {
* (include `-moz` to future-proof).
*/

input[type="search"] {
input[type='search'] {
-webkit-appearance: textfield; /* 1 */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* 2 */
Expand All @@ -367,8 +367,8 @@ input[type="search"] {
* padding (and `textfield` appearance).
*/

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
input[type='search']::-webkit-search-cancel-button,
input[type='search']::-webkit-search-decoration {
-webkit-appearance: none;
}

Expand Down
4 changes: 3 additions & 1 deletion docs/_site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
<a
class="logo"
href=""
style="background-image: url('/craft/images/sentry-glyph-black.png')"
style="
background-image: url('/craft/images/sentry-glyph-black.png');
"
></a>
</div>

Expand Down
13 changes: 3 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@
"json-schema-to-typescript": "5.7.0",
"mkdirp": "0.5.1",
"mustache": "3.0.1",
"npm-run-all": "^4.1.3",
"nvar": "1.3.1",
"once": "1.4.0",
"ora": "2.1.0",
"prettier": "^1.19.1",
"prettier-check": "^2.0.0",
"prettier": "^2.2.1",
"request": "2.88.0",
"rimraf": "2.7.1",
"shell-quote": "1.6.1",
Expand All @@ -86,15 +84,10 @@
"build:fat": "yarn run compile-config-schema && tsc -p tsconfig.build.json",
"build:watch": "yarn run compile-config-schema && tsc -p tsconfig.build.json --watch",
"build": "yarn compile-config-schema && esbuild src/index.ts --bundle --platform=node --target=node10.8 --outfile=dist/craft --minify",
"precli": "run-s build",
"precli": "build",
"cli": "node dist/craft",
"clean": "rimraf dist coverage",
"lint": "run-s lint:prettier lint:eslint",
"lint:prettier": "prettier-check 'src/**/*.ts'",
"lint:eslint": "eslint src --ext .ts --format stylish",
"fix": "run-s fix:tslint fix:prettier",
"fix:prettier": "prettier --write 'src/**/*.ts'",
"fix:eslint": "eslint src --ext .ts --fix --format stylish",
"fix": "prettier --write .",
"test": "jest",
"test:watch": "jest --watch --notify",
"compile-config-schema": "node ./scripts/config-json-schema-to-ts.js"
Expand Down
2 changes: 1 addition & 1 deletion src/__mocks__/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const consola = require('consola');

const loggerModule: typeof consola = jest.genMockFromModule('../logger');

loggerModule.logger.withScope = function(): any {
loggerModule.logger.withScope = function (): any {
return this;
};

Expand Down
2 changes: 1 addition & 1 deletion src/artifact_providers/zeus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,6 @@ export class ZeusArtifactProvider extends BaseArtifactProvider {

return dict;
}, {} as { [key: string]: ZeusArtifact })
).map((zeusArtifact) => this.convertToRemoteArtifact(zeusArtifact));;
).map(zeusArtifact => this.convertToRemoteArtifact(zeusArtifact));
}
}
11 changes: 4 additions & 7 deletions src/commands/artifacts_cmds/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,10 @@ async function handlerMain(argv: ArtifactsDownloadOptions): Promise<any> {
const filesToDownload = argv.all
? artifacts.map(ar => ar.filename)
: argv.names;
const nameToArtifact = artifacts.reduce(
(dict, artifact) => {
dict[artifact.filename] = artifact;
return dict;
},
{} as { [index: string]: RemoteArtifact; }
);
const nameToArtifact = artifacts.reduce((dict, artifact) => {
dict[artifact.filename] = artifact;
return dict;
}, {} as { [index: string]: RemoteArtifact });

logger.info(`Fetching artifacts for revision: ${revision}`);
for (const name of filesToDownload) {
Expand Down
Loading