feat: standardize stream completion error handling #545
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: Deploy to staging | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-test-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build CI image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: gptwrapper | |
tags: ci ${{ github.sha }} | |
containerfiles: | | |
./Containerfile | |
build-args: | | |
BASE_PATH=/ | |
GIT_SHA=${{ github.sha }} | |
STAGING=true | |
CI=true | |
- name: Push CI image to quay.io | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-image.outputs.image }} | |
tags: ${{ steps.build-image.outputs.tags }} | |
registry: quay.io/toska | |
username: toska+github | |
password: ${{ secrets.QUAY_IO_TOKEN }} | |
- name: Start the application | |
run: docker compose -f compose.ci.yaml up -d | |
- run: npm ci | |
- run: npm run tsc | |
- run: npm run lint | |
# https://playwrightsolutions.com/playwright-github-action-to-cache-the-browser-binaries/ | |
- name: Get installed Playwright version | |
id: playwright-version | |
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').packages[''].devDependencies['@playwright/test'])")" >> $GITHUB_ENV | |
- run: npx playwright install --with-deps | |
if: steps.playwright-cache.outputs.cache-hit != 'true' | |
- run: npx playwright install-deps | |
if: steps.playwright-cache.outputs.cache-hit != 'true' | |
- name: Cache playwright binaries | |
uses: actions/cache@v4 | |
id: playwright-cache | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} | |
- name: Run your tests | |
env: | |
CI: true | |
run: npx playwright test | |
- name: Build staging image | |
id: build-staging-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: gptwrapper | |
tags: staging ${{ github.sha }} | |
containerfiles: | | |
./Containerfile | |
build-args: | | |
BASE_PATH=/gptwrapper | |
GIT_SHA=${{ github.sha }} | |
STAGING=true | |
# Extra args are needed to increase the number of open files | |
# because of build EMFILE error: https://github.com/npm/cli/issues/4783#issuecomment-1908016260 | |
extra-args: | | |
--ulimit nofile=4096:4096 | |
- name: Push staging image to quay.io | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-staging-image.outputs.image }} | |
tags: ${{ steps.build-staging-image.outputs.tags }} | |
registry: quay.io/toska | |
username: toska+github | |
password: ${{ secrets.QUAY_IO_TOKEN }} | |
- name: Upload test results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-report | |
path: playwright-report | |
- name: Upload screenshots | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: screenshots | |
path: screenshots | |
- name: Print logs on failure | |
shell: bash | |
if: failure() | |
run: docker compose -f compose.ci.yaml logs |