Skip to content

Simplify closing email verification status banner #631

Simplify closing email verification status banner

Simplify closing email verification status banner #631

Workflow file for this run

name: lexbox ui
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
on:
push:
paths:
- 'frontend/**'
- '.github/workflows/lexbox-ui.yaml'
- '.github/workflows/deploy.yaml'
branches:
- main
- develop
pull_request:
paths:
- 'frontend/**'
- '.github/workflows/lexbox-ui.yaml'
- '.github/workflows/deploy.yaml'
branches:
- main
- develop
env:
PROD_RELEASE: ${{github.ref == vars.PROD_BRANCH}}
IMAGE_NAME: ghcr.io/sillsdev/lexbox-ui
jobs:
publish-ui:
timeout-minutes: 60
runs-on: ubuntu-latest
outputs:
version: ${{ steps.setVersion.outputs.VERSION }}
env:
# https://docs.docker.com/develop/develop-images/build_enhancements/
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@v3
- name: pnpm install
working-directory: ./frontend
run: |
corepack enable
pnpm install
- name: vitest
working-directory: ./frontend
run: |
pnpm run test:unit --reporter=default --reporter=junit --outputFile.junit=test-results/vitest-results.xml
- name: Publish unit test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: UI unit Tests
files: ./frontend/test-results/*.xml
action_fail_on_inconclusive: true
- name: Set Version
id: setVersion
# set version to date in vYYYY-MM-DD format
run: |
shortSha=$(echo ${{ github.sha }} | cut -c1-8)
echo "VERSION=v$(date --rfc-3339=date)-$shortSha" >> ${GITHUB_ENV}
echo "VERSION=v$(date --rfc-3339=date)-$shortSha" >> ${GITHUB_OUTPUT}
- name: Docker meta
id: meta
if: ${{ !env.ACT }}
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=raw,enable=${{ env.PROD_RELEASE }},value=latest
type=raw,enable=${{ env.PROD_RELEASE }},value=${{ env.VERSION }}
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v4
with:
context: frontend
build-args: |
APP_VERSION=${{ env.VERSION }}
push: ${{ !env.ACT && github.repository == 'sillsdev/languageforge-lexbox' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy-ui:
uses: ./.github/workflows/deploy.yaml
if: ${{github.ref == vars.PROD_BRANCH}}
secrets: inherit
needs: publish-ui
with:
version: ${{ needs.publish-ui.outputs.version }}
image: 'ghcr.io/sillsdev/lexbox-ui'
verify-published:
runs-on: ubuntu-latest
needs: [deploy-ui, publish-ui]
steps:
- name: Verify Version
env:
TARGET_HOST: https://staging.languagedepot.org
EXPECTED_VERSION: ${{ needs.publish-ui.outputs.version }}
run: |
IterateCount=10
DelayMultiplier=5
n=0
until [ $n -ge $IterateCount ]
do
curl -s --head "$TARGET_HOST/healthz" > response.txt
# get version from response, trim off the header and fix the line endings
versionHeader=$((grep "lexbox-version" response.txt || echo VersionNotFound) | cut -d' ' -f 2 | tr -d '[:space:]')
if [[ "$versionHeader" == "$EXPECTED_VERSION" ]]; then
echo "Version is correct"
exit 0
else
echo "Version '$versionHeader' is incorrect, expected '$EXPECTED_VERSION'"
echo "response was:"
cat response.txt
n=$((n+1))
sleep $((DelayMultiplier * n))
fi
done
echo "Version $versionHeader is still incorrect after waiting"
exit 1
check-and-lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./frontend
steps:
- uses: actions/checkout@v3
- run: corepack enable
- run: pnpm install
- run: pnpm run build # We need code/types generated by the build (e.g. gql/generated)
- run: pnpm run check --output machine
- run: pnpm run lint:report
- name: Annotate Code Linting REsults
uses: ataylorme/eslint-annotate-action@2.2.0
if: always()
with:
report-json: ./frontend/eslint_report.json