Skip to content

Commit

Permalink
Serverless rework
Browse files Browse the repository at this point in the history
  • Loading branch information
inverse committed Feb 21, 2024
1 parent 640d544 commit b49a9c0
Show file tree
Hide file tree
Showing 14 changed files with 6,366 additions and 14 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,25 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
phpstan:
runs-on: ubuntu-latest
container:
image: jakzal/phpqa:php8.1
steps:
- uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@master
with:
php-version: '8.3'
- name: Install dependencies
run: composer install
- name: PHPStan
run: phpstan analyse
run: ./vendor/bin/phpstan analyse
php-cs-fixer:
runs-on: ubuntu-latest
container:
image: jakzal/phpqa:php8.1
steps:
- uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@master
with:
php-version: '8.3'
- name: Install dependencies
run: composer install
- name: PHP-CS-Fixer
run: php-cs-fixer fix
run: ./vendor/bin/php-cs-fixer fix
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
/.php_cs.cache
/.php-cs-fixer.cache
/coverage.xml
/.serverless/
/node_modules/
2 changes: 2 additions & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tools]
node = '20.11.1'
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,30 @@ Configure this to run on a regular schedule using something that your OS provide

_Note: Don't set the schedule frequency to high to not overload their website_

# Licence
## Run (serverless)

Termin can also be run as a serverless application. Configure the application like you would normally.

Then configure your environment with [serverless tooling][9].

```bash
npm install
```

And finally deploy:

```bash
./node_modules/.bin/serverless deploy
```

To remove run:

```bash
./node_modules/.bin/serverless remove
```


# License

MIT

Expand All @@ -210,3 +233,4 @@ MIT
[6]: https://ntfy.sh/
[7]: https://ntfy.sh/docs/subscribe/phone/
[8]: https://ntfy.sh/docs/subscribe/web/
[9]: https://bref.sh/docs/setup
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"php": ">=8.1",
"ext-curl": "*",
"ext-dom": "*",
"bref/bref": "^2.1",
"campo/random-user-agent": "^1.3",
"ivkos/pushbullet": "^3.3",
"monolog/monolog": "^2.1.1",
Expand All @@ -25,6 +26,8 @@
}
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.49",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10.4"
},
"autoload-dev": {
Expand Down
7 changes: 7 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

return function ($event) {
return 'Hello ' . ($event['name'] ?? 'world');
};
Loading

0 comments on commit b49a9c0

Please sign in to comment.