Skip to content

Commit

Permalink
Get the tests running.
Browse files Browse the repository at this point in the history
  • Loading branch information
tehnorm committed Apr 25, 2023
1 parent fc83218 commit 2578682
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
REFERENCE_ID=
API_KEY=
2 changes: 0 additions & 2 deletions .env.test

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/autoupdate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Auto Update Commits
on:
# This will trigger on all pushes to all branches.
push: {}
jobs:
autoupdate:
name: autoupdate
runs-on: ubuntu-20.04
steps:
- uses: docker://chinthakagodawita/autoupdate-action:v1
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release

on:
push:
branches:
- main

jobs:
run:
if: github.repository == 'supabase-community/supabase-php'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/[email protected]
with:
php-version: '8.1'
extensions: curl

- name: Install dependencies
uses: php-actions/composer@v6

- name: Run Unit Tests
run: ./vendor/bin/phpunit --testsuite test-unit

- name: Run Integration Tests
run: ./vendor/bin/phpunit --testsuite test-int

- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
35 changes: 35 additions & 0 deletions .github/workflows/test-integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Integration Tests

on:
push: {}

jobs:
phpunit:
runs-on: ${{ matrix.os }}
continue-on-error: false

strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
php-version: ["8.0", "8.1", "8.2"]
phpunit-versions: ["latest"]


steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP ${{ matrix.php-version }} on ${{ matrix.os }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none

- name: Install dependencies
run: composer install

- name: Run Intergation tests
run: ./vendor/bin/phpunit --testsuite test-int
env:
REFERENCE_ID: ${{ secrets.SB_TEST_REFERENCE_ID }}
API_KEY: ${{ secrets.SB_TEST_SERVICE_ROLE }}
29 changes: 29 additions & 0 deletions .github/workflows/test-unit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Unit Tests

on:
push: {}

jobs:
phpunit:
strategy:
matrix:
php-version: [8.0, 8.1, 8.2]

runs-on: ubuntu-latest
continue-on-error: false

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none

- name: Install dependencies
run: composer install

- name: Run Unit tests
run: ./vendor/bin/phpunit --testsuite test-unit
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
/vendor
.env
.env.backup
phpunit.xml
.env.test
.phpdoc
/.phpunit.cache/
.vscode
composer.lock
.env.test
15 changes: 15 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheResult ="false">
<testsuites>
<testsuite name="test-unit">
<directory>./tests/unit</directory>
</testsuite>
<testsuite name="test-int">
<directory>./tests/integration</directory>
</testsuite>
</testsuites>
<php>
<env name="REFERENCE_ID" value=""/>
<env name="API_KEY" value=""/>
</php>
</phpunit>

0 comments on commit 2578682

Please sign in to comment.