[DEV-190] Migrate tests from Travis CI to GitHub Actions (#1198)

* [DEV-315] Create docker routine for frontend that works on Mac

* Add make option to run bash inside container

* [DEV-190] Migrate tests from Travis CI to Github Actions

* Make install step not interactive

* Run build steps before trying to run tests

* Setup vendor permissions prior to running tests

* Add command to setup permissions in files folder too

* Test tests failing

* Move setup vendor permissions into make install, corrects tests

* Revert "Move setup vendor permissions into make install, corrects tests"

This reverts commit 8092cad24c.

* Revert "Test tests failing"

This reverts commit 57fd123c55.
This commit is contained in:
Maximiliano Redigonda 2022-05-04 11:06:52 -03:00 committed by GitHub
parent 5e7f39df05
commit 04923b0e9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 0 deletions

14
.github/workflows/run-tests.yml vendored Normal file
View File

@ -0,0 +1,14 @@
name: run-tests
on: [push]
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: cd server && make build
- run: cd server && make run
- run: cd server && make install-not-interactive
- run: cd server && make setup-vendor-permissions
- run: cd server && make test-not-interactive
- run: cd tests && make build
- run: cd tests && make run-not-interactive

View File

@ -13,6 +13,14 @@ install:
@docker exec -it opensupports-srv bash -c "cd /var/www/html && composer install" || echo "${red}Please execute 'make run' first${reset}"
@docker exec -it opensupports-db bash -c "mysql -u root -e \"CREATE DATABASE IF NOT EXISTS development;\" " || echo "${red}Please execute 'make run' first${reset}"
install-not-interactive:
@docker exec opensupports-srv bash -c "cd /var/www/html && composer install" || echo "${red}Please execute 'make run' first${reset}"
@docker exec opensupports-db bash -c "mysql -u root -e \"CREATE DATABASE IF NOT EXISTS development;\" " || echo "${red}Please execute 'make run' first${reset}"
setup-vendor-permissions:
@docker exec opensupports-srv bash -c "cd /var/www/html && chmod 777 -R vendor/ezyang" || echo "${red}Please execute 'make run' first${reset}"
@docker exec opensupports-srv bash -c "cd /var/www/html && chmod 777 -R files" || echo "${red}Please execute 'make run' first${reset}"
run: stop
@docker run --platform=linux/amd64 -d --network os-net --name opensupports-db -p 4040:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -v $(PWD)/.dbdata/:/var/lib/mysql mysql:5.6
@docker run --platform=linux/amd64 -d --network os-net --name opensupports-myadmin --link opensupports-db:db -p 6060:80 phpmyadmin/phpmyadmin
@ -22,6 +30,9 @@ run: stop
test:
@docker exec -it opensupports-srv bash -c "cd /var/www/html && ./run-tests.sh"
test-not-interactive:
@docker exec opensupports-srv bash -c "cd /var/www/html && ./run-tests.sh"
log:
@docker attach opensupports-srv || echo "${red}Please execute 'make run' first${reset}"

View File

@ -6,6 +6,9 @@ build:
run:
@docker run -it --network os-net -v ${PWD}:/app -v ${PWD}/../server:/server opensupports-tests make test
run-not-interactive:
@docker run --network os-net -v ${PWD}:/app -v ${PWD}/../server:/server opensupports-tests make test
clear:
@docker run -it --network os-net -v ${PWD}:/app -v ${PWD}/../server:/server opensupports-tests make truncate-db