Skip to content

Commit

Permalink
github pipeline for docs and tests added
Browse files Browse the repository at this point in the history
  • Loading branch information
infinite-system committed Aug 11, 2024
1 parent 0be1acd commit 2fbc01d
Show file tree
Hide file tree
Showing 9 changed files with 1,955 additions and 165 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: ci
on: [ push ]

jobs:
build:
name: vitest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: yarn install
uses: borales/actions-yarn@v4
with:
cmd: install # will run `yarn install` command
# dir: 'ivue'
- name: vitest ivue
uses: borales/actions-yarn@v4
with:
cmd: test # will run `yarn test` command
# dir: 'ivue'
docs-deploy:
name: deploy docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Setup git
run: |
git config user.name "Evgeny Kalashnikov" && git config user.email "[email protected]"
- name: yarn install
uses: borales/actions-yarn@v4
with:
cmd: install # will run `yarn install` command
dir: 'docs'
- name: deploy docs
uses: borales/actions-yarn@v4
with:
cmd: deploy # will run `yarn deploy` command
dir: 'docs'
# docs-deploy:
# name: Deploying to gh-pages
# runs-on: ubuntu-latest
# steps:
# - name: Setup Node.js for use with actions
# uses: actions/setup-node@v2
# with:
# version: 12.x
# - name: Checkout branch
# uses: actions/checkout@v2
#
# - name: Clean install dependencies
# run: npm ci
#
# - name: Run deploy script
# run: |
# git config user.name "Evgeny Kalashnikov" && git config user.email "[email protected]"
#
# cmd: deploy
166 changes: 1 addition & 165 deletions README.md

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

/docs/.vitepress/cache
9 changes: 9 additions & 0 deletions docs/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'vitepress'

// https://vitepress.vuejs.org/config/app-configs
export default defineConfig({
themeConfig: {
siteTitle: 'ivue'
},
base: '/ivue/'
})
7 changes: 7 additions & 0 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script setup>

const a = 'Coming soon'
</script>
# Coming soon


24 changes: 24 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "vitepress-project",
"private": true,
"type": "module",
"scripts": {
"dev": "vitepress dev docs",
"build": "vitepress build docs",
"serve": "vitepress serve docs",
"deploy": "node scripts/gh-pages-deploy.js"
},
"devDependencies": {
"cpy-cli": "^4.2.0",
"execa": "^8.0.0",
"vitepress": "^1.0.0",
"vue": "3.2.44"
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search"
]
}
}
}
34 changes: 34 additions & 0 deletions docs/scripts/gh-pages-deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { execa } from 'execa'
// import fs from "fs"

(async () => {
try {
var datetime = new Date();

// this will save potential changes that might get lost if you didn't commit them
await execa("git", ["stash", "push", "-m", "before deploy on " + datetime]);
await execa("git", ["checkout", "--orphan", "gh-pages"]);

console.log("Building...")

await execa("yarn", ["run", "build"])
// Understand if it's dist or build folder
const folderName = "docs/.vitepress/dist"
await execa("git", ["--work-tree", folderName, "add", "--all"])
await execa("git", ["--work-tree", folderName, "commit", "-m", "gh-pages"])

console.log("Pushing to gh-pages...")

await execa("git", ["push", "origin", "HEAD:gh-pages", "--force"])
await execa("rm", ["-r", folderName])
await execa("git", ["fetch"])
await execa("git", ["checkout", "-f", "main"])
await execa("git", ["branch", "-D", "gh-pages"])

console.log("Successfully deployed")
} catch (e) {

console.log(e.message)
process.exit(1)
}
})();
20 changes: 20 additions & 0 deletions docs/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'


// https://vitejs.dev/config/
export default defineConfig({

resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
fs: {
allow: ['..']
}
},

})
Loading

0 comments on commit 2fbc01d

Please sign in to comment.