Skip to content

Commit

Permalink
Merge pull request #1 from oanaOM/add-gh-actions
Browse files Browse the repository at this point in the history
feat: add github actions
  • Loading branch information
oanaOM authored Dec 20, 2023
2 parents 8bd3ffe + 1554361 commit 488c5d1
Show file tree
Hide file tree
Showing 18 changed files with 5,905 additions and 2,527 deletions.
36 changes: 36 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
env: {
node: true,
es2022: true,
browser: true,
},
extends: ["eslint:recommended", "plugin:astro/recommended"],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
rules: {},
overrides: [
{
files: ["*.astro"],
parser: "astro-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
extraFileExtensions: [".astro"],
},
rules: {},
},
{
files: ["*.ts"],
parser: "@typescript-eslint/parser",
extends: ["plugin:@typescript-eslint/recommended"],
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", destructuredArrayIgnorePattern: "^_" },
],
"@typescript-eslint/no-non-null-assertion": "off",
},
},
],
};
33 changes: 0 additions & 33 deletions .eslintrc.js

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build

on:
push:
branches:
- master
pull_request:

jobs:
build:
timeout-minutes: 60
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18.x"

- name: Install pnpm
uses: pnpm/[email protected]
id: pnpm-install
with:
version: 8
run_install: false

- name: Install dependencies
run: pnpm install

- name: Run unit tests
run: pnpm run build
37 changes: 37 additions & 0 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Cypress Tests
on:
push:
branches:
- main
pull_request:
jobs:
cypress-run:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/[email protected]
id: pnpm-install
with:
version: 8
run_install: false

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm

- name: Install dependencies
run: pnpm install

# Install NPM dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
uses: cypress-io/github-action@v6
with:
build: pnpm run build
start: pnpm start
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Tests

on:
push:
branches:
- master
pull_request:

jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"

- name: Install pnpm
uses: pnpm/[email protected]
id: pnpm-install
with:
version: 8
run_install: false

- name: Install dependencies
run: pnpm install

- name: Run unit tests
run: pnpm run test
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@ This is a quick start-up template configured with the following libraries.

All commands are run from the root of the project, from a terminal:

| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `pnpm install` | Installs dependencies |
| `pnpm run dev` | Starts local dev server at `localhost:4321` |
| `pnpm run build` | Build your production site to `./dist/` |
| `pnpm run preview` | Preview your build locally, before deploying |
| `pnpm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `pnpm run astro -- --help` | Get help using the Astro CLI |
| `pnpm run test` | Run unit tests |
| `pnpm run test:e2e` | Run cypress integration tests
| `pnpm run prettier` | Run prettier with default astro recommended prettier set up|
| `pnpm run lint:eslint` | Run lint|

Feel free to use any package manager you feel more confident with.
| Command | Action |
| :------------------------- | :---------------------------------------------------------- |
| `pnpm install` | Installs dependencies |
| `pnpm run dev` | Starts local dev server at `localhost:4321` |
| `pnpm run build` | Build your production site to `./dist/` |
| `pnpm run preview` | Preview your build locally, before deploying |
| `pnpm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `pnpm run astro -- --help` | Get help using the Astro CLI |
| `pnpm run test` | Run unit tests |
| `pnpm run test:e2e` | Run cypress integration tests |
| `pnpm run prettier` | Run prettier with default astro recommended prettier set up |
| `pnpm run lint:eslint` | Run lint |

Feel free to use any package manager you feel more confident with.

---
Made with 💚 for the sake of speed 🚀

Made with 💚 for the sake of speed 🚀
2 changes: 1 addition & 1 deletion cypress/e2e/index.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ it("titles are correct", () => {
const page = cy.visit("http://localhost:4321");

page.get("title").should("have.text", "Astro is awesome!");
page.get("h1").should("have.text", "Hello world from Astro");
page.get("h2").should("have.text", "Hello world from Astro");
});
14 changes: 7 additions & 7 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress"]
},
"include": ["**/*.ts"]
}
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress"]
},
"include": ["**/*.ts"]
}
4 changes: 0 additions & 4 deletions jest.config.json

This file was deleted.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "astro-typescript-template",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
Expand Down Expand Up @@ -36,6 +37,7 @@
"cypress": "^13.6.1",
"eslint": "^8.56.0",
"eslint-plugin-astro": "^0.31.0",
"jsdom": "^23.0.1",
"prettier": "^3.1.1",
"prettier-plugin-astro": "^0.12.2",
"vitest": "^1.1.0"
Expand Down
Loading

0 comments on commit 488c5d1

Please sign in to comment.