diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..b9951ea99 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,53 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + # By default, a workflow only runs when a pull_request 's activity type is + # opened , synchronize , or reopened. Adding ready_for_review here ensures + # that CI runs when a PR is marked as not a draft, since we skip CI when a + # PR is draft + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + backend: + runs-on: ubuntu-latest + timeout-minutes: 10 + strategy: + fail-fast: false + defaults: + run: + working-directory: './src/backend' + steps: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + - name: Install deps + run: | + npm ci --ignore-scripts + npm run postinstall + - name: Check types + run: npm run types + + frontend: + runs-on: ubuntu-latest + timeout-minutes: 10 + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + - name: Install deps + run: npm ci + - name: Build translations + run: npm run build:translations + - name: Build Intl polyfills + run: npm run build:intl-polyfills + - name: Check types + run: npm run types diff --git a/package.json b/package.json index 47210af1c..97f37b8b8 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "deep-clean": "./scripts/deep-clean.sh", "build:translations": "node ./scripts/build-translations.js ", "build:intl-polyfills": "node ./scripts/build-intl-polyfills.mjs", - "extract-messages": "formatjs extract 'src/frontend/**/*.{ts,tsx}' --ignore='**/*.d.ts' --format crowdin --out-file ./messages/en.json" + "extract-messages": "formatjs extract 'src/frontend/**/*.{ts,tsx}' --ignore='**/*.d.ts' --format crowdin --out-file ./messages/en.json", + "types": "tsc --noEmit" }, "dependencies": { "@bam.tech/react-native-image-resizer": "^3.0.7", diff --git a/src/backend/package.json b/src/backend/package.json index 0e8eba99a..4401636ff 100644 --- a/src/backend/package.json +++ b/src/backend/package.json @@ -7,7 +7,7 @@ "main": "index.js", "scripts": { "build": "node ./scripts/bundle-backend.mjs --entry=index.js --output=index.bundle.js", - "lint": "tsc", + "types": "tsc --noEmit", "postinstall": "patch-package" }, "author": "Digital Democracy", diff --git a/src/backend/tsconfig.json b/src/backend/tsconfig.json index a84cf6d25..4b44d9b33 100644 --- a/src/backend/tsconfig.json +++ b/src/backend/tsconfig.json @@ -7,7 +7,6 @@ "./node_modules/@digidem/types/vendor/*/index.d.ts" ] }, - "resolveJsonModule": true, "allowJs": true, "checkJs": true, "noEmit": true,