Skip to content

Commit d23f595

Browse files
author
Nir Galon
authored
feat: replace travis-ci with github actions (#149)
* feat: replace travis-ci with github actions * chore: cleanup
1 parent 043886f commit d23f595

File tree

18 files changed

+198
-223
lines changed

18 files changed

+198
-223
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ yo jekyll-starter-kit
3434
* Enable ES2015 features using Babel
3535
* Concatenate and minify JavaScript
3636
* Built-in preview server with BrowserSync
37-
* Automagically create a service worker file
37+
* Automagically create a service worker file for offline caching
3838
* Deploy the project to GitHub pages or Firebase with only one command
39-
* Automagically test your project output on Travis-CI
40-
* Test your project against [lighthouse](https://github.com/GoogleChrome/lighthouse) and fail Travis-CI with score below 80
39+
* Automagically test your project output on GitHub Actions with [html-proofer](https://github.com/gjtorikian/html-proofer)
40+
* Test your project against [lighthouse](https://github.com/GoogleChrome/lighthouse) and fail GitHub Action with score below 80/100
4141
* Awesome README file with all instructions and badges - like the pros :wink:
4242

4343
## Trouble with running the project?

__tests__/app.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require("path");
33
const assert = require("yeoman-assert");
44
const helpers = require("yeoman-test");
55

6-
describe("generator-html-css-es2015-sw-travis", () => {
6+
describe("generator-html-css-es2015-sw-githubactions", () => {
77
beforeAll(() => {
88
return helpers
99
.run(path.join(__dirname, "../generators/app"))
@@ -16,7 +16,7 @@ describe("generator-html-css-es2015-sw-travis", () => {
1616
css: "stylesheets",
1717
es: true,
1818
sw: true,
19-
travis: true,
19+
githubactions: true,
2020
deploy: "github",
2121
})
2222
.toPromise();
@@ -44,7 +44,7 @@ describe("generator-html-css-es2015-sw-travis", () => {
4444
"package.json",
4545
"README.md",
4646
"robots.txt",
47-
".travis.yml",
47+
".github/workflows/continuous-integration.yml",
4848
]);
4949
});
5050

@@ -84,7 +84,7 @@ describe("generator-html-css-es2015-sw-travis", () => {
8484
});
8585
});
8686

87-
describe("generator-pug-scss-travis", () => {
87+
describe("generator-pug-scss-githubactions", () => {
8888
beforeAll(() => {
8989
return helpers
9090
.run(path.join(__dirname, "../generators/app"))
@@ -97,7 +97,7 @@ describe("generator-pug-scss-travis", () => {
9797
css: "scss",
9898
es: false,
9999
sw: false,
100-
travis: true,
100+
githubactions: true,
101101
deploy: "firebase",
102102
})
103103
.toPromise();
@@ -107,7 +107,7 @@ describe("generator-pug-scss-travis", () => {
107107
assert.file([
108108
"_includes-pug",
109109
"scss",
110-
".travis.yml",
110+
".github",
111111
".firebaserc",
112112
"firebase.json",
113113
]);
@@ -123,7 +123,7 @@ describe("generator-pug-scss-travis", () => {
123123
});
124124
});
125125

126-
describe("generator-pug-sass-no_travis", () => {
126+
describe("generator-pug-sass-no_githubactions", () => {
127127
beforeAll(() => {
128128
return helpers
129129
.run(path.join(__dirname, "../generators/app"))
@@ -136,7 +136,7 @@ describe("generator-pug-sass-no_travis", () => {
136136
css: "sass",
137137
es: true,
138138
sw: true,
139-
travis: false,
139+
githubactions: false,
140140
deploy: "firebase",
141141
})
142142
.toPromise();
@@ -147,7 +147,7 @@ describe("generator-pug-sass-no_travis", () => {
147147
});
148148

149149
it("not created files", () => {
150-
assert.noFile(["css", "scss", ".travis.yml"]);
150+
assert.noFile(["css", "scss", ".github"]);
151151
});
152152

153153
it("humans.txt content", () => {

generators/app/index.js

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ module.exports = class extends Generator {
101101
{
102102
// Prompts the user to decide if he want to validate his build.
103103
type: "confirm",
104-
name: "travis",
104+
name: "githubactions",
105105
message:
106-
"(9/10) Would you like to enable HTMLProofer to validate your Jekyll output on Travis-CI?",
106+
"(9/10) Would you like to enable HTMLProofer and lighthouse to validate your Jekyll output on GitHub Actions?",
107107
default: true,
108108
},
109109
{
@@ -144,7 +144,7 @@ module.exports = class extends Generator {
144144
this.includeSass = hasFeature(props.css, "sass");
145145
this.includeScss = hasFeature(props.css, "scss");
146146
this.includeSW = props.sw;
147-
this.includeTravis = props.travis;
147+
this.includeGitHubActions = props.githubactions;
148148
this.includeES = props.es;
149149
this.includeGithub = hasFeature(props.deploy, "github");
150150
this.includeFirebase = hasFeature(props.deploy, "firebase");
@@ -234,7 +234,7 @@ module.exports = class extends Generator {
234234
projectName: this.projectName,
235235
githubUsername: this.githubUsername,
236236
projectDescription: this.projectDescription,
237-
includeTravis: this.includeTravis,
237+
includeGitHubActions: this.includeGitHubActions,
238238
includeFirebase: this.includeFirebase,
239239
}
240240
);
@@ -268,7 +268,7 @@ module.exports = class extends Generator {
268268
includeSW: this.includeSW,
269269
includeGithub: this.includeGithub,
270270
includeFirebase: this.includeFirebase,
271-
includeTravis: this.includeTravis,
271+
includeGitHubActions: this.includeGitHubActions,
272272
}
273273
);
274274

@@ -381,17 +381,19 @@ module.exports = class extends Generator {
381381
}
382382
);
383383

384-
// Copy travis file according to user choice.
385-
if (this.includeTravis) {
384+
// Copy github actions file according to user choice.
385+
if (this.includeGitHubActions) {
386386
this.fs.copy(
387-
this.templatePath("my-awesome-site/travis"),
388-
this.destinationPath(".travis.yml")
387+
this.templatePath(
388+
"my-awesome-site/github/workflows/continuous-integration.yml"
389+
),
390+
this.destinationPath(".github/workflows/continuous-integration.yml")
389391
);
390392

391393
// Copy validate checklog file for lighthouse.
392394
this.fs.copy(
393-
this.templatePath("my-awesome-site/validate/checklog"),
394-
this.destinationPath("validate/checklog.js")
395+
this.templatePath("my-awesome-site/lighthouserc.json"),
396+
this.destinationPath("lighthouserc.json")
395397
);
396398
}
397399

@@ -435,13 +437,6 @@ module.exports = class extends Generator {
435437
);
436438
}
437439

438-
console.log(
439-
chalk
440-
.keyword("red")
441-
.bold(
442-
"\n\t- Please visit https://travis-ci.org and enable it for this project."
443-
)
444-
);
445440
console.log(
446441
chalk
447442
.keyword("red")

generators/app/templates/my-awesome-site/README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# <%= projectName %>
22

3-
[![license][license-image]][license-url] <% if (includeTravis) { -%>[![Build Status][travis-image]][travis-url] <% } -%>[![Dependency Status][dependencyci-image]][dependencyci-url]
3+
[![license][license-image]][license-url] <% if (includeGitHubActions) { -%>![Continuous Integration](https://github.com/<%= githubUsername %>/<%= projectName %>/workflows/Continuous%20Integration/badge.svg) <% } -%>[![Dependency Status][dependencyci-image]][dependencyci-url]
44

55
> <%= projectDescription %>
66
@@ -37,7 +37,7 @@ You can easily deploy your site build with the command
3737
$ npm run deploy
3838
```
3939

40-
<% if (includeTravis) { -%>
40+
<% if (includeGitHubActions) { -%>
4141
## Tests
4242

4343
If you want to run the tests on your local machine please install `gem install html-proofer`. And then run the tests using
@@ -48,9 +48,5 @@ $ htmlproofer ./_site
4848

4949
[license-image]: https://img.shields.io/badge/license-ISC-blue.svg
5050
[license-url]: https://github.com/<%= githubUsername %>/<%= projectName %>/blob/master/LICENSE
51-
<% if (includeTravis) { -%>
52-
[travis-image]: https://travis-ci.org/<%= githubUsername %>/<%= projectName %>.svg?branch=master
53-
[travis-url]: https://travis-ci.org/<%= githubUsername %>/<%= projectName %>
54-
<% } -%>
5551
[dependencyci-image]: https://dependencyci.com/github/<%= githubUsername %>/<%= projectName %>/badge
5652
[dependencyci-url]: https://dependencyci.com/github/<%= githubUsername %>/<%= projectName %>

generators/app/templates/my-awesome-site/_includes/footer.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ <h2 class="footer-heading">{{ site.title }}</h2>
1919
<a href="https://github.com/{{ site.github_username }}">
2020
<span class="icon icon--github">
2121
<svg viewBox="0 0 16 16">
22-
<path fill="#828282" d="M7.999,0.431c-4.285,0-7.76,3.474-7.76,7.761 c0,3.428,2.223,6.337,5.307,7.363c0.388,0.071,0.53-0.168,0.53-0.374c0-0.184-0.007-0.672-0.01-1.32 c-2.159,0.469-2.614-1.04-2.614-1.04c-0.353-0.896-0.862-1.135-0.862-1.135c-0.705-0.481,0.053-0.472,0.053-0.472 c0.779,0.055,1.189,0.8,1.189,0.8c0.692,1.186,1.816,0.843,2.258,0.645c0.071-0.502,0.271-0.843,0.493-1.037 C4.86,11.425,3.049,10.76,3.049,7.786c0-0.847,0.302-1.54,0.799-2.082C3.768,5.507,3.501,4.718,3.924,3.65 c0,0,0.652-0.209,2.134,0.796C6.677,4.273,7.34,4.187,8,4.184c0.659,0.003,1.323,0.089,1.943,0.261 c1.482-1.004,2.132-0.796,2.132-0.796c0.423,1.068,0.157,1.857,0.077,2.054c0.497,0.542,0.798,1.235,0.798,2.082 c0,2.981-1.814,3.637-3.543,3.829c0.279,0.24,0.527,0.713,0.527,1.437c0,1.037-0.01,1.874-0.01,2.129 c0,0.208,0.14,0.449,0.534,0.373c3.081-1.028,5.302-3.935,5.302-7.362C15.76,3.906,12.285,0.431,7.999,0.431z"/>
22+
<path fill="#757474" d="M7.999,0.431c-4.285,0-7.76,3.474-7.76,7.761 c0,3.428,2.223,6.337,5.307,7.363c0.388,0.071,0.53-0.168,0.53-0.374c0-0.184-0.007-0.672-0.01-1.32 c-2.159,0.469-2.614-1.04-2.614-1.04c-0.353-0.896-0.862-1.135-0.862-1.135c-0.705-0.481,0.053-0.472,0.053-0.472 c0.779,0.055,1.189,0.8,1.189,0.8c0.692,1.186,1.816,0.843,2.258,0.645c0.071-0.502,0.271-0.843,0.493-1.037 C4.86,11.425,3.049,10.76,3.049,7.786c0-0.847,0.302-1.54,0.799-2.082C3.768,5.507,3.501,4.718,3.924,3.65 c0,0,0.652-0.209,2.134,0.796C6.677,4.273,7.34,4.187,8,4.184c0.659,0.003,1.323,0.089,1.943,0.261 c1.482-1.004,2.132-0.796,2.132-0.796c0.423,1.068,0.157,1.857,0.077,2.054c0.497,0.542,0.798,1.235,0.798,2.082 c0,2.981-1.814,3.637-3.543,3.829c0.279,0.24,0.527,0.713,0.527,1.437c0,1.037-0.01,1.874-0.01,2.129 c0,0.208,0.14,0.449,0.534,0.373c3.081-1.028,5.302-3.935,5.302-7.362C15.76,3.906,12.285,0.431,7.999,0.431z"/>
2323
</svg>
2424
</span>
2525

@@ -33,7 +33,7 @@ <h2 class="footer-heading">{{ site.title }}</h2>
3333
<a href="https://twitter.com/{{ site.twitter_username }}">
3434
<span class="icon icon--twitter">
3535
<svg viewBox="0 0 16 16">
36-
<path fill="#828282" d="M15.969,3.058c-0.586,0.26-1.217,0.436-1.878,0.515c0.675-0.405,1.194-1.045,1.438-1.809
36+
<path fill="#757474" d="M15.969,3.058c-0.586,0.26-1.217,0.436-1.878,0.515c0.675-0.405,1.194-1.045,1.438-1.809
3737
c-0.632,0.375-1.332,0.647-2.076,0.793c-0.596-0.636-1.446-1.033-2.387-1.033c-1.806,0-3.27,1.464-3.27,3.27 c0,0.256,0.029,0.506,0.085,0.745C5.163,5.404,2.753,4.102,1.14,2.124C0.859,2.607,0.698,3.168,0.698,3.767 c0,1.134,0.577,2.135,1.455,2.722C1.616,6.472,1.112,6.325,0.671,6.08c0,0.014,0,0.027,0,0.041c0,1.584,1.127,2.906,2.623,3.206 C3.02,9.402,2.731,9.442,2.433,9.442c-0.211,0-0.416-0.021-0.615-0.059c0.416,1.299,1.624,2.245,3.055,2.271 c-1.119,0.877-2.529,1.4-4.061,1.4c-0.264,0-0.524-0.015-0.78-0.046c1.447,0.928,3.166,1.469,5.013,1.469 c6.015,0,9.304-4.983,9.304-9.304c0-0.142-0.003-0.283-0.009-0.423C14.976,4.29,15.531,3.714,15.969,3.058z"/>
3838
</svg>
3939
</span>

generators/app/templates/my-awesome-site/_includes/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<a class="site-title" href="/{{ site.baseurl }}">{{ site.title }}</a>
77

88
<nav class="site-nav">
9-
<a href="" class="menu-icon">
9+
<a href="./" class="menu-icon">
1010
<svg viewBox="0 0 18 15">
1111
<path fill="#424242" d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.031C17.335,0,18,0.665,18,1.484L18,1.484z"/>
1212
<path fill="#424242" d="M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0c0-0.82,0.665-1.484,1.484-1.484 h15.031C17.335,6.031,18,6.696,18,7.516L18,7.516z"/>

generators/app/templates/my-awesome-site/css/main.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ h1, h2, h3, h4, h5, h6 {
7373
* Links
7474
*/
7575
a {
76-
color: #2a7ae2;
76+
color: #2873d6;
7777
text-decoration: none;
7878
}
7979
a:visited {
@@ -88,7 +88,7 @@ a:hover {
8888
* Blockquotes
8989
*/
9090
blockquote {
91-
color: #828282;
91+
color: #757474;
9292
border-left: 4px solid #e8e8e8;
9393
padding-left: 15px;
9494
font-size: 18px;
@@ -163,7 +163,7 @@ pre > code {
163163
vertical-align: middle;
164164
}
165165
.icon > svg path {
166-
fill: #828282;
166+
fill: #757474;
167167
}
168168

169169
/**
@@ -262,7 +262,7 @@ pre > code {
262262

263263
.footer-col-wrapper {
264264
font-size: 15px;
265-
color: #828282;
265+
color: #757474;
266266
margin-left: -15px;
267267
}
268268

@@ -327,7 +327,7 @@ pre > code {
327327

328328
.post-meta {
329329
font-size: 14px;
330-
color: #828282;
330+
color: #757474;
331331
}
332332

333333
.post-link {
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Continuous Integration
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- uses: actions/checkout@v2
15+
- name: Set up Ruby 2.6
16+
uses: actions/setup-ruby@v1
17+
with:
18+
ruby-version: 2.6
19+
20+
- name: Setup wesite 🚧
21+
run: |
22+
npm install
23+
bundle install
24+
npm run build
25+
26+
- name: Run HTMLProofer 📚
27+
run: |
28+
gem install html-proofer
29+
htmlproofer _site --check-html --allow-hash-href --empty-alt-ignore --disable-external
30+
31+
- name: Run Lighthouse 💡
32+
uses: treosh/lighthouse-ci-action@v3
33+
with:
34+
configPath: './lighthouserc.json'

0 commit comments

Comments
 (0)