Compare commits

...

7 Commits

Author SHA1 Message Date
7671127311 Merge pull request 'ci: upload to gitea packages instead of s3' (#16) from jixunmoe/um-web:ci/use-gitea-packages into master
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #16
2022-11-27 00:48:19 +00:00
70c78772ec ci: use same node image to skip dependency install.
All checks were successful
continuous-integration/drone/pr Build is passing
2022-11-27 00:45:15 +00:00
26e50473f2 ci: skip upload step when api key is empty (usually happens for PR)
Some checks reported errors
continuous-integration/drone/pr Build was killed
2022-11-27 00:43:37 +00:00
1fc7142957 ci: use emsdk instead of download emsdk each build.
Some checks reported errors
continuous-integration/drone/pr Build was killed
2022-11-27 00:41:44 +00:00
ff06c81735 ci: specify debian image + set dependency
Some checks failed
continuous-integration/drone/pr Build is failing
2022-11-27 00:26:21 +00:00
9b76ef2959 ci: mark upload script as executable
Some checks failed
continuous-integration/drone/pr Build is failing
2022-11-27 00:17:41 +00:00
d733dba221 ci: upload to gitea packages instead of s3
Some checks failed
continuous-integration/drone/pr Build is failing
2022-11-26 23:52:48 +00:00
4 changed files with 69 additions and 52 deletions

View File

@ -4,34 +4,27 @@ type: docker
name: default name: default
steps: steps:
- name: build-wasm
image: emscripten/emsdk:3.0.0
commands:
- ./scripts/build-wasm.sh
- name: build - name: build
image: node:16.18-bullseye image: node:16.18-bullseye
commands: commands:
- apt-get update - apt-get update
- apt-get install -y cmake jq zip - apt-get install -y jq zip
- ./scripts/build-wasm.sh
- npm ci - npm ci
- npm run test - npm run test
- ./scripts/build-and-package.sh legacy - ./scripts/build-and-package.sh legacy
- ./scripts/build-and-package.sh extension - ./scripts/build-and-package.sh extension
- ./scripts/build-and-package.sh modern - ./scripts/build-and-package.sh modern
- sha256sum *.zip > sha256sum.txt
- mkdir -p upload
- mv *.zip sha256sum.txt upload/
- name: upload - name: upload artifact
image: "plugins/s3" image: node:16.18-bullseye
settings: environment:
path_style: true DRONE_GITEA_SERVER: https://git.unlock-music.dev
endpoint: GITEA_API_KEY:
from_secret: S3_ENDPOINT from_secret: GITEA_API_KEY
access_key: commands:
from_secret: S3_ACCESS_KEY - ./scripts/upload-packages.sh
secret_key:
from_secret: S3_SECRET_KEY
bucket:
from_secret: S3_BUCKET
region: "auto"
source: "upload/*"
strip_prefix: "upload/"
target: "${DRONE_REPO}/${DRONE_BUILD_NUMBER}/"

19
scripts/upload-packages.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
set -ex
cd "$(git rev-parse --show-toplevel)"
if [ -z "$GITEA_API_KEY" ]; then
echo "GITEA_API_KEY is empty, skip upload."
exit 0
fi
URL_BASE="$DRONE_GITEA_SERVER/api/packages/${DRONE_REPO_NAMESPACE}/generic/${DRONE_REPO_NAME}-build"
for ZIP_NAME in *.zip; do
UPLOAD_URL="${URL_BASE}/${DRONE_BUILD_NUMBER}/${ZIP_NAME}"
sha256sum "${ZIP_NAME}"
curl -sLifu "um-release-bot:$GITEA_API_KEY" -T "${ZIP_NAME}" "${UPLOAD_URL}"
echo "Uploaded to: ${UPLOAD_URL}"
done

View File

@ -11,18 +11,20 @@ if [ -z "$BUILD_TYPE" ]; then
BUILD_TYPE=Release BUILD_TYPE=Release
fi fi
mkdir -p build/wasm # CI: already had emsdk installed.
if [ ! -d ../../build/emsdk ]; then if ! command -v emcc; then
if [ ! -d ../../build/emsdk ]; then
git clone https://github.com/emscripten-core/emsdk.git ../../build/emsdk git clone https://github.com/emscripten-core/emsdk.git ../../build/emsdk
fi
pushd ../../build/emsdk
./emsdk install 3.0.0
./emsdk activate 3.0.0
source ./emsdk_env.sh
popd # ../../build/emsdk
fi fi
pushd ../../build/emsdk mkdir -p build/wasm
#git pull
./emsdk install 3.0.0
./emsdk activate 3.0.0
source ./emsdk_env.sh
popd # ../../build/emsdk
pushd build/wasm pushd build/wasm
emcmake cmake -DCMAKE_BUILD_TYPE="$BUILD_TYPE" ../.. emcmake cmake -DCMAKE_BUILD_TYPE="$BUILD_TYPE" ../..
make -j make -j

View File

@ -11,17 +11,20 @@ if [ -z "$BUILD_TYPE" ]; then
BUILD_TYPE=Release BUILD_TYPE=Release
fi fi
mkdir -p build/wasm # CI: already had emsdk installed.
if [ ! -d ../../build/emsdk ]; then if ! command -v emcc; then
if [ ! -d ../../build/emsdk ]; then
git clone https://github.com/emscripten-core/emsdk.git ../../build/emsdk git clone https://github.com/emscripten-core/emsdk.git ../../build/emsdk
fi
pushd ../../build/emsdk
./emsdk install 3.0.0
./emsdk activate 3.0.0
source ./emsdk_env.sh
popd # ../../build/emsdk
fi fi
pushd ../../build/emsdk mkdir -p build/wasm
./emsdk install 3.0.0
./emsdk activate 3.0.0
source ./emsdk_env.sh
popd # ../../build/emsdk
pushd build/wasm pushd build/wasm
emcmake cmake -DCMAKE_BUILD_TYPE="$BUILD_TYPE" ../.. emcmake cmake -DCMAKE_BUILD_TYPE="$BUILD_TYPE" ../..
make -j make -j