Skip to content

Commit 0ff8df5

Browse files
Merge pull request #732 from appwrite/feat-fix-tests
Feat Implement mock server
2 parents 549efa0 + f800246 commit 0ff8df5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2323
-154
lines changed

.github/workflows/tests.yml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CI Workflow
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on: [pull_request]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php-version: ['8.1']
16+
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]
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v3
21+
with:
22+
submodules: recursive
23+
24+
- name: Docker Setup Buildx
25+
uses: docker/[email protected]
26+
27+
- name: Setup PHP with PECL extension
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ matrix.php-version }}
31+
extensions: curl
32+
33+
- name: Before Install
34+
run: |
35+
if [ ! -z "${DOCKERHUB_PULL_USERNAME:-}" ]; then
36+
echo "${DOCKERHUB_PULL_PASSWORD}" | docker login --username "${DOCKERHUB_PULL_USERNAME}" --password-stdin
37+
fi
38+
39+
- name: Install
40+
run: |
41+
docker --version
42+
composer install
43+
44+
- name: Lint
45+
if: matrix.sdk == 'Lint'
46+
run: |
47+
composer lint
48+
49+
- name: Run Tests
50+
run: |
51+
composer test tests/${{ matrix.sdk }}Test.php
52+
53+
lint:
54+
runs-on: ubuntu-latest
55+
56+
steps:
57+
- name: Checkout code
58+
uses: actions/checkout@v3
59+
60+
- name: Setup PHP with PECL extension
61+
uses: shivammathur/setup-php@v2
62+
with:
63+
php-version: ${{ matrix.php-version }}
64+
extensions: curl
65+
66+
- name: Install
67+
run: composer install
68+
69+
- name: Lint
70+
run: composer lint

.travis.yml

-79
This file was deleted.

composer.lock

+26-26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mock-server/.gitignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.idea/
2+
.dart_tool
3+
/vendor/
4+
/tests/sdks
5+
/.vscode
6+
.vs
7+
.phpunit.*
8+
.env
9+
.envrc
10+
.hatch
11+
12+
# exclude everything
13+
examples/*
14+
tests/tmp
15+
.phpunit.result.cache
16+
17+
# exception to the rule
18+
!examples/.gitkeep
19+
20+
**/.DS_Store
21+
templates/swift/example/.build
22+
templates/swift/example/Example.xcodeproj/project.xcworkspace/xcuserdata
23+
templates/swift/example/Example.xcodeproj/xcuserdata
24+
**/xcuserdata
25+
# exclude go checksum files
26+
go.sum
27+

mock-server/Dockerfile

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM composer:2.0 as composer
2+
3+
LABEL maintainer="[email protected]"
4+
5+
ARG TESTING=false
6+
ENV TESTING=$TESTING
7+
8+
WORKDIR /usr/local/src/
9+
10+
COPY composer.lock /usr/local/src/
11+
COPY composer.json /usr/local/src/
12+
13+
RUN composer install --ignore-platform-reqs --optimize-autoloader \
14+
--no-plugins --no-scripts --prefer-dist \
15+
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`
16+
17+
FROM phpswoole/swoole:4.8.7-php8.1-alpine as final
18+
RUN ["apk", "add", "docker"]
19+
20+
ENV _APP_REDIS_HOST=redis \
21+
_APP_REDIS_PORT=6379
22+
23+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
24+
25+
WORKDIR /usr/src/code
26+
27+
COPY --from=composer /usr/local/src/vendor /usr/src/code/vendor
28+
29+
# Add Source Code
30+
COPY ./src /usr/src/code/src
31+
COPY ./app /usr/src/code/app
32+
33+
EXPOSE 80
34+
35+
CMD ["php", "app/http.php"]

0 commit comments

Comments
 (0)