Skip to content

Commit

Permalink
Fix CI (#12)
Browse files Browse the repository at this point in the history
* Update CI workflow to use yarn instead of npm

* test

* Update CI workflow to use yarn cache and frozen lockfile

* Update test configuration
  • Loading branch information
mhd-hi authored Apr 11, 2024
1 parent 6e17605 commit c7502d6
Show file tree
Hide file tree
Showing 4 changed files with 307 additions and 390 deletions.
23 changes: 10 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: ci
on:
push:
branches: [main]
pull_request:
branches: ['*']

jobs:
test:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -17,23 +19,18 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: 'npm'
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache-dependency-path: 'yarn.lock'

- name: Install dependencies
run: npm ci
run: yarn install --frozen-lockfile

- name: lint
run: npm run lint
run: yarn run lint

- name: Run tests
run: npm test
run: yarn test

- name: Build
run: npm run build

# - name: SonarCloud Scan
# uses: sonarsource/sonarcloud-github-action@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: yarn run build
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"devDependencies": {
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@nestjs/testing": "^10.3.7",
"@swc/cli": "^0.1.65",
"@swc/core": "^1.4.8",
"@types/express": "^4.17.21",
Expand Down Expand Up @@ -77,8 +77,8 @@
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"rootDir": ".",
"testRegex": "test/.*\\.test\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
Expand All @@ -88,4 +88,4 @@
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
}
5 changes: 5 additions & 0 deletions test/test.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('Test', () => {
it('should pass', () => {
expect(1).toBe(1);
});
});
Loading

0 comments on commit c7502d6

Please sign in to comment.