Files
openlayers/.github/workflows/test.yml
naveen c6a7aa08c7 chore: Set permissions for GitHub actions
Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

[Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)

Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
2022-04-27 01:37:20 +00:00

137 lines
2.5 KiB
YAML

name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
CI: true
permissions:
contents: read
jobs:
pretest:
name: Pre-Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Set Node.js Version
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Dependencies
run: npm ci
- name: Run Tests
run: npm run pretest
browser:
name: Browser
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Set Node.js Version
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Dependencies
run: npm ci
- name: Run Tests
run: npm run test-browser
node:
name: Node
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Set Node.js Version
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Dependencies
run: npm ci
- name: Run Tests
run: npm run test-node
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Set Node.js Version
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Dependencies
run: npm ci
- name: Build the Package
run: npm run build-package
- name: Generate the Legacy Build
run: "npm run build-legacy && npx eslint --rule 'import/no-duplicates: off' --fix build/index.js"
rendering:
name: Rendering
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Set Node.js Version
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Dependencies
run: npm ci
- name: Run Tests
run: npm run test-rendering
- name: Store Rendering Test Artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: rendering-tests
path: test/rendering/cases/**/actual.png