diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d5ee9897e4..71243d1588 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -65,34 +65,94 @@ jobs: name: python-code-coverage-report path: coverage.xml - npm-test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-20.04] + npm-setup: + runs-on: ubuntu-latest steps: - name: Checkout github repo uses: actions/checkout@v4 - - name: Set up Node.js ${{ matrix.node-version }} + - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: 18.16.1 + - name: Cache node modules + uses: actions/cache@v4 + env: + cache-name: cache-node-modules + with: + path: webapp/node_modules + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('webapp/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + save-always: true - name: Install dependencies run: npm install working-directory: webapp - - name: Build - run: npm run build - working-directory: webapp - env: - NODE_OPTIONS: --max-old-space-size=8192 - DISABLE_ESLINT_PLUGIN: true + + npm-lint: + needs: npm-setup + runs-on: ubuntu-latest + steps: + - name: Checkout github repo + uses: actions/checkout@v4 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 18.16.1 + - name: Restore node modules + uses: actions/cache@v4 + with: + path: webapp/node_modules + key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('webapp/package-lock.json') }} + save-always: true - name: Lint run: npm run lint working-directory: webapp + + npm-test: + needs: npm-setup + runs-on: ubuntu-latest + steps: + - name: Checkout github repo + uses: actions/checkout@v4 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 18.16.1 + - name: Restore node modules + uses: actions/cache@v4 + with: + path: webapp/node_modules + key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('webapp/package-lock.json') }} + save-always: true - name: Test run: npm run test working-directory: webapp + npm-build: + needs: npm-setup + runs-on: ubuntu-latest + steps: + - name: Checkout github repo + uses: actions/checkout@v4 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 18.16.1 + - name: Restore node modules + uses: actions/cache@v4 + with: + path: webapp/node_modules + key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('webapp/package-lock.json') }} + save-always: true + - name: Build + run: npm run build + working-directory: webapp + env: + NODE_OPTIONS: --max-old-space-size=8192 + DISABLE_ESLINT_PLUGIN: true + sonarcloud: runs-on: ubuntu-20.04 needs: [python-test, npm-test]