Improved README and ui-asset workflow

This commit is contained in:
2023-10-30 16:51:39 +01:00
parent 5273eee89f
commit 84c5b0477e
4 changed files with 42 additions and 17 deletions

View File

@@ -56,15 +56,15 @@ Add this `launch.json` to your .vscode directory to have working breakpoints in
## Run locally single-threaded for debugging
By default tests run in parallel using pytest-parallel.
pytest-parallel however breaks `breakpoint()`. To disable it, use this:
By default tests run in parallel using pytest-xdist.
pytest-xdist however breaks `breakpoint()`. To disable it, use this:
```console
pytest --workers "" -s
pytest -n0 -s
```
You can also run a single test like this:
```console
pytest --workers "" -s tests/test_secrets_cli.py::test_users
pytest -n0 -s tests/test_secrets_cli.py::test_users
```

View File

@@ -3,8 +3,17 @@ set -xeuo pipefail
# GITEA_TOKEN
if [[ -z "${GITEA_TOKEN:-}" ]]; then
echo "GITEA_TOKEN is not set"
echo "Go to https://gitea.gchq.icu/user/settings/applications and generate a token"
echo "GITEA_TOKEN is not set. Check if the secret BOT_ACCESS_TOKEN is set in the repository settings."
exit 1
fi
if [[ -z "${BOT_NAME:-}" ]]; then
echo "Env var BOT_NAME is not set. Use the name of the bot user here."
exit 1
fi
if [[ -z "${GITHUB_SERVER_URL:-}" ]]; then
echo "Env var GITHUB_SERVER_URL is not set. Please use the Gitea base URL here."
exit 1
fi
@@ -22,11 +31,12 @@ nix build '.#ui' --out-link "$tmpdir/result"
tar --transform 's,^\.,assets,' -czvf "$tmpdir/assets.tar.gz" -C "$tmpdir"/result/lib/node_modules/*/out .
NAR_HASH=$(nix-prefetch-url --unpack file://<(cat "$tmpdir/assets.tar.gz"))
owner=ui-asset-bot
owner=$BOT_NAME
package_name=ui
package_version=$NAR_HASH
baseurl=$GITHUB_SERVER_URL
url="https://gitea.gchq.icu/api/packages/$owner/generic/$package_name/$package_version/assets.tar.gz"
url="$baseurl/api/packages/$owner/generic/$package_name/$package_version/assets.tar.gz"
set +x
curl --upload-file "$tmpdir/assets.tar.gz" -X PUT "$url?token=$GITEA_TOKEN"
set -x