[stable28] Fix npm audit #1170
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: | |
branches: | |
- main | |
- master | |
- stable* | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: [ "8.1" ] | |
nextcloud-version: [ 'stable28' ] | |
db: ['sqlite'] | |
name: Nextcloud ${{ matrix.nextcloud-version }} php${{ matrix.php-version }} unit tests | |
steps: | |
- name: Set up php${{ matrix.php-version }} | |
uses: shivammathur/setup-php@7fdd3ece872ec7ec4c098ae5ab7637d5e0a96067 # v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: ctype,curl,dom,gd,iconv,intl,json,mbstring,openssl,posix,sqlite,xml,zip | |
coverage: xdebug | |
- name: Checkout Nextcloud | |
run: git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b ${{ matrix.nextcloud-version }} nextcloud | |
- name: Install Nextcloud | |
run: php -f nextcloud/occ maintenance:install --database-host 127.0.0.1 --database-name nextcloud --database-user nextcloud --database-pass nextcloud --admin-user admin --admin-pass admin --database ${{ matrix.db }} | |
- name: Checkout app | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | |
with: | |
path: nextcloud/apps/twofactor_totp | |
- name: Install dependencies | |
working-directory: nextcloud/apps/twofactor_totp | |
run: composer install | |
- name: Run tests | |
working-directory: nextcloud/apps/twofactor_totp | |
run: composer run test:unit | |
- name: Report coverage | |
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3 | |
if: ${{ always() }} | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./nextcloud/apps/twofactor_totp/tests/clover.xml | |
flags: unittests | |
fail_ci_if_error: true | |
acceptance-tests: | |
concurrency: | |
group: acceptance-tests-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: [ "8.1" ] | |
nextcloud-version: [ 'stable28' ] | |
browser: [ 'firefox' ] | |
db: [ 'mysql' ] | |
name: Nextcloud ${{ matrix.nextcloud-version }} acceptance tests on php${{ matrix.php-version }}/${{ matrix.browser }}/${{ matrix.db }} | |
services: | |
mysql-service: | |
image: mariadb:10.11 | |
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:15 | |
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 | |
steps: | |
- name: Set up php${{ matrix.php-version }} | |
uses: shivammathur/setup-php@7fdd3ece872ec7ec4c098ae5ab7637d5e0a96067 # v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: ctype,curl,dom,gd,iconv,intl,json,mbstring,openssl,posix,sqlite,xml,zip | |
coverage: none | |
- name: Checkout Nextcloud | |
run: git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b ${{ matrix.nextcloud-version }} nextcloud | |
- name: Checkout | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | |
with: | |
path: nextcloud/apps/twofactor_totp | |
- name: Read package.json node and npm engines version | |
uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1 | |
id: versions | |
with: | |
path: nextcloud/apps/twofactor_totp | |
fallbackNode: '^12' | |
fallbackNpm: '^6' | |
- name: Set up node ${{ steps.versions.outputs.nodeVersion }} | |
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3 | |
with: | |
node-version: ${{ steps.versions.outputs.nodeVersion }} | |
- name: Set up npm ${{ steps.versions.outputs.npmVersion }} | |
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" | |
- name: Install Nextcloud | |
run: php -f nextcloud/occ maintenance:install --database-host 127.0.0.1 --database-name nextcloud --database-user nextcloud --database-pass nextcloud --admin-user admin --admin-pass admin --database ${{ matrix.db }} | |
- name: Checkout app | |
uses: actions/checkout@master | |
with: | |
path: nextcloud/apps/twofactor_totp | |
- name: Install dependencies | |
working-directory: nextcloud/apps/twofactor_totp | |
run: | | |
composer install | |
npm ci | |
- name: Build the app | |
working-directory: nextcloud/apps/twofactor_totp | |
run: npm run build | |
- name: Install the app | |
run: php -f nextcloud/occ app:enable twofactor_totp | |
- name: Start Nextcloud web server | |
working-directory: nextcloud | |
run: php -S 0.0.0.0:8080 & | |
- name: Connect to sauce | |
uses: saucelabs/sauce-connect-action@main | |
with: | |
username: ${{ secrets.SAUCE_USERNAME }} | |
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }} | |
tunnelIdentifier: "${{ github.run_id }}-${{ matrix.nextcloud-version }}-php${{ matrix.php-version }}-${{ matrix.browser }}" | |
- name: Run tests | |
working-directory: nextcloud/apps/twofactor_totp | |
run: composer run test:acceptance | |
env: | |
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} | |
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} | |
SAUCE_TUNNEL_ID: "${{ github.run_id }}-${{ matrix.nextcloud-version }}-php${{ matrix.php-version }}-${{ matrix.browser }}" | |
SELENIUM_BROWSER: ${{ matrix.browser }} | |
env: | |
CI: true | |
TRAVIS: true |