Skip to content

ci: run PHP unit in GitHub Actions #77

ci: run PHP unit in GitHub Actions

ci: run PHP unit in GitHub Actions #77

name: Continuous Integration
on:
push:
branches:
- main
pull_request:
jobs:
install:
runs-on: ubuntu-latest
steps:
- name: Download code from GitHub
uses: actions/[email protected]
- name: Install pnpm package manager
uses: pnpm/[email protected]
with:
version: 8.14
- name: Set up Node.js version
uses: actions/[email protected]
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: |
pnpm install
pnpm ls
- name: 'Continuous Integration: test'
run: |
pnpm run --if-present test
- name: 'Continuous Integration: test PHP'
run: |
./vendor/bin/phpunit src/
lint:
runs-on: ubuntu-latest
needs: install
steps:
- name: Download code from GitHub
uses: actions/[email protected]
- name: Install pnpm package manager
uses: pnpm/[email protected]
with:
version: 8.14
- name: Set up Node.js version
uses: actions/[email protected]
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: |
pnpm install
- name: 'Continuous Integration: lint'
run: |
pnpm run --if-present lint
build:
runs-on: ubuntu-latest
needs: install
steps:
- name: Download code from GitHub
uses: actions/[email protected]
- name: Install pnpm package manager
uses: pnpm/[email protected]
with:
version: 8.14
- name: Set up Node.js version
uses: actions/[email protected]
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: |
pnpm install
- name: 'Continuous Integration: build'
env:
BASE_URL: '/utrecht/'
run: |
pnpm run --if-present build
- name: 'Retain build artifact: build'
uses: actions/[email protected]
with:
name: nlds-community-blocks
path: '@nl-design-system-community/nlds-community-blocks.zip'
retention-days: 14
test:
runs-on: ubuntu-latest
needs: install
steps:
- name: Download code from GitHub
uses: actions/[email protected]
- name: Install pnpm package manager
uses: pnpm/[email protected]
with:
version: 8.14
- name: Install dependencies
uses: php-actions/composer@v6
- name: Set up Node.js version
uses: actions/[email protected]
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: |
pnpm install
- name: 'Continuous Integration: test'
run: |
pnpm run --if-present test
publish:
runs-on: ubuntu-latest
needs: [build, lint, test]
if: github.ref == 'refs/heads/main'
steps:
- name: 'Restore build artifact: build'
uses: actions/[email protected]
with:
name: nlds-community-blocks
path: '@nl-design-system-community/nlds-community-blocks.zip'
- uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
automatic_release_tag: 'latest'
prerelease: true
title: 'Development Build'
files: '@nl-design-system-community/nlds-community-blocks.zip'