forked from mapasculturais/mapasculturais
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
329 additions
and
50 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Deploy | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- labeled | ||
|
||
jobs: | ||
deploy: | ||
if: github.event.label.name == 'REDELIVRE' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
# list of Docker images to use as base name for tags | ||
images: | | ||
docker.io/hacklab/mapasculturais | ||
# ghcr.io/username/app | ||
# generate Docker tags based on the following events/attributes | ||
tags: | | ||
type=ref,event=branch | ||
type=sha,format=long | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- | ||
name: Login to Docker Hub | ||
# if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
file: ./docker/Dockerfile | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Inject slug/short variables | ||
uses: rlespinasse/github-slug-action@v4 | ||
with: | ||
prefix: RL_ | ||
- | ||
name: deploy to cluster | ||
uses: steebchen/kubectl@v2.0.0 | ||
with: # defaults to latest kubectl binary version | ||
config: ${{ secrets.KUBE_CONFIG_DATA }} | ||
command: set image --record deployment/mapasculturais -nredelivre-mapas-dev mapas=docker.io/hacklab/mapasculturais:sha-${{ github.sha }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Testing | ||
|
||
on: | ||
push: | ||
branches: | ||
- "master" | ||
- "develop" | ||
pull_request: | ||
branches: | ||
- "develop" | ||
|
||
jobs: | ||
php: | ||
strategy: | ||
matrix: | ||
operating-system: [ubuntu-latest] | ||
php-versions: ['8.2'] | ||
runs-on: ${{ matrix.operating-system }} | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Composer Install | ||
run: docker run --rm -v $PWD:/app composer:latest install | ||
- | ||
name: Docker Compose | ||
uses: KengoTODA/actions-setup-docker-compose@v1 | ||
with: | ||
version: '2.14.2' # the full version of `docker-compose` command | ||
- run: docker compose up -d | ||
- | ||
name: Database Migrations | ||
run: sleep 5 && docker compose run --rm migrations | ||
- | ||
name: Phpunit Coverage | ||
run: docker compose exec backend ./vendor/bin/phpunit --coverage-text | ||
# - | ||
# name: deploy to cluster | ||
# uses: steebchen/kubectl@v2.0.0 | ||
# with: # defaults to latest kubectl binary version | ||
# config: ${{ secrets.KUBE_CONFIG_DATA }} | ||
# command: set image --record deployment/mapasculturais -nredelivre-mapas-dev container=${{ github.repository }}:${{ github.sha }} | ||
|
||
# Docs: https://github.com/shivammathur/setup-php | ||
# - | ||
# name: Setup PHP | ||
# uses: shivammathur/setup-php@v2 | ||
# with: | ||
# php-version: ${{ matrix.php-versions }} | ||
# extensions: mbstring, dom, pdo_pgsql, gd, intl, zip, opcache, xml, curl, iconv, xmlwriter, simplexml | ||
# coverage: none # xdebug | ||
# tools: composer | ||
# - | ||
# name: Get composer cache directory | ||
# id: composer-cache | ||
# run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
# - | ||
# name: Cache composer dependencies | ||
# uses: actions/cache@v3 | ||
# with: | ||
# path: ${{ steps.composer-cache.outputs.dir }} | ||
# # Use composer.json for key, if composer.lock is not committed. | ||
# # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
# restore-keys: ${{ runner.os }}-composer- | ||
# - | ||
# name: Install dependencies | ||
# run: composer install --no-progress --prefer-dist --optimize-autoloader | ||
# - | ||
# name: Add hosts to /etc/hosts | ||
# run: | | ||
# sudo echo "127.0.0.1 db redis" | sudo tee -a /etc/hosts | ||
# - | ||
# name: Docker compose up | ||
# uses: isbang/compose-action@v1.5.1 | ||
# with: | ||
# compose-file: "./docker-compose.yml" | ||
# down-flags: "--volumes" | ||
# services: | | ||
# db | ||
# redis | ||
# migrations | ||
# - | ||
# name: Test with phpunit | ||
# run: docker compose exec backend ls ./vendor/ | ||
# - | ||
# name: Test with phpunit | ||
# run: docker compose exec backend ./vendor/bin/phpunit --coverage-text |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="Slim coding standard"> | ||
<description>Slim coding standard</description> | ||
|
||
<!-- display progress --> | ||
<arg value="p"/> | ||
<!-- use colors in output --> | ||
<arg name="colors"/> | ||
|
||
<!-- inherit rules from: --> | ||
<rule ref="PSR12"/> | ||
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/> | ||
|
||
<!-- Paths to check --> | ||
<file>src/</file> | ||
<file>tests/src/</file> | ||
</ruleset> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" backupGlobals="false" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutChangesToGlobalState="true" beStrictAboutOutputDuringTests="true" colors="true" processIsolation="false" stopOnFailure="false" bootstrap="tests/src/bootstrap.php" cacheDirectory=".phpunit.cache" backupStaticProperties="false"> | ||
<coverage/> | ||
<testsuites> | ||
<testsuite name="Test Suite"> | ||
<directory>./tests/src/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<source> | ||
<include> | ||
<directory suffix=".php">./src/</directory> | ||
</include> | ||
</source> | ||
</phpunit> |
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
File renamed without changes.
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
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.