Added Prometheus and Grafana monitoring #684
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: | |
- master | |
pull_request: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- php: '8.4' | |
services: | |
postgres: | |
image: postgres:16-alpine | |
env: | |
POSTGRES_DB: public | |
# This is a temporary database used just for CI | |
POSTGRES_PASSWORD: password | |
ports: | |
- 5432:5432 | |
# Need to make sure we're using the right environment variables when compiling the views | |
env: | |
APP_WEB_URL: https://www.aphiria.com | |
APP_API_URL: https://api.aphiria.com | |
DB_HOST: localhost | |
DB_PASSWORD: password | |
name: Test PHP ${{ matrix.php }} | |
steps: | |
- name: Check Out Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set Up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: curl, dom, libxml, mbstring, pcntl, pgsql, xdebug, zip | |
tools: composer:v2 | |
coverage: xdebug | |
- name: Install Dependencies | |
run: | | |
chmod +x ./install.sh | |
./install.sh --install-terraform | |
composer install --ignore-platform-reqs | |
composer dump-autoload -o | |
chmod -R 755 resources | |
chmod -R 755 tmp | |
yarn install | |
yarn global add gulp | |
gulp build | |
- name: Index Documentation | |
run: | | |
vendor/bin/phinx migrate | |
vendor/bin/phinx seed:run | |
- name: Run Tests | |
run: composer phpunit | |
#- name: Run Linter | |
# run: composer phpcs-test | |
#- name: Run Psalm Static Analysis | |
# run: composer psalm -- --shepherd | |
- name: Upload Coverage Results To Coveralls | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
composer global require php-coveralls/php-coveralls | |
php-coveralls --coverage_clover=./.coverage/clover.xml --json_path=./coveralls-upload.json -v | |
- name: Terraform Plan | |
id: terraform-plan | |
if: github.event_name == 'pull_request' | |
run: | | |
terraform -chdir=./infrastructure/terraform init -backend-config="access_key=${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}" -backend-config="secret_key=${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}" | |
terraform -chdir=./infrastructure/terraform validate | |
output=$(terraform -chdir=./infrastructure/terraform plan -var="do_access_token=${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}" -var="do_spaces_access_key=${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}" -var="do_spaces_secret_key=${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}" -no-color -input=false) | |
echo "output<<EOF" >> $GITHUB_OUTPUT | |
echo "$output" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
continue-on-error: true # We want the output even if this fails | |
- name: Comment Terraform Plan | |
uses: actions/github-script@v7 | |
if: github.event_name == 'pull_request' | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const output = `## Terraform Plan Output\n\`\`\`\n${{ steps.terraform-plan.outputs.output }}\n\`\`\``; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: output | |
}) |