generate -> chat #1641
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: e2e test | |
on: | |
push: | |
branches: "**" | |
pull_request: | |
branches: "**" | |
env: | |
PG_DB: postgres | |
PG_USER: postgres | |
PG_HOST: localhost | |
PG_PASS: thisisapassword | |
jobs: | |
build_chat: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: check locale | |
run: python scripts/locale_missing_key.py web/src/locales --base zh-CN | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16.x" | |
- name: build web | |
run: | | |
npm install | |
npm run build | |
working-directory: web | |
- name: copy to api/static | |
run: | | |
cp -R web/dist/* api/static/ | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Build API | |
run: go build -v ./... | |
working-directory: api | |
- name: Test API | |
run: go test -v ./... | |
working-directory: api | |
- name: Build Chat image | |
run: | | |
docker build . --file Dockerfile -t ghcr.io/swuecho/chat:${GITHUB_SHA} | |
- name: change docker image tag | |
run: python scripts/replace_tag_to_test.py ${GITHUB_SHA} | |
- name: docker-compose | |
run: docker-compose up -d | |
- name: show docker ps | |
run: docker-compose ps | |
- name: show docker logs | |
run: docker-compose logs | |
# Setup cache for node_modules | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
with: | |
path: e2e/node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('e2e/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: npm ci | |
working-directory: e2e | |
- name: Install playwright browsers | |
run: npx playwright install --with-deps | |
working-directory: e2e | |
- run: npx playwright test | |
working-directory: e2e |