Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat Implement mock server #732

Merged
merged 18 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI Workflow

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ['8.1']
sdk: [Android11Java8, Android11Java11, Android12Java8, Android12Java11, CLINode14, CLINode16, DartBeta, DartStable, Deno1193, Deno1303, DotNet60, DotNet70, FlutterStable, FlutterBeta, Go112, Go118, KotlinJava8, KotlinJava11, KotlinJava17, Node12, Node14, Node16, PHP74, PHP80, Python38, Python39, Python310, Ruby27, Ruby30, Ruby31, AppleSwift55, Swift55, WebChromium, WebNode]

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive

- name: Docker Setup Buildx
uses: docker/[email protected]

- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: curl

- name: Before Install
run: |
if [ ! -z "${DOCKERHUB_PULL_USERNAME:-}" ]; then
echo "${DOCKERHUB_PULL_PASSWORD}" | docker login --username "${DOCKERHUB_PULL_USERNAME}" --password-stdin
fi

- name: Install
run: |
docker --version
composer install

- name: Lint
if: matrix.sdk == 'Lint'
run: |
composer lint

- name: Run Tests
run: |
composer test tests/${{ matrix.sdk }}Test.php

lint:
runs-on: ubuntu-latest

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

- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: curl

- name: Install
run: composer install

- name: Lint
run: composer lint
79 changes: 0 additions & 79 deletions .travis.yml

This file was deleted.

52 changes: 26 additions & 26 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions mock-server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.idea/
.dart_tool
/vendor/
/tests/sdks
/.vscode
.vs
.phpunit.*
.env
.envrc
.hatch

# exclude everything
examples/*
tests/tmp
.phpunit.result.cache

# exception to the rule
!examples/.gitkeep

**/.DS_Store
templates/swift/example/.build
templates/swift/example/Example.xcodeproj/project.xcworkspace/xcuserdata
templates/swift/example/Example.xcodeproj/xcuserdata
**/xcuserdata
# exclude go checksum files
go.sum

35 changes: 35 additions & 0 deletions mock-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM composer:2.0 as composer

LABEL maintainer="[email protected]"

ARG TESTING=false
ENV TESTING=$TESTING

WORKDIR /usr/local/src/

COPY composer.lock /usr/local/src/
COPY composer.json /usr/local/src/

RUN composer install --ignore-platform-reqs --optimize-autoloader \
--no-plugins --no-scripts --prefer-dist \
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`

FROM phpswoole/swoole:4.8.7-php8.1-alpine as final
RUN ["apk", "add", "docker"]

ENV _APP_REDIS_HOST=redis \
_APP_REDIS_PORT=6379

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

WORKDIR /usr/src/code

COPY --from=composer /usr/local/src/vendor /usr/src/code/vendor

# Add Source Code
COPY ./src /usr/src/code/src
COPY ./app /usr/src/code/app

EXPOSE 80

CMD ["php", "app/http.php"]
Loading