123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- name: FTP unit tests
- on:
- pull_request:
- paths:
- - '.github/**'
- - 'apps/files_external/**'
- concurrency:
- group: ftp-${{ github.head_ref || github.run_id }}
- cancel-in-progress: true
- env:
- APP_NAME: files_external
- jobs:
- ftp-tests:
- runs-on: ubuntu-latest
- if: ${{ github.repository_owner != 'nextcloud-gmbh' }}
- strategy:
- # do not stop on another job's failure
- fail-fast: false
- matrix:
- php-versions: ['8.0']
- ftpd: ['proftpd', 'vsftpd', 'pure-ftpd']
- name: php${{ matrix.php-versions }}-${{ matrix.ftpd }}
- steps:
- - name: Checkout server
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- with:
- submodules: true
- - name: Set up ftpd
- run: |
- sudo mkdir /tmp/ftp
- sudo chmod -R 0777 /tmp/ftp
- if [[ "${{ matrix.ftpd }}" == 'proftpd' ]]; then echo '$6$Q7V2n3q2GRVv5YeQ$/AhLu07H76Asojy7bxGXMY1caKLAbp5Vt82LOZYMkD/8uDzyMAEXwk0c1Bdz1DkBsk2Vh/9SF130mOPavRGMo.' > /tmp/secret.txt; fi
- if [[ "${{ matrix.ftpd }}" == 'proftpd' ]]; then echo 'FTP_ROOT=/home/test' > $GITHUB_ENV; fi
- if [[ "${{ matrix.ftpd }}" == 'proftpd' ]]; then docker run --name ftp -d --net host -e PASV_ADDRESS=127.0.0.1 -e FTPUSER_NAME=test -v /tmp/secret.txt:/run/secrets/ftp-user-password-secret -v /tmp/ftp:/home/test instantlinux/proftpd; fi
- if [[ "${{ matrix.ftpd }}" == 'vsftpd' ]]; then docker run --name ftp -d --net host -e FTP_USER=test -e FTP_PASS=test -e PASV_ADDRESS=127.0.0.1 -v /tmp/ftp:/home/vsftpd/test fauria/vsftpd; fi
- if [[ "${{ matrix.ftpd }}" == 'pure-ftpd' ]]; then docker run --name ftp -d --net host -e "PUBLICHOST=localhost" -e FTP_USER_NAME=test -e FTP_USER_PASS=test -e FTP_USER_HOME=/home/test -v /tmp/ftp:/home/test -v /tmp/ftp:/etc/pure-ftpd/passwd stilliard/pure-ftpd; fi
- - name: Set up php ${{ matrix.php-versions }}
- uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d #v2.25.2
- with:
- php-version: ${{ matrix.php-versions }}
- extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Set up Nextcloud
- run: |
- composer install
- mkdir data
- ./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
- ./occ app:enable --force ${{ env.APP_NAME }}
- php -S localhost:8080 &
- - name: smoketest ftp
- run: |
- php -r 'var_dump(file_put_contents("ftp://test:test@localhost${{ env.FTP_ROOT }}/ftp.txt", "asd"));'
- php -r 'var_dump(file_get_contents("ftp://test:test@localhost${{ env.FTP_ROOT }}/ftp.txt"));'
- php -r 'var_dump(mkdir("ftp://test:test@localhost${{ env.FTP_ROOT }}/asdads"));'
- ls -l /tmp/ftp
- [ -f /tmp/ftp/ftp.txt ]
- - name: PHPUnit
- run: |
- echo "<?php return ['run' => true,'host' => 'localhost','user' => 'test','password' => 'test', 'root' => '${{ env.FTP_ROOT }}'];" > apps/${{ env.APP_NAME }}/tests/config.ftp.php
- composer run test:files_external apps/files_external/tests/Storage/FtpTest.php
- - name: ftpd logs
- if: always()
- run: |
- docker logs ftp
- ftp-summary:
- runs-on: ubuntu-latest
- needs: ftp-tests
- if: always()
- steps:
- - name: Summary status
- run: if ${{ needs.ftp-tests.result != 'success' }}; then exit 1; fi
|