Merge pull request #1020 from neet/fix-search-response-type #1722
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
name: "CI" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- "*" | |
workflow_call: | |
workflow_dispatch: | |
jobs: | |
test-unit: | |
name: Unit Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20.6.1" | |
cache: yarn | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build TypeScript | |
run: yarn run build | |
- name: Run tests | |
run: | | |
yarn run lint | |
yarn run test:unit | |
- name: Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
flags: unit | |
token: ${{ secrets.CODECOV_TOKEN }} | |
test-e2e: | |
name: E2E Test | |
runs-on: ubuntu-latest | |
env: | |
DB_USER: mastodon | |
DB_NAME: mastodon | |
DB_PASS: password | |
MASTODON_CONTAINER: mastodon | |
services: | |
db: | |
image: postgres | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: ${{ env.DB_USER }} | |
POSTGRES_DB: ${{ env.DB_NAME }} | |
POSTGRES_PASSWORD: ${{ env.DB_PASS }} | |
POSTGRES_HOST_AUTH_METHOD: trust | |
options: >- | |
--health-cmd "pg_isready -U postgres" | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
options: >- | |
--health-cmd "redis-cli ping" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20.6.1" | |
cache: yarn | |
- name: Setup Mastodon | |
run: >- | |
docker run | |
-i | |
--rm | |
--env-file ./.github/.env.test | |
docker.io/neetshin/mastodon-dev:latest | |
bash -c "RAILS_ENV=development bundle exec rails db:setup" | |
- name: Run Mastodon | |
run: >- | |
docker run | |
-d | |
-p 3000:3000 | |
-p 4000:4000 | |
--name ${{ env.MASTODON_CONTAINER }} | |
-e DEEPL_PLAN=${{ secrets.DEEPL_PLAN }} | |
-e DEEPL_API_KEY=${{ secrets.DEEPL_API_KEY }} | |
--env-file ./.github/.env.test | |
docker.io/neetshin/mastodon-dev:latest | |
bash -c "foreman start" | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Run tests | |
run: yarn run test:e2e --max-workers=2 | |
- name: Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
flags: e2e | |
token: ${{ secrets.CODECOV_TOKEN }} |