Skip to content

Commit

Permalink
refactor: github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Tung-Huynh-Shopmacher committed Aug 8, 2024
1 parent d98d971 commit b615727
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 83 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Audit

on:
workflow_run:
workflows: ["Build"]
types:
- completed

jobs:
audit:
runs-on: ubuntu-latest

defaults:
run:
working-directory: processor

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.9.0'

- name: Run npm audit
run: npm audit

- name: Download code coverage results
uses: actions/download-artifact@v4
with:
name: code-coverage-report

- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}

- name: SonarQube Quality Gate
uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build

on:
push:
branches:
- main
- develop
pull_request:
branches:
- '**'

jobs:
build-processor:
runs-on: ubuntu-latest

defaults:
run:
working-directory: processor

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.9.0'

- name: Install dependencies
run: npm ci

- name: Run ESLint check
run: npm run lint

- name: Run Prettier check
run: npm run prettier:check

- name: Build project
run: npm run build

- name: Run tests
run: npm run test

- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: processor/junit-report.xml
82 changes: 0 additions & 82 deletions .github/workflows/ci.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/testrail.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: TestRail

on:
workflow_run:
workflows: ["Build"]
types:
- completed

jobs:
testrail:
runs-on: ubuntu-latest

steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Download code coverage results
uses: actions/download-artifact@v4
with:
name: code-coverage-report

- name: Upload Test Results to TestRail
env:
TR_INSTANCE: ${{ secrets.TR_INSTANCE }}
TR_PROJECT_NAME: ${{ secrets.TR_PROJECT_NAME }}
TR_USER_EMAIL: ${{ secrets.TR_USER_EMAIL }}
TR_PASSWORD: ${{ secrets.TR_PASSWORD }}
run: |
pip install trcli
trcli -y \
-h "https://$TR_INSTANCE.testrail.io" \
--project "$TR_PROJECT_NAME" \
-u $TR_USER_EMAIL \
-p $TR_PASSWORD \
parse_junit \
--title "Automated Tests - ${{ github.sha }}" \
--run-description ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \
-f "junit-report.xml"
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![GitHub Actions](https://github.com/mollie/commercetools-connector/actions/workflows/ci.yml/badge.svg)](https://github.com/mollie/commercetools-connector/actions/workflows/ci.yml/badge.svg)
[![GitHub Actions](https://github.com/mollie/commercetools-connector/actions/workflows/build.yml/badge.svg)](https://github.com/mollie/commercetools-connector/actions/workflows/build.yml/badge.svg)
[![GitHub Actions](https://github.com/mollie/commercetools-connector/actions/workflows/audit.yml/badge.svg)](https://github.com/mollie/commercetools-connector/actions/workflows/audit.yml/badge.svg)

# 🚀 COMMERCETOOLS MOLLIE CONNECTOR 🚀

Expand Down

0 comments on commit b615727

Please sign in to comment.