diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index cb73cebe..aa4958ee 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -9,7 +9,13 @@ on: - closed jobs: + test: + uses: key4hep/dmx/.github/workflows/test-previews.yml@main + with: + repository: ${{ github.event.pull_request.head.sha }} + deploy-preview: + needs: test environment: github-pages runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/test-previews.yml b/.github/workflows/test-previews.yml new file mode 100644 index 00000000..f0fad80a --- /dev/null +++ b/.github/workflows/test-previews.yml @@ -0,0 +1,26 @@ +name: Test previews +on: + workflow_call: + inputs: + repository: + required: true + type: string + +jobs: + test: + environment: github-pages + runs-on: ubuntu-latest + steps: + - name: Checkout PR + uses: actions/checkout@v3 + with: + ref: ${{ inputs.repository }} + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "20.x" + cache: "npm" + - name: Install dependencies + run: npm install + - name: Run tests + run: npm test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0edb19b5..d7a080fd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,7 @@ name: Build and test on: push: - branches: [main] - pull_request: - types: [opened, reopened, synchronize] + branches: [main, release] jobs: test: