Skip to content

Commit af1fdaf

Browse files
Merge pull request #27 from Palbahngmiyine/master
fix: 응답 매핑 TypeError 수정 및 CI·테스트 인프라 정비
2 parents 8126a0c + aff1a43 commit af1fdaf

33 files changed

Lines changed: 1705 additions & 460 deletions

.github/workflows/ci.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
push:
7+
branches: [master]
8+
9+
concurrency:
10+
group: ci-${{ github.ref }}
11+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
12+
13+
permissions:
14+
contents: read
15+
16+
env:
17+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
18+
19+
jobs:
20+
unit-test:
21+
name: Unit / PHP ${{ matrix.php }}
22+
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
php: ["7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4", "8.5"]
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Setup PHP ${{ matrix.php }}
33+
uses: shivammathur/setup-php@v2
34+
with:
35+
php-version: ${{ matrix.php }}
36+
extensions: json, mbstring
37+
coverage: none
38+
tools: composer:v2
39+
40+
- name: Determine PHPUnit constraint
41+
id: phpunit
42+
run: |
43+
case "${{ matrix.php }}" in
44+
7.1|7.2) echo "constraint=^7.5" >> "$GITHUB_OUTPUT" ;;
45+
*) echo "constraint=^9.5" >> "$GITHUB_OUTPUT" ;;
46+
esac
47+
48+
- name: Resolve Composer cache directory
49+
id: composer-cache
50+
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
51+
52+
- name: Cache Composer dependencies
53+
uses: actions/cache@v4
54+
with:
55+
path: ${{ steps.composer-cache.outputs.dir }}
56+
key: composer-${{ matrix.php }}-${{ steps.phpunit.outputs.constraint }}-${{ hashFiles('composer.json') }}
57+
restore-keys: |
58+
composer-${{ matrix.php }}-${{ steps.phpunit.outputs.constraint }}-
59+
composer-${{ matrix.php }}-
60+
61+
- name: Allow legacy PHPUnit on PHP 7.1/7.2
62+
if: matrix.php == '7.1' || matrix.php == '7.2'
63+
# PHP 7.1 ships an older Composer (<=2.2) that lacks the audit.block-insecure setting,
64+
# so the command exits non-zero. That same older Composer also does not enforce the
65+
# block, so ignoring the failure is safe.
66+
run: composer config --no-plugins audit.block-insecure false || true
67+
68+
- name: Pin PHPUnit constraint
69+
run: composer require --dev --no-update --no-interaction "phpunit/phpunit:${{ steps.phpunit.outputs.constraint }}"
70+
71+
- name: Install dependencies
72+
env:
73+
COMPOSER_NO_AUDIT: "1"
74+
run: composer update --prefer-dist --no-interaction --no-progress
75+
76+
- name: Run unit tests
77+
run: composer test:unit

.github/workflows/e2e.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: E2E (manual)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
php-version:
7+
description: "Run E2E tests on this PHP version"
8+
required: false
9+
default: "8.3"
10+
type: choice
11+
options:
12+
- "7.1"
13+
- "7.2"
14+
- "7.3"
15+
- "7.4"
16+
- "8.0"
17+
- "8.1"
18+
- "8.2"
19+
- "8.3"
20+
- "8.4"
21+
- "8.5"
22+
23+
permissions:
24+
contents: read
25+
26+
env:
27+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
28+
29+
jobs:
30+
e2e:
31+
name: E2E / PHP ${{ inputs.php-version }}
32+
runs-on: ubuntu-latest
33+
environment: production
34+
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
39+
- name: Setup PHP ${{ inputs.php-version }}
40+
uses: shivammathur/setup-php@v2
41+
with:
42+
php-version: ${{ inputs.php-version }}
43+
extensions: json, mbstring
44+
coverage: none
45+
tools: composer:v2
46+
47+
- name: Determine PHPUnit constraint
48+
id: phpunit
49+
run: |
50+
case "${{ inputs.php-version }}" in
51+
7.1|7.2) echo "constraint=^7.5" >> "$GITHUB_OUTPUT" ;;
52+
*) echo "constraint=^9.5" >> "$GITHUB_OUTPUT" ;;
53+
esac
54+
55+
- name: Resolve Composer cache directory
56+
id: composer-cache
57+
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
58+
59+
- name: Cache Composer dependencies
60+
uses: actions/cache@v4
61+
with:
62+
path: ${{ steps.composer-cache.outputs.dir }}
63+
key: composer-e2e-${{ inputs.php-version }}-${{ steps.phpunit.outputs.constraint }}-${{ hashFiles('composer.json') }}
64+
restore-keys: |
65+
composer-e2e-${{ inputs.php-version }}-
66+
67+
- name: Allow legacy PHPUnit on PHP 7.1/7.2
68+
if: inputs.php-version == '7.1' || inputs.php-version == '7.2'
69+
# PHP 7.1 ships an older Composer (<=2.2) that lacks the audit.block-insecure setting,
70+
# so the command exits non-zero. That same older Composer also does not enforce the
71+
# block, so ignoring the failure is safe.
72+
run: composer config --no-plugins audit.block-insecure false || true
73+
74+
- name: Pin PHPUnit constraint
75+
run: composer require --dev --no-update --no-interaction "phpunit/phpunit:${{ steps.phpunit.outputs.constraint }}"
76+
77+
- name: Install dependencies
78+
env:
79+
COMPOSER_NO_AUDIT: "1"
80+
run: composer update --prefer-dist --no-interaction --no-progress
81+
82+
- name: Run E2E tests
83+
env:
84+
SOLAPI_API_KEY: ${{ secrets.SOLAPI_API_KEY }}
85+
SOLAPI_API_SECRET: ${{ secrets.SOLAPI_API_SECRET }}
86+
SOLAPI_KAKAO_PF_ID: ${{ secrets.SOLAPI_KAKAO_PF_ID }}
87+
SOLAPI_SENDER_NUMBER: ${{ secrets.SOLAPI_SENDER_NUMBER }}
88+
SOLAPI_RECIPIENT_NUMBER: ${{ secrets.SOLAPI_RECIPIENT_NUMBER }}
89+
run: composer test:e2e

.github/workflows/release.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Release
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI"]
6+
types: [completed]
7+
branches: [master]
8+
9+
permissions:
10+
contents: write
11+
pull-requests: read
12+
13+
jobs:
14+
release:
15+
name: Tag & GitHub Release
16+
runs-on: ubuntu-latest
17+
if: >
18+
github.event.workflow_run.conclusion == 'success' &&
19+
github.event.workflow_run.head_branch == 'master' &&
20+
github.event.workflow_run.event == 'push'
21+
22+
steps:
23+
- name: Checkout CI head commit
24+
uses: actions/checkout@v4
25+
with:
26+
ref: ${{ github.event.workflow_run.head_sha }}
27+
fetch-depth: 0
28+
29+
- name: Extract version from composer.json
30+
id: version
31+
run: |
32+
set -euo pipefail
33+
VERSION=$(jq -r '.version' composer.json)
34+
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
35+
echo "::error::composer.json version '$VERSION' is not a plain semver (X.Y.Z). Pre-release tags are not supported by this workflow."
36+
exit 1
37+
fi
38+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
39+
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
40+
echo "Detected version: $VERSION"
41+
42+
- name: Verify DefaultAgent.php version matches composer.json
43+
env:
44+
VERSION: ${{ steps.version.outputs.version }}
45+
run: |
46+
set -euo pipefail
47+
AGENT_FILE="src/Models/Request/DefaultAgent.php"
48+
AGENT_VERSION=$(grep -oE "php/[0-9]+\.[0-9]+\.[0-9]+" "$AGENT_FILE" | head -n1 | sed 's|php/||')
49+
if [ -z "$AGENT_VERSION" ]; then
50+
echo "::error file=$AGENT_FILE::Could not locate 'php/X.Y.Z' SDK version literal in $AGENT_FILE."
51+
exit 1
52+
fi
53+
if [ "$VERSION" != "$AGENT_VERSION" ]; then
54+
echo "::error file=$AGENT_FILE::Version drift detected. composer.json='$VERSION' but $AGENT_FILE='$AGENT_VERSION'. Update both files to the same value."
55+
exit 1
56+
fi
57+
echo "Version drift check passed: $VERSION"
58+
59+
- name: Check whether tag already exists
60+
id: tag-check
61+
env:
62+
TAG: ${{ steps.version.outputs.tag }}
63+
run: |
64+
set -euo pipefail
65+
git fetch --tags --quiet
66+
if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null; then
67+
echo "exists=true" >> "$GITHUB_OUTPUT"
68+
echo "Tag ${TAG} already exists — nothing to release. Skipping."
69+
else
70+
echo "exists=false" >> "$GITHUB_OUTPUT"
71+
echo "Tag ${TAG} does not exist — proceeding with release."
72+
fi
73+
74+
- name: Configure git identity
75+
if: steps.tag-check.outputs.exists == 'false'
76+
run: |
77+
git config user.name "github-actions[bot]"
78+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
79+
80+
- name: Create and push tag
81+
if: steps.tag-check.outputs.exists == 'false'
82+
env:
83+
TAG: ${{ steps.version.outputs.tag }}
84+
run: |
85+
set -euo pipefail
86+
git tag -a "$TAG" -m "Release $TAG"
87+
git push origin "$TAG"
88+
89+
- name: Create GitHub Release
90+
if: steps.tag-check.outputs.exists == 'false'
91+
env:
92+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
TAG: ${{ steps.version.outputs.tag }}
94+
run: |
95+
gh release create "$TAG" \
96+
--title "$TAG" \
97+
--generate-notes

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ composer.phar
1919
.phpunit.cache/
2020

2121
# omc
22-
.omc/
22+
.omc/
23+
24+
# Claude Code
25+
.claude/

0 commit comments

Comments
 (0)