-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add github-action/integration test
- setup-test.ts의 env파일 경로를 절대경로에서 상대경로로 수정 - github action상에서의 mysql 권한문제로'mysql' package를 'mysql2'로 재설치
- Loading branch information
Showing
2 changed files
with
52 additions
and
1 deletion.
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,51 @@ | ||
name: Integration Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
services: | ||
mysql: | ||
image: mysql:latest | ||
env: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: yes | ||
MYSQL_DATABASE: test_db | ||
MYSQL_USER: ${{ secrets.DB_USERNAME }} | ||
MYSQL_PASSWORD: ${{ secrets.DB_PASSWORD }} | ||
ports: | ||
- 3306:3306 | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
|
||
steps: | ||
- name: Verify MySQL connection | ||
run: | | ||
mysql --version | ||
sudo apt-get install -y mysql-client | ||
mysql --host ${{ secrets.DB_HOST }} --port 3306 -u ${{ secrets.DB_USERNAME }} -p${{ secrets.DB_PASSWORD }} -e "SHOW DATABASES;" | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
|
||
- name: Create ./env/.env.test file | ||
run: | | ||
mkdir -p ./env | ||
echo "TYPEORM_CONNECTION=mysql" > ./env/.env.test | ||
echo "TYPEORM_HOST=${{ secrets.DB_HOST }}" >> ./env/.env.test | ||
echo "TYPEORM_DATABASE=test_db" >> ./env/.env.test | ||
echo "TYPEORM_USERNAME=${{ secrets.DB_USERNAME }}" >> ./env/.env.test | ||
echo "TYPEORM_PASSWORD=${{ secrets.DB_PASSWORD }}" >> ./env/.env.test | ||
echo "TYPEORM_PORT=3306" >> ./env/.env.test | ||
echo "SECRET_KEY=${{ secrets.SECRET_KEY }}" >> ./env/.env.test | ||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build the project | ||
run: npm run build | ||
|
||
- name: Run integration tests | ||
run: npm run test-integration |
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