32 lines
1.3 KiB
YAML
32 lines
1.3 KiB
YAML
name: Verify editor package
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
container: { image: "node:22-alpine" }
|
|
steps:
|
|
- name: Fetch exact revision
|
|
env:
|
|
SOURCE_SERVER: ${{ gitea.server_url }}
|
|
SOURCE_REPOSITORY: ${{ gitea.repository }}
|
|
SOURCE_REVISION: ${{ gitea.sha }}
|
|
SOURCE_TOKEN: ${{ secrets.GITEA_TOKEN || gitea.token }}
|
|
run: |
|
|
set -eu
|
|
apk add --no-cache python3
|
|
python3 - <<'PY'
|
|
import io,os,shutil,tarfile,tempfile,urllib.request
|
|
from pathlib import Path
|
|
url=f"{os.environ['SOURCE_SERVER'].rstrip('/')}/api/v1/repos/{os.environ['SOURCE_REPOSITORY']}/archive/{os.environ['SOURCE_REVISION']}.tar.gz"
|
|
request=urllib.request.Request(url,headers={'Authorization':'token '+os.environ['SOURCE_TOKEN']})
|
|
with urllib.request.urlopen(request,timeout=60) as response:data=response.read()
|
|
with tempfile.TemporaryDirectory() as directory:
|
|
with tarfile.open(fileobj=io.BytesIO(data),mode='r:gz') as archive:archive.extractall(directory,filter='data')
|
|
shutil.copytree(next(Path(directory).iterdir()),Path.cwd(),dirs_exist_ok=True)
|
|
PY
|
|
- run: npm run check
|
|
- run: npm test
|