diff --git a/.github/workflows/test-next.yml b/.github/workflows/test-next.yml new file mode 100644 index 00000000..961e3377 --- /dev/null +++ b/.github/workflows/test-next.yml @@ -0,0 +1,73 @@ +name: "[CI] Test Next" + +on: + push: # Only run on merges into main that modify files under pyscriptjs/ and examples/ + branches: + - next + paths: + - pyscript.core/** + - .github/workflows/test-next.yml # Test that workflow works when changed + + pull_request: # Run on any PR that modifies files under pyscriptjs/ and examples/ + branches: + - next + paths: + - pyscript.core/** + - .github/workflows/test-next.yml # Test that workflow works when changed + workflow_dispatch: + +jobs: + TestNext: + runs-on: ubuntu-latest + defaults: + run: + working-directory: pyscript.core + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install node + uses: actions/setup-node@v3 + with: + node-version: 20.x + + - name: Cache node modules + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: install next deps + working-directory: pyscript.core + run: npm i + + - name: build next + working-directory: pyscript.core + run: npm run build + + - name: Run next tests + working-directory: pyscript.core + run: npm run test + + # TODO: DO we want to upload next yet? + # - uses: actions/upload-artifact@v3 + # with: + # name: pyscript + # path: | + # pyscriptjs/build/ + # if-no-files-found: error + # retention-days: 7 + + # - uses: actions/upload-artifact@v3 + # if: success() || failure() + # with: + # name: test_results + # path: pyscriptjs/test_results + # if-no-files-found: error