-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# vi: set ft=conf | ||
|
||
# FIXME: don't skip windows | ||
[windows] skip 'curl makes github actions hang' | ||
|
||
# convert crlf to lf on windows | ||
[windows] dos2unix http1.txt http2.txt http3.txt goget.txt gitclone.txt | ||
|
||
# start soft serve | ||
exec soft serve & | ||
# wait for SSH server to start | ||
ensureserverrunning SSH_PORT | ||
|
||
# create user | ||
soft user create user1 --key "$USER1_AUTHORIZED_KEY" | ||
|
||
# create access token | ||
soft token create --expires-in '1h' 'repo2' | ||
cp stdout tokenfile | ||
envfile TOKEN=tokenfile | ||
soft token create --expires-in '1ns' 'repo2' | ||
cp stdout etokenfile | ||
envfile ETOKEN=etokenfile | ||
usoft token create 'repo2' | ||
cp stdout utokenfile | ||
envfile UTOKEN=utokenfile | ||
|
||
# push & create repo with some files, commits, tags... | ||
mkdir ./repo2 | ||
git -c init.defaultBranch=master -C repo2 init | ||
mkfile ./repo2/README.md '# Project\nfoo' | ||
mkfile ./repo2/foo.png 'foo' | ||
mkfile ./repo2/bar.png 'bar' | ||
git -C repo2 remote add origin http://$TOKEN@localhost:$HTTP_PORT/repo2 | ||
git -C repo2 lfs install --local | ||
git -C repo2 lfs track '*.png' | ||
git -C repo2 add -A | ||
git -C repo2 commit -m 'first' | ||
git -C repo2 tag v0.1.0 | ||
git -C repo2 push origin HEAD | ||
git -C repo2 push origin HEAD --tags | ||
|
||
curl -v --request OPTIONS http://localhost:$HTTP_PORT/repo2.git/info/refs -H 'Origin: https://foo.example' -H 'Access-Control-Request-Method: GET' | ||
stderr '.*Method Not Allowed.*' | ||
|
||
# stop the server | ||
stopserver | ||
|
||
# allow cross-origin OPTIONS requests | ||
env SOFT_SERVE_HTTP_CORS_ALLOWED_ORIGINS="https://foo.example" | ||
env SOFT_SERVE_HTTP_CORS_ALLOWED_METHODS="GET,OPTIONS" | ||
env SOFT_SERVE_HTTP_CORS_ALLOWED_HEADERS="Origin,Access-Control-Request-Method" | ||
|
||
# restart soft serve | ||
exec soft serve & | ||
# wait for SSH server to start | ||
ensureserverrunning SSH_PORT | ||
|
||
curl -v --request OPTIONS http://localhost:$HTTP_PORT/repo2.git/info/refs -H 'Origin: https://foo.example' -H 'Access-Control-Request-Method: GET' | ||
stderr '.*200 OK.*' | ||
|
||
# stop the server | ||
[windows] stopserver | ||
[windows] ! stderr . |