removed bun, because it did not lead to a performance boost #134
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: | |
name: Organize Imports, Lint and Format | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm install | |
- name: Organize imports | |
run: npm run organizeImports | |
- name: Fix eslint issues | |
run: npm run lint:fix | |
- name: Check all eslint issues fixed | |
run: npm run lint | |
- name: Format | |
run: npm 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 }} | |
test: | |
name: Testing with Jest | |
runs-on: ubuntu-latest | |
needs: organizeImports_lint_format | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm install | |
- name: Run tests | |
run: npm test | |
sonar: | |
name: SonarCloud analysis | |
runs-on: ubuntu-latest | |
needs: 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 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: npm 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 |