Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI and CD pipelines with GitHub Actions #34

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,12 @@ jobs:

- name: 🏗️ Build the project
run: npm run build:ts

- name: 🧪 Run tests
run: npm test

- name: 🧹 Lint the code
run: npm run lint

- name: 📊 Generate code coverage reports
run: npm run coverage
12 changes: 10 additions & 2 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,18 @@ jobs:
npm install -D dmg-license -f
npm install electron-builder -g


- name: ⚙️ Install additional tools (linux , win)
if: matrix.os != 'macOS-latest'
run: npm install electron-builder -g

- name: 🏗️ Build the project
run: npm run build
run: npm run build

- name: 🧪 Run tests
run: npm test

- name: 🧹 Lint the code
run: npm run lint

- name: 📊 Generate code coverage reports
run: npm run coverage
93 changes: 66 additions & 27 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,20 @@ jobs:
- name: Install electron-builder
run: npm i electron-builder -g

- name: 🧪 Run tests
run: npm test

- name: 🧹 Lint the code
run: npm run lint

- name: 📊 Generate code coverage reports
run: npm run coverage

- name: Publish
env:
GH_TOKEN: ${{ secrets.TOKEN }}
run: npm run publish:linux

publish_on_win:
runs-on: windows-latest
steps:
Expand All @@ -47,46 +57,75 @@ jobs:
- name: Install electron-builder
run: npm i electron-builder -g

- name: 🧪 Run tests
run: npm test

- name: 🧹 Lint the code
run: npm run lint

- name: 📊 Generate code coverage reports
run: npm run coverage

- name: Publish
env:
GH_TOKEN: ${{ secrets.TOKEN }}
run: npm run publish:win

publish_on_macos:
runs-on: macOS-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Node v20
uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
- name: Install Node v20
uses: actions/setup-node@v3
with:
node-version: 20
cache: npm

- name: Install Python
run: brew install [email protected]
- name: Install Python
run: brew install [email protected]

- name: "Install Python setuptools"
run: brew install python-setuptools
- name: "Install Python setuptools"
run: brew install python-setuptools

- name: Install Build Tools
run: |
brew install libtool automake autoconf
sudo xcode-select --reset
- name: Install Build Tools
run: |
brew install libtool automake autoconf
sudo xcode-select --reset

- name: Update node-gyp
run: npm install -g node-gyp
- name: Update node-gyp
run: npm install -g node-gyp

- name: Install dependencies
run: npm install
- name: Install dependencies
run: npm install

- name: Install dmglicense
run: npm install dmg-license -f

- name: Install electron-builder
run: npm i electron-builder -g

- name: 🧪 Run tests
run: npm test

- name: Install dmglicense
run: npm install dmg-license -f
- name: 🧹 Lint the code
run: npm run lint

- name: Install electron-builder
run: npm i electron-builder -g
- name: 📊 Generate code coverage reports
run: npm run coverage

- name: Publish
env:
GH_TOKEN: ${{ secrets.TOKEN }}
run: npm run publish:mac

deploy_to_staging:
runs-on: ubuntu-latest
needs: [publish_on_linux, publish_on_win, publish_on_macos]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Publish
env:
GH_TOKEN: ${{ secrets.TOKEN }}
run: npm run publish:mac
- name: Deploy to staging environment
run: echo "Deploying to staging environment..."
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- [📝 تغییرات](#-تغییرات)
- [🛡️ حریم خصوصی](#️-حریم-خصوصی)
- [🛠 همکاری](#-همکاری)
- [🚀 CI/CD Pipelines](#-cicd-pipelines)

## 📥 دانلود

Expand All @@ -57,4 +58,14 @@

[CONTRIBUTING.md](./CONTRIBUTING.md)

## 🚀 CI/CD Pipelines

This project uses GitHub Actions for continuous integration (CI) and continuous deployment (CD). The CI/CD pipelines are configured in the following workflow files:

- `.github/workflows/build.yml`: This workflow runs on `push` events, excluding changes to `.yml` files and files in the `.github` directory. It includes steps for checking out the repository, setting up Node.js, caching dependencies, installing dependencies, building the project, running tests, linting the code, and generating code coverage reports.

- `.github/workflows/pull.yml`: This workflow runs on `pull_request` events, excluding changes to `.md` files and files in the `.github` directory. It includes steps for checking out the repository, setting up Node.js, caching dependencies, installing dependencies, building the project, running tests, linting the code, and generating code coverage reports.

- `.github/workflows/release.yml`: This workflow runs on `push` events to the `main` branch, excluding changes to `README.md`, `README-*.md`, and files in the `.github/ISSUE_TEMPLATE` directory. It includes steps for checking out the repository, setting up Node.js, caching dependencies, installing dependencies, building the project, running tests, linting the code, generating code coverage reports, and deploying the project to a staging environment. Additionally, it includes steps for publishing the built project to GitHub for Linux, Windows, and macOS.

درحال تکمیل فایل توضیحات....