[stable2.0] Fix npm audit #1637
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- stable* | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-version: ['8.1', '8.2', '8.3'] | |
nextcloud-version: ['stable30'] | |
name: Nextcloud ${{ matrix.nextcloud-version }} php${{ matrix.php-version }} unit tests | |
steps: | |
- name: Set up Nextcloud env | |
uses: ChristophWurst/setup-nextcloud@fc0790385c175d97e88a7cb0933490de6e990374 # v0.3.2 | |
with: | |
nextcloud-version: ${{ matrix.nextcloud-version }} | |
php-version: ${{ matrix.php-version }} | |
php-coverage: 'xdebug' | |
node-version: 'false' | |
install: true | |
- name: Checkout app | |
uses: actions/checkout@master | |
with: | |
path: nextcloud/apps/twofactor_webauthn | |
- name: Install dependencies | |
working-directory: nextcloud/apps/twofactor_webauthn | |
run: composer install | |
- name: Run tests | |
working-directory: nextcloud/apps/twofactor_webauthn | |
run: composer run test:unit | |
integration-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-version: [ '8.3' ] | |
nextcloud-version: [ 'stable30' ] | |
db: [ 'sqlite' ] | |
include: | |
- php-version: '8.1' | |
nextcloud-version: stable30 | |
db: 'oci' | |
- php-version: '8.1' | |
nextcloud-version: stable30 | |
db: 'pgsql' | |
- php-version: '8.2' | |
nextcloud-version: stable30 | |
db: 'mysql' | |
name: Nextcloud ${{ matrix.nextcloud-version }} php${{ matrix.php-version }}-${{ matrix.db }} integration tests | |
services: | |
mysql-service: | |
image: mariadb:10.5 | |
env: | |
MYSQL_ROOT_PASSWORD: my-secret-pw | |
MYSQL_DATABASE: nextcloud | |
MYSQL_USER: nextcloud | |
MYSQL_PASSWORD: nextcloud | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
postgres-service: | |
image: postgres | |
env: | |
POSTGRES_USER: nextcloud | |
POSTGRES_DB: nextcloud | |
POSTGRES_PASSWORD: nextcloud | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
oracle: | |
image: ghcr.io/gvenzl/oracle-xe:11 | |
env: | |
ORACLE_RANDOM_PASSWORD: true | |
APP_USER: autotest | |
APP_USER_PASSWORD: owncloud | |
ports: | |
- 1521:1521/tcp | |
steps: | |
- name: Set up php${{ matrix.php-version }} | |
uses: shivammathur/setup-php@master | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: ctype,curl,dom,gd,iconv,intl,json,mbstring,openssl,posix,sqlite,xml,zip,gmp,oci8 | |
coverage: xdebug | |
- name: Checkout Nextcloud | |
run: git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b ${{ matrix.nextcloud-version }} nextcloud | |
- name: Check out the app | |
uses: actions/checkout@master | |
with: | |
path: nextcloud/apps/twofactor_webauthn | |
- name: Install Nextcloud | |
if: ${{ matrix.db != 'oci' }} | |
run: php -f nextcloud/occ maintenance:install --database ${{ matrix.db }} --database-host 127.0.0.1 --database-name nextcloud --database-user nextcloud --database-pass nextcloud --admin-user admin --admin-pass admin | |
- name: Install Nextcloud | |
if: ${{ matrix.db == 'oci' }} | |
run: php -f nextcloud/occ maintenance:install --database ${{ matrix.db }} --database-host=127.0.0.1 --database-name=XE --database-port=1521 --database-user=autotest --database-pass=owncloud --admin-user admin --admin-pass admin | |
- name: Install dependencies | |
working-directory: nextcloud/apps/twofactor_webauthn | |
run: composer install | |
- name: Install the app | |
run: php -f nextcloud/occ app:enable twofactor_webauthn | |
- name: Configure Nextcloud for testing | |
run: | | |
php -f nextcloud/occ config:system:set debug --type bool --value true | |
- name: Run tests | |
working-directory: nextcloud/apps/twofactor_webauthn | |
run: composer run test:integration | |
env: | |
XDEBUG_MODE: coverage | |
frontend-unit-test: | |
runs-on: ubuntu-latest | |
name: Front-end unit tests | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Node | |
uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e # v1 | |
with: | |
node-version: 16.x | |
- name: npm install | |
run: npm install | |
- name: run tests | |
run: npm run test:unit | |
env: | |
CI: true | |
frontend-e2e-tests: | |
runs-on: ubuntu-latest | |
name: Front-end E2E tests | |
strategy: | |
matrix: | |
php-version: [ '8.1', '8.2', '8.3' ] | |
nextcloud-version: [ 'stable30'] | |
node-version: [ '20' ] | |
steps: | |
- name: Set up Nextcloud env | |
uses: ChristophWurst/setup-nextcloud@fc0790385c175d97e88a7cb0933490de6e990374 # v0.3.2 | |
with: | |
nextcloud-version: ${{ matrix.nextcloud-version }} | |
php-version: ${{ matrix.php-version }} | |
node-version: ${{ matrix.node-version }} | |
install: true | |
- name: Configure Nextcloud for testing | |
run: | | |
php -f nextcloud/occ config:system:set debug --type=bool --value=true | |
php -f nextcloud/occ config:system:set overwriteprotocol --value=https | |
php -f nextcloud/occ config:system:set overwritehost --value=localhost | |
php -f nextcloud/occ config:system:set overwrite.cli.url --value=https://localhost | |
- name: Check out the app | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | |
with: | |
path: nextcloud/apps/twofactor_webauthn | |
- name: Install php dependencies | |
working-directory: nextcloud/apps/twofactor_webauthn | |
run: composer install | |
- name: Install the app | |
run: php -f nextcloud/occ app:enable twofactor_webauthn | |
- name: Set up node ${{ matrix.node-version }} | |
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install npm dependencies | |
working-directory: nextcloud/apps/twofactor_webauthn | |
run: npm ci | |
- name: Build frontend | |
working-directory: nextcloud/apps/twofactor_webauthn | |
run: npm run dev | |
- name: Install stunnel (tiny https proxy) | |
run: sudo apt-get install -y stunnel | |
- name: Start php server and https proxy | |
working-directory: nextcloud | |
run: | | |
openssl req -new -x509 -days 365 -nodes -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=localhost" -out stunnel.pem -keyout stunnel.pem | |
php -S 127.0.0.1:8080 & | |
sudo stunnel3 -p stunnel.pem -d 443 -r 8080 | |
- name: Test https access | |
run: curl --insecure -Li https://localhost | |
- name: Install Playwright browsers | |
working-directory: nextcloud/apps/twofactor_webauthn | |
run: npx playwright install --with-deps chromium | |
- name: Run Playwright tests | |
working-directory: nextcloud/apps/twofactor_webauthn | |
run: npx playwright test | |
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: nextcloud/apps/twofactor_webauthn/playwright-report/ | |
retention-days: 30 | |
- name: Print server logs | |
if: always() | |
run: cat nextcloud/data/nextcloud.log* | |
env: | |
CI: true |