diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..9265e79 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,78 @@ +name: tests + +on: + push: + branches: + - master + - develop + pull_request: + +jobs: + build: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + - name: Get npm cache directory + id: npm-cache-dir + shell: bash + run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} + - uses: actions/cache@v4 + id: npm-cache + with: + path: | + ${{ steps.npm-cache-dir.outputs.dir }} + **/node_modules + .eslintcache + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-node- + - name: Install modules + run: npm install --no-audit --no-fund + - name: Build + run: npm run build + - name: Demo build + run: npm run demo:build + + code_quality: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + - name: Get npm cache directory + id: npm-cache-dir + shell: bash + run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} + - uses: actions/cache@v4 + id: npm-cache + with: + path: | + ${{ steps.npm-cache-dir.outputs.dir }} + **/node_modules + .eslintcache + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-node- + - name: Install modules + run: npm install --no-audit --no-fund + - name: Run code quality tests + run: npm run lint + + export_size: + runs-on: macos-latest + if: github.event_name == 'pull_request' + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: '0' + - uses: titouanmathis/export-size-action@main + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + build_script: npm run build-for-export-size + paths: dist + bundler: esbuild + node-version: '18'