Skip to content

Commit 61db9a5

Browse files
authored
add gh workflow
1 parent 4ec5f77 commit 61db9a5

File tree

8 files changed

+138
-5
lines changed

8 files changed

+138
-5
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ __snapshots__
22
coverage
33
dist
44
node_modules
5+
storybook-static

.github/CODE_OF_CONDUCT.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Code of Conduct
2+
3+
This project adheres to the [eBay Code of Conduct](https://github.com/eBay/.github/blob/main/CODE_OF_CONDUCT.md).
4+
By participating in this project you agree to abide by its terms.
5+
6+
- Be friendly and patient.
7+
8+
- Be welcoming: We strive to be a community that welcomes and supports people of all backgrounds and identities. This includes, but is not limited to members of any race, ethnicity, culture, national origin, color, immigration status, social and economic class, educational level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion, and mental and physical ability.
9+
10+
- Be considerate: Your work will be used by other people, and you in turn will depend on the work of others. Any decision you take will affect users and colleagues, and you should take those consequences into account when making decisions. Remember that we’re a world-wide community, so you might not be communicating in someone else’s primary language.
11+
12+
- Be respectful: Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. It’s important to remember that a community where people feel uncomfortable or threatened is not a productive one.
13+
14+
- Be careful in the words that we choose: we are a community of professionals, and we conduct ourselves professionally.
15+
16+
- Be kind to others. Do not insult or put down other participants. Harassment and other exclusionary behavior aren’t acceptable.
17+
18+
- Try to understand why we disagree: Disagreements, both social and technical, happen all the time. It is important that we resolve disagreements and differing views constructively.
19+
20+
- Remember that we’re different. The strength of our community comes from its diversity, people from a wide range of backgrounds. Different people have different perspectives on issues. Being unable to understand why someone holds a viewpoint doesn’t mean that they’re wrong. Don’t forget that it is human to err and blaming each other doesn’t get us anywhere. Instead, focus on helping to resolve issues and learning from mistakes.
21+
22+
Please visit https://github.com/eBay/.github/blob/main/CODE_OF_CONDUCT.md for the full code of conduct.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!--- Provide a general summary of your changes in the Title above -->
2+
3+
## Description
4+
5+
<!--- Describe your changes in detail -->
6+
7+
<!--- Why is this change required? What problem does it solve? -->
8+
9+
<!--- If it fixes an open issue, please link to the issue here. -->
10+
11+
## Checklist:
12+
13+
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
14+
15+
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
16+
17+
- [ ] I have signed (or will sign) the CLA.
18+
- [ ] I have updated/added documentation affected by my changes.
19+
- [ ] I have added tests to cover my changes.

.github/workflows/ci.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
push:
7+
branches: [main]
8+
9+
concurrency:
10+
group: "${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}"
11+
cancel-in-progress: true
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
# Give the default GITHUB_TOKEN write permission to commit and push the
18+
# added or changed files to the repository.
19+
contents: write
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.head_ref }}
25+
- name: Use node
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 20
29+
cache: npm
30+
- name: Install dependencies
31+
run: npm ci
32+
- name: Build
33+
run: npm run @ci:build
34+
- name: Lint Code
35+
run: npm run @ci:lint
36+
test:
37+
runs-on: ubuntu-latest
38+
name: "test: node@${{ matrix.node }}"
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
node: [20, 22]
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
- name: Use node@${{ matrix.node }}
47+
uses: actions/setup-node@v4
48+
with:
49+
node-version: ${{ matrix.node }}
50+
cache: npm
51+
- name: Install dependencies
52+
run: npm ci
53+
- name: Run tests
54+
run: npm run @ci:test
55+
- name: Report code coverage
56+
uses: codecov/codecov-action@v4
57+
with:
58+
token: ${{ secrets.CODECOV_TOKEN }}
59+
release:
60+
runs-on: ubuntu-latest
61+
needs: [build, test]
62+
if: "${{ github.repository_owner == 'marko-js' && github.event_name == 'push' }}"
63+
steps:
64+
- name: Checkout code
65+
uses: actions/checkout@v4
66+
- name: Setup node
67+
uses: actions/setup-node@v4
68+
with:
69+
node-version: 20
70+
cache: npm
71+
- name: Install dependencies
72+
run: npm ci
73+
- name: Release
74+
id: changesets
75+
uses: changesets/action@v1
76+
with:
77+
version: npm run @ci:version
78+
publish: npm run @ci:release
79+
commit: "[ci] release"
80+
title: "[ci] release"
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
84+
- name: Deploy Storybook
85+
run: |
86+
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
87+
npm run @ci:deploy-storybook
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ coverage
55
dist
66
node_modules
77
package-lock.json
8+
storybook-static

.stylelintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ __snapshots__
22
coverage
33
dist
44
node_modules
5+
storybook-static

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,19 @@
1414
],
1515
"scripts": {
1616
"@ci:build": "npm run build",
17+
"@ci:deploy-storybook": "storybook build -o storybook-static && gh-pages --nojekyll -d storybook-static -u 'github-actions-bot <[email protected]>'",
1718
"@ci:lint": "npm run lint",
19+
"@ci:release": "npm run build && changeset publish && npm run deploy-storybook",
1820
"@ci:test": "vitest run --coverage --no-color",
21+
"@ci:version": "changeset version && npm i --package-lock-only",
1922
"build": "mtc",
20-
"build-storybook": "storybook build -o ./storybook-static",
2123
"change": "changeset add",
2224
"clean": "rm -rf coverage dist node_modules/.{cache,vite,vitest}",
23-
"deploy-storybook": "npm run build-storybook && gh-pages -d storybook-static",
2425
"format": "eslint --format unix --fix .; stylelint --formatter unix --fix '**/*.css'; prettier . --write --log-level=warn",
2526
"lint": "mtc && eslint --format unix . && stylelint --formatter unix '**/*.css' && prettier . --check --log-level=warn",
2627
"prepare": "husky",
27-
"release": "npm run build && changeset publish",
2828
"storybook": "storybook dev",
29-
"test": "vitest",
30-
"version": "changeset version && npm i --package-lock-only"
29+
"test": "vitest"
3130
},
3231
"devDependencies": {
3332
"@changesets/changelog-github": "^0.5.0",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
it("works");

0 commit comments

Comments
 (0)