Skip to content

Commit

Permalink
Add FTP tests to GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed Apr 20, 2020
1 parent a01a7c7 commit f6863b4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ jobs:
go test -v -tags "ci backend" ./storage
if: matrix.go-version == '1.14.x' && matrix.platform == 'ubuntu-latest'

- name: Storage FTP Backend Tests
env:
KNOXITE_FTP_URL: ${{ secrets.KNOXITE_FTP_URL }}
run: |
./admin/setup_ftp_test_environment.sh
go test -v -tags "ci backend" ./storage
if: matrix.go-version == '1.14.x' && matrix.platform == 'ubuntu-latest'

- name: Coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
30 changes: 30 additions & 0 deletions admin/setup_ftp_test_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
#
# knoxite
# Copyright (c) 2020, Christian Muehlhaeuser <muesli@gmail.com>
#
# For license see LICENSE
#

FTPSERVER_VERSION="0.5"
FTPSERVER_BINARY="/tmp/ftpserver"
FTP_DIR="$HOME"/knoxite_ftp

if [[ "$OSTYPE" == "linux-gnu" ]]; then
OS="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
OS="darwin"
fi

# download ftpserver
curl -L "https://github.com/fclairamb/ftpserver/releases/download/v${FTPSERVER_VERSION}/ftpserver-${OS}-amd64" --output ${FTPSERVER_BINARY}
chmod +x ${FTPSERVER_BINARY}

# create dirs
mkdir -p "$FTP_DIR"

# start FTP server
/tmp/ftpserver -data "$FTP_DIR" &

# wait for FTP server to boot up
sleep 5

0 comments on commit f6863b4

Please sign in to comment.