followed set name convention #156
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- '*' | |
workflow_dispatch: | |
jobs: | |
organizeImports_lint_format_test: | |
name: Organize Imports, Lint and Format | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: bun install | |
- name: Organize imports | |
run: bun run organizeImports | |
- name: Fix eslint issues | |
run: bun run lint:fix | |
- name: Check all eslint issues fixed | |
run: bun run lint | |
- name: Format | |
run: bun run format | |
- name: Commit changes | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email github-actions[bot]@users.noreply.github.com | |
git commit -am "organized imports, fixed eslint issues, formatted" || true | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
- name: Run tests with Jest | |
run: npm test | |
sonar: | |
name: SonarCloud analysis | |
runs-on: ubuntu-latest | |
needs: organizeImports_lint_format_test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Fetch changed ts/tsx/js/ci.yml files | |
id: changedFiles | |
uses: Ana06/get-changed-files@v2.2.0 | |
with: | |
filter: | | |
*.ts | |
*.tsx | |
*.js | |
ci.yml | |
- name: Check sonar trigger | |
run: | | |
if [ -n "${{ steps.changedFiles.outputs.all }}" ]; then | |
echo "TRIGGER_SONAR=true" >> "$GITHUB_ENV" | |
else | |
echo "TRIGGER_SONAR=false" >> "$GITHUB_ENV" | |
fi | |
- name: Setup bun | |
uses: oven-sh/setup-bun@v1 | |
if: env.TRIGGER_SONAR == 'true' | |
with: | |
bun-version: latest | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
if: env.TRIGGER_SONAR == 'true' | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
if: env.TRIGGER_SONAR == 'true' | |
run: bun install | |
- name: Generate Test Coverage Report | |
if: env.TRIGGER_SONAR == 'true' | |
run: npm run test:coverage | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
if: env.TRIGGER_SONAR == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
with: | |
args: > | |
-Dsonar.organization=raboro | |
-Dsonar.projectKey=Raboro_finance-tracker | |
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info |