Skip to content

Commit bf2eac9

Browse files
authored
Merge pull request frontity#244 from frontity/github-actions
Add GitHub Actions
2 parents 514b9fa + 8a88681 commit bf2eac9

File tree

17 files changed

+3481
-2293
lines changed

17 files changed

+3481
-2293
lines changed

.github/workflows/budget.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[
2+
{
3+
"path": "/*",
4+
"resourceSizes": [
5+
{
6+
"resourceType": "script",
7+
"budget": 100
8+
}
9+
]
10+
}
11+
]

.github/workflows/e2e-tests.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: e2e tests
2+
3+
on: [push]
4+
5+
jobs:
6+
e2e-tests:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
ci_node_total: [3]
12+
ci_node_index: ["all", "module", "es5"]
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v1
17+
18+
- name: Setup npm cache
19+
uses: actions/cache@v1
20+
with:
21+
path: ~/.npm
22+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
23+
restore-keys: |
24+
${{ runner.os }}-node-
25+
26+
- name: Install dependencies (root)
27+
run: npm ci
28+
env:
29+
CI: true
30+
31+
- name: Run e2e tests
32+
uses: cypress-io/github-action@v1
33+
with:
34+
start: npm run e2e:prod:${{ matrix.ci_node_index }}
35+
wait-on: "http://localhost:3001"
36+
wait-on-timeout: 180
37+
env: HEADLESS=true
38+
working-directory: e2e
39+
config: video=true,screenshotOnRunFailure=true
40+
41+
- name: Upload screenshots on failure
42+
uses: actions/upload-artifact@v1
43+
if: failure()
44+
with:
45+
name: cypress-screenshots
46+
path: e2e/screenshots
47+
48+
- name: Upload videos
49+
uses: actions/upload-artifact@v1
50+
if: always()
51+
with:
52+
name: cypress-videos
53+
path: e2e/videos

.github/workflows/lighthouse.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: lighthouse
2+
3+
on: [push]
4+
5+
jobs:
6+
deploy:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v1
12+
13+
- name: Setup Node
14+
uses: actions/setup-node@v1
15+
with:
16+
node-version: 12
17+
18+
- name: Setup npm cache
19+
uses: actions/cache@v1
20+
with:
21+
path: ~/.npm
22+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
23+
restore-keys: |
24+
${{ runner.os }}-node-
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Deploy to now
30+
run: npx lerna run now --parallel
31+
env:
32+
NOW_TOKEN: ${{ secrets.NOW_TOKEN }}
33+
34+
lighthouse:
35+
runs-on: ubuntu-latest
36+
needs: deploy
37+
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v1
41+
42+
- name: Audit URLs using Lighthouse
43+
uses: treosh/lighthouse-ci-action@v2
44+
with:
45+
runs: 3
46+
temporaryPublicStorage: true
47+
configPath: ./.github/workflows/lighthouserc.json
48+
budgetPath: ./.github/workflows/budget.json
49+
urls: |
50+
https://mars-theme-frontity.worona.now.sh/
51+
https://mars-theme-frontity.worona.now.sh/2016/the-beauties-of-gullfoss/
52+
env:
53+
LHCI_BUILD_CONTEXT__CURRENT_HASH: ${{ github.sha }}
54+
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
55+
56+
- name: Save results
57+
uses: actions/upload-artifact@v1
58+
with:
59+
name: lighthouse-results
60+
path: ".lighthouseci"

.github/workflows/lighthouserc.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"ci": {
3+
"assert": {
4+
"assertions": {
5+
"categories:performance": ["error", { "minScore": 0.99 }],
6+
"categories:accessibility": ["error", { "minScore": 1 }],
7+
"categories:best-practices": ["error", { "minScore": 1 }],
8+
"categories:seo": ["error", { "minScore": 0.96 }]
9+
}
10+
}
11+
}
12+
}

.github/workflows/unit-tests.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: unit tests
2+
3+
on: [push]
4+
5+
jobs:
6+
unit-tests:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
node-version: [8.x, 10.x, 12.x]
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v1
16+
17+
- name: Setup Node ${{ matrix.node-version }}
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
22+
- name: Setup npm cache
23+
uses: actions/cache@v1
24+
with:
25+
path: ~/.npm
26+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
27+
restore-keys: |
28+
${{ runner.os }}-node-
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
env:
33+
CI: true
34+
35+
- name: Run unit tests
36+
run: npm run test:ci
37+
env:
38+
CI: true

.huskyrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"hooks": {
3-
"pre-commit": "lint-staged",
4-
"pre-push": "npm run test:all"
3+
"pre-commit": "lint-staged"
54
}
65
}

.travis.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

cypress.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

e2e/cypress.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"integrationFolder": "integration",
3+
"fixturesFolder": "fixtures",
4+
"pluginsFile": "plugins/index.js",
5+
"screenshotsFolder": "screenshots",
6+
"supportFile": "support/index.js",
7+
"videosFolder": "videos",
8+
"video": false,
9+
"screenshotOnRunFailure": false,
10+
"trashAssetsBeforeRuns": false,
11+
"ignoreTestFiles": ["**/__snapshots__/*", "**/__image_snapshots__/*"],
12+
"projectId": "ed7hed"
13+
}

0 commit comments

Comments
 (0)