func(Round): Convert any arrays into strings, as they're probably mal… #396
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
on: push | |
name: CI | |
jobs: | |
testing: | |
runs-on: ubuntu-latest | |
container: | |
image: kirschbaumdevelopment/laravel-test-runner:8.2 | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: testing | |
ports: | |
- 33306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
meilisearch: | |
image: getmeili/meilisearch:latest | |
env: | |
MEILI_MASTER_KEY: abcdefghijklmnopqrstuvwxyz123456 | |
ports: | |
- 7700:7700 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Install composer dependencies | |
run: | | |
composer install --no-scripts | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "18" | |
- name: Install npm dependencies and build assets | |
run: | | |
npm ci | |
npm run build | |
- name: Prepare Laravel Application | |
run: | | |
cp .env.ci .env | |
php artisan key:generate | |
chmod +x docker/mysql/wait-for.sh | |
./docker/mysql/wait-for.sh mysql php artisan migrate | |
- name: Run Testsuite | |
run: ./vendor/bin/phpunit | |
deploy: | |
if: github.ref == 'refs/heads/main' | |
needs: testing # This ensures deployment only happens if testing job passes | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 # It's important to checkout your repository to access its contents. | |
with: | |
fetch-depth: 1 | |
- name: Install SSH key | |
env: | |
PRIVATE_KEY: ${{ secrets.DEPLOY_SSH_KEY }} | |
run: | | |
mkdir -p ~/.ssh | |
echo "$PRIVATE_KEY" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan checker.gitcoin.co >> ~/.ssh/known_hosts | |
- name: Sync Github repository | |
run: | | |
rsync -av -e "ssh -i ~/.ssh/id_rsa" --delete . ubuntu@checker.gitcoin.co:/var/www/checker/deploying.checker.gitcoin.co | |
- name: Build Laravel assets | |
run: | | |
ssh -i ~/.ssh/id_rsa ubuntu@checker.gitcoin.co "cp /var/www/checker/.env /var/www/checker/deploying.checker.gitcoin.co && cd /var/www/checker/deploying.checker.gitcoin.co && composer install && php artisan optimize && npm install && npm run build" | |
- name: Database migrations | |
run: | | |
ssh -i ~/.ssh/id_rsa ubuntu@checker.gitcoin.co "cd /var/www/checker/deploying.checker.gitcoin.co && php artisan migrate --force" | |
- name: Test build | |
run: | | |
ssh -i ~/.ssh/id_rsa ubuntu@checker.gitcoin.co "cd /var/www/checker/deploying.checker.gitcoin.co && php artisan app:test" | |
- name: Deploy | |
run: | | |
ssh -i ~/.ssh/id_rsa ubuntu@checker.gitcoin.co "rsync -av --delete --exclude='.env' --exclude='storage/' --exclude='bootstrap/cache/' /var/www/checker/deploying.checker.gitcoin.co/ /var/www/checker/checker.gitcoin.co/ && cd /var/www/checker/checker.gitcoin.co && php artisan view:clear && php artisan cache:clear && php artisan config:clear && php artisan route:clear" | |
# data-import: | |
# if: github.ref == 'refs/heads/main' | |
# needs: deploy | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v3 # It's important to checkout your repository to access its contents. | |
# with: | |
# fetch-depth: 1 | |
# - name: Install SSH key | |
# env: | |
# PRIVATE_KEY: ${{ secrets.DEPLOY_SSH_KEY }} | |
# run: | | |
# mkdir -p ~/.ssh | |
# echo "$PRIVATE_KEY" > ~/.ssh/id_rsa | |
# chmod 600 ~/.ssh/id_rsa | |
# ssh-keyscan checker.gitcoin.co >> ~/.ssh/known_hosts | |
# - name: Check for new data | |
# run: | | |
# ssh -i ~/.ssh/id_rsa ubuntu@checker.gitcoin.co "cd /var/www/checker/checker.gitcoin.co && php artisan ingest:data" |