mirror of
https://github.com/zoriya/cish.git
synced 2025-12-06 07:16:16 +00:00
Add examples
This commit is contained in:
39
.cish/docker.sh
Normal file
39
.cish/docker.sh
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cish add docker cish:pathfilter
|
||||||
|
|
||||||
|
pathfilter "$CTX"
|
||||||
|
cd "$CTX"
|
||||||
|
|
||||||
|
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
|
||||||
|
docker login -u "$GHCR_USERNAME" -p "$GHCR_PASSWORD" ghcr.io
|
||||||
|
|
||||||
|
SHOULD_PUSH=$([[ "$EVENT" == "tag" || "$REF" == "master" ]] && echo true || echo false)
|
||||||
|
|
||||||
|
IMAGE="$REPOSITORY_OWNER/kyoo_$CTX"
|
||||||
|
# TODO:
|
||||||
|
# - name: Docker meta
|
||||||
|
# id: meta
|
||||||
|
# uses: docker/metadata-action@v5
|
||||||
|
# with:
|
||||||
|
# images: |
|
||||||
|
# docker.io/${{matrix.image}},enable=${{ env.DOCKERHUB_ENABLED }}
|
||||||
|
# ghcr.io/${{matrix.image}}
|
||||||
|
# tags: |
|
||||||
|
# type=edge
|
||||||
|
# type=ref,event=branch
|
||||||
|
# type=ref,event=pr
|
||||||
|
# type=semver,pattern={{version}}
|
||||||
|
# type=semver,pattern={{major}}.{{minor}}
|
||||||
|
|
||||||
|
# TODO: auto-cache this
|
||||||
|
docker build . \
|
||||||
|
--push "$SHOULD_PUSH" \
|
||||||
|
--tag "docker.io/$IMAGE:$TAG" \
|
||||||
|
--tag "ghcr.io/$IMAGE:$TAG"
|
||||||
|
|
||||||
|
if $SHOULD_PUSH; then
|
||||||
|
pkg add github:ms-jpq/sync-dockerhub-readme
|
||||||
|
dockerhub-sync -u "$DOCKER_USERNAME" -p "$DOCKER_PASSOWRD" "$IMAGE" ./README.md
|
||||||
|
fi
|
||||||
3
.cish/ex.sh
Normal file
3
.cish/ex.sh
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cish add "go@$VERSION"
|
||||||
4
.cish/push/coding-style/api.sh
Normal file
4
.cish/push/coding-style/api.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
pkg add biome
|
||||||
|
biome ci ./api
|
||||||
6
.cish/push/coding-style/auth.sh
Normal file
6
.cish/push/coding-style/auth.sh
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
pkg add go
|
||||||
|
if [ "$(gofmt -s -l ./auth | wc -l)" -gt 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
4
.cish/push/coding-style/front.sh
Normal file
4
.cish/push/coding-style/front.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
pkg add biome
|
||||||
|
biome ci ./front
|
||||||
4
.cish/push/coding-style/scanner.sh
Normal file
4
.cish/push/coding-style/scanner.sh
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
pkg add ruff
|
||||||
|
ruff format --check ./scanner
|
||||||
5
.cish/push/docker.sh
Normal file
5
.cish/push/docker.sh
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
for ctx in back api front scanner autosync transcoder auth; do
|
||||||
|
cish run --name "$ctx" ../docker.sh --ctx "$ctx"
|
||||||
|
done
|
||||||
12
.cish/push/helm-releaes.sh
Normal file
12
.cish/push/helm-releaes.sh
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cish add helm docker
|
||||||
|
|
||||||
|
docker login -u "$GHCR_USERNAME" -p "$GHCR_PASSWORD" ghcr.io
|
||||||
|
helm dependency update ./chart
|
||||||
|
|
||||||
|
TAG=${REF#refs/tags/v/}
|
||||||
|
REPO_NAME="$(echo "oci://ghcr.io/${REPOSITORY_OWNER}/helm-charts" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
helm package ./chart --version "$TAG" --app-version "$TAG"
|
||||||
|
helm push kyoo-*.tgz "${REPO_NAME}"
|
||||||
15
.cish/push/helm-test.sh
Normal file
15
.cish/push/helm-test.sh
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cish add helm kind
|
||||||
|
helm lint ./chart
|
||||||
|
|
||||||
|
helm dependency update ./chart
|
||||||
|
|
||||||
|
kind create cluster
|
||||||
|
|
||||||
|
helm install test-release ./chart --dry-run --debug
|
||||||
|
helm install test-release ./chart
|
||||||
|
|
||||||
|
kubectl get all
|
||||||
|
|
||||||
|
kind delete cluster
|
||||||
30
.cish/push/hurl.sh
Normal file
30
.cish/push/hurl.sh
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cish add pathfilter
|
||||||
|
cd ./auth
|
||||||
|
pathfilter ./auth
|
||||||
|
|
||||||
|
cish start postgres:15 \
|
||||||
|
--port 5432:5432 \
|
||||||
|
-e POSTGRES_USER=kyoo \
|
||||||
|
-e POSTGRES_PASSWORD=password \
|
||||||
|
--health-cmd pg_isready \
|
||||||
|
--health-interval 10s \
|
||||||
|
--health-timeout 5s \
|
||||||
|
--health-retries 5 \
|
||||||
|
|
||||||
|
cish add hurk go
|
||||||
|
|
||||||
|
go mod download
|
||||||
|
go build -o ./keibi
|
||||||
|
|
||||||
|
export PGHOST=localhost
|
||||||
|
export FIRST_USER_CLAIMS='{"permissions": ["users.read"]}'
|
||||||
|
export KEIBI_APIKEY_HURL=1234apikey
|
||||||
|
export KEIBI_APIKEY_HURL_CLAIMS='{"permissions": ["apikeys.write", "apikeys.read"]}'
|
||||||
|
./keibi > logs &
|
||||||
|
trap 'cat logs' EXIT
|
||||||
|
wget --retry-connrefused --retry-on-http-error=502 http://localhost:4568/auth/health
|
||||||
|
|
||||||
|
hurl --error-format long --variable host=http://localhost:4568/auth tests/*
|
||||||
11
.cish/push/matrix.sh
Normal file
11
.cish/push/matrix.sh
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cish start postgres
|
||||||
|
|
||||||
|
for job in v1.22.0 v1.0.0 titi; do
|
||||||
|
cish run ../ex.sh --version=$job
|
||||||
|
|
||||||
|
cish run --name "go-$job" --ref=master - --version=$job <<-eof
|
||||||
|
cish add go@$VERSION
|
||||||
|
eof
|
||||||
|
done
|
||||||
14
.cish/push/native-build.sh
Normal file
14
.cish/push/native-build.sh
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cish add cish:pathfilter expo yarn
|
||||||
|
pathfilter front
|
||||||
|
|
||||||
|
yarn install --immutable
|
||||||
|
|
||||||
|
cish secret EXPO_TOKEN
|
||||||
|
yarn build:mobile:apk | tee log.txt
|
||||||
|
|
||||||
|
ASSET_URL=$(jq '.[0].artifacts.buildUrl' -r < log.txt)
|
||||||
|
echo "The android url is $ASSET_URL"
|
||||||
|
|
||||||
|
wget -O "$RELEASE/kyoo.apk" "$ASSET_URL"
|
||||||
9
.cish/push/native-update.sh
Normal file
9
.cish/push/native-update.sh
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cish add cish:pathfilter expo yarn
|
||||||
|
pathfilter front
|
||||||
|
|
||||||
|
yarn install --immutable
|
||||||
|
|
||||||
|
cish secret EXPO_TOKEN
|
||||||
|
yarn update
|
||||||
7
.cish/push/release.sh
Normal file
7
.cish/push/release.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
VERSION=${REF:1} # Remove v prefix
|
||||||
|
VERSION=${REF%.*} # Remove minor version
|
||||||
|
sed "s/edge/$VERSION/" -i docker-compose.yml
|
||||||
|
|
||||||
|
cp docker-compose.yaml .env.example "$RELASE/"
|
||||||
23
.cish/push/test.sh
Normal file
23
.cish/push/test.sh
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cish start postgres:15 \
|
||||||
|
--port 5432:5432 \
|
||||||
|
-e POSTGRES_USER=kyoo \
|
||||||
|
-e POSTGRES_PASSWORD=password \
|
||||||
|
--health-cmd pg_isready \
|
||||||
|
--health-interval 10s \
|
||||||
|
--health-timeout 5s \
|
||||||
|
--health-retries 5 \
|
||||||
|
|
||||||
|
pkg add bun pathfilter
|
||||||
|
cd ./api
|
||||||
|
|
||||||
|
if pathfilter ./api; then
|
||||||
|
echo "No changes on ./api. aborting"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
bun install --frozen-lockfile
|
||||||
|
bun test
|
||||||
|
PGHOST=localhost bun test
|
||||||
Reference in New Issue
Block a user