Created
June 11, 2020 21:27
-
-
Save acidjazz/0f4e0047b6519692fc9ba21bb1d75efa to your computer and use it in GitHub Desktop.
github test workflow for a laravel project
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: | |
push: | |
branches-ignore: | |
- staging | |
- production | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'MySQL - tweak mysql' | |
run: | | |
echo "[mysqld]" | sudo tee -a /etc/mysql/conf.d/mysql.cnf > /dev/null | |
echo "skip-grant-tables" | sudo tee -a /etc/mysql/conf.d/mysql.cnf > /dev/null | |
- name: MySQL - restart and add database | |
run: | | |
sudo service mysql restart | |
mysql -u root -e "CREATE DATABASE IF NOT EXISTS \`test-grappling\`" | |
- uses: actions/checkout@v2 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install Dependencies | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist | |
- name: Run phpunit | |
run: vendor/bin/phpunit --color=always --testdox --coverage-text --coverage-html coverage/ | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: coverage-html | |
path: coverage/ | |
Place these in .github/workflows
and set your appropiate secrets and you're done!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
and here is
deploy.yml