diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 2ef1934..37eab22 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -6,6 +6,10 @@ on: - master workflow_dispatch: +concurrency: + group: production-progcode + cancel-in-progress: false + jobs: deploy: runs-on: ubuntu-latest @@ -37,14 +41,8 @@ jobs: short_sha="${GITHUB_SHA:-${GITEA_SHA:-manual}}" short_sha="${short_sha:0:12}" - if [ -z "${IMAGE}" ]; then - : "${IMAGE_REPO:?Set IMAGE or IMAGE_REPO in Gitea variables}" - IMAGE="${IMAGE_REPO}:${short_sha}" - fi - - if [ -z "${IMAGE_REPO}" ]; then - IMAGE_REPO="${IMAGE%:*}" - fi + IMAGE_REPO="git.pryanik.synology.me/huncode/progcode" + IMAGE="${IMAGE_REPO}:${short_sha}" { echo "IMAGE=${IMAGE}" @@ -74,7 +72,7 @@ jobs: shell: bash run: | set -euo pipefail - docker build --pull -t "${IMAGE}" . + docker build --pull --build-arg SOURCE_COMMIT="${GITHUB_SHA:-${GITEA_SHA:-unknown}}" -t "${IMAGE}" . - name: Push image shell: bash diff --git a/Dockerfile b/Dockerfile index a7d27f6..d322147 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,8 @@ COPY web/ ./ RUN npm run build FROM joseluisq/static-web-server:2-alpine +ARG SOURCE_COMMIT=unknown +LABEL org.opencontainers.image.revision=$SOURCE_COMMIT ENV SERVER_ROOT=/public \ SERVER_PORT=8080 \ diff --git a/verification/keyboard-check.txt b/verification/keyboard-check.txt new file mode 100644 index 0000000..6142fd3 --- /dev/null +++ b/verification/keyboard-check.txt @@ -0,0 +1,34 @@ +### Result +{"focus":[{"tag":"A","text":" ProgCode.Ru","id":"","outline":"solid"},{"tag":"A","text":"Архив","id":"","outline":"solid"},{"tag":"A","text":"JSON-инструмент","id":"","outline":"solid"},{"tag":"A","text":"Об источниках","id":"","outline":"solid"},{"tag":"A","text":"Читать архив ↓","id":"","outline":"solid"},{"tag":"INPUT","text":"","id":"search","outline":"solid"}],"searchResults":3,"topicPressed":"true","valid":"{\n \"ok\": true\n}","invalid":"Ошибка JSON: Expected property name or '}' in JSON at position 1 (line 1 column 2)"} +### Ran Playwright code +```js +await (async page => { + await page.setViewportSize({width:390,height:844}); + await page.goto('http://127.0.0.1:52964/'); + const focus=[]; + for(let i=0;i<12;i++){if(await page.locator('#search').evaluate(e=>e===document.activeElement))break;await page.keyboard.press('Tab');focus.push(await page.evaluate(()=>({tag:document.activeElement.tagName,text:document.activeElement.textContent, id:document.activeElement.id,outline:getComputedStyle(document.activeElement).outlineStyle})));} + if(await page.locator('#search').evaluate(e=>e!==document.activeElement)) throw Error('Search is not keyboard reachable'); + await page.keyboard.type('Bitrix'); + const found=await page.locator('.article-card').count();if(found!==3)throw Error('Search expected 3'); + await page.keyboard.press('ControlOrMeta+A');await page.keyboard.press('Backspace'); + for(let i=0;i<3;i++)await page.keyboard.press('Tab'); + await page.keyboard.press('Enter'); + const topic=await page.getByRole('button',{name:'Bitrix',exact:true}).getAttribute('aria-pressed');if(topic!=='true')throw Error('Topic keyboard failed'); + await page.goto('http://127.0.0.1:52964/tools/'); + for(let i=0;i<12;i++){if(await page.locator('#json').evaluate(e=>e===document.activeElement))break;await page.keyboard.press('Tab');} + if(await page.locator('#json').evaluate(e=>e!==document.activeElement))throw Error('Textarea keyboard focus failed'); + await page.keyboard.press('ControlOrMeta+A');await page.keyboard.type('{"ok":true}'); + await page.keyboard.press('Tab');await page.keyboard.press('Enter'); + const valid=await page.getByRole('status').innerText();if(!valid.includes('"ok": true'))throw Error('Valid JSON failed'); + await page.keyboard.press('Shift+Tab');await page.keyboard.press('ControlOrMeta+A');await page.keyboard.type('{broken'); + await page.keyboard.press('Tab');await page.keyboard.press('Enter'); + const invalid=await page.getByRole('status').innerText();if(!invalid.includes('Ошибка JSON'))throw Error('Error JSON failed'); + await page.screenshot({path:'/tmp/progcode-keyboard-focus.png'}); + await page.screenshot({path:'/tmp/progcode-mobile-tools-full.png',fullPage:true}); + return {focus,searchResults:found,topicPressed:topic,valid,invalid}; +} +)(page); +``` +### Page +- Page URL: http://127.0.0.1:52964/tools/ +- Page Title: ProgCode.Ru — архив программиста diff --git a/verification/keyboard-focus.png b/verification/keyboard-focus.png new file mode 100644 index 0000000..5111bdb Binary files /dev/null and b/verification/keyboard-focus.png differ diff --git a/verification/mobile-tools-full.png b/verification/mobile-tools-full.png new file mode 100644 index 0000000..1c58800 Binary files /dev/null and b/verification/mobile-tools-full.png differ