|
| 1 | +name: Check "add devextreme-react" for NextJS app |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + nextjs-devextreme-test: |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + TYPESCRIPT: [true, false] |
| 14 | + SRC_DIR: [true, false] |
| 15 | + APP_ROUTER: [true, false] |
| 16 | + NODE: |
| 17 | + - 18 |
| 18 | + OS: |
| 19 | + - ubuntu-latest |
| 20 | + |
| 21 | + runs-on: ${{ matrix.OS }} |
| 22 | + name: Next.js + DevExtreme (TS:${{ matrix.TYPESCRIPT }}, src:${{ matrix.SRC_DIR }}, app-router:${{ matrix.APP_ROUTER }}), node ${{ matrix.NODE }}, ${{ matrix.OS }} |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Get sources |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Set up Node.js |
| 29 | + uses: actions/setup-node@v4 |
| 30 | + with: |
| 31 | + node-version: ${{ matrix.NODE }} |
| 32 | + cache: 'npm' |
| 33 | + |
| 34 | + - name: Extract create-next-app version |
| 35 | + run: | |
| 36 | + NEXT_APP_VERSION=$(node -e "const versions = require('./packages/devextreme-cli/src/utility/latest-versions.js'); console.log(versions['create-next-app'])") |
| 37 | + echo "Using create-next-app version: $NEXT_APP_VERSION" |
| 38 | + echo "NEXT_APP_VERSION=$NEXT_APP_VERSION" >> $GITHUB_ENV |
| 39 | + shell: bash |
| 40 | + |
| 41 | + - name: Create Next.js application |
| 42 | + run: | |
| 43 | + npx create-next-app@${{ env.NEXT_APP_VERSION }} test-nextjs-app \ |
| 44 | + --typescript=${{ matrix.TYPESCRIPT }} \ |
| 45 | + --src-dir=${{ matrix.SRC_DIR }} \ |
| 46 | + --app=${{ matrix.APP_ROUTER }} \ |
| 47 | + --eslint \ |
| 48 | + --no-tailwind \ |
| 49 | + --import-alias="@/*" \ |
| 50 | + --no-git \ |
| 51 | + --use-npm |
| 52 | + shell: bash |
| 53 | + |
| 54 | + - name: Add actual devExtreme-cli |
| 55 | + run: | |
| 56 | + cd test-nextjs-app |
| 57 | + npm add devextreme-cli |
| 58 | + rm -r ./node_modules/devextreme-cli/src/ |
| 59 | + cp -r ../packages/devextreme-cli/src/ ./node_modules/devextreme-cli/ |
| 60 | + ls ./node_modules/devextreme-cli |
| 61 | + ls ./node_modules/devextreme-cli/src |
| 62 | + shell: bash |
| 63 | + timeout-minutes: 15 |
| 64 | + |
| 65 | + - name: Add DevExtreme to Next.js application |
| 66 | + run: | |
| 67 | + cd test-nextjs-app |
| 68 | + npx devextreme-cli add devextreme-react |
| 69 | + shell: bash |
| 70 | + timeout-minutes: 15 |
| 71 | + |
| 72 | + - name: Verify DevExtreme dependencies in package.json |
| 73 | + run: | |
| 74 | + cd test-nextjs-app |
| 75 | +
|
| 76 | + if ! grep -q '"devextreme":' package.json; then |
| 77 | + echo "Error: devextreme dependency not found in package.json" |
| 78 | + exit 1 |
| 79 | + fi |
| 80 | +
|
| 81 | + if ! grep -q '"devextreme-react":' package.json; then |
| 82 | + echo "Error: devextreme-react dependency not found in package.json" |
| 83 | + exit 1 |
| 84 | + fi |
| 85 | +
|
| 86 | + echo "DevExtreme dependencies successfully installed" |
| 87 | + shell: bash |
| 88 | + |
| 89 | + - name: Build Next.js application |
| 90 | + run: | |
| 91 | + cd test-nextjs-app |
| 92 | + npm run build |
| 93 | + shell: bash |
| 94 | + timeout-minutes: 15 |
0 commit comments