chore: remove statik

pull/1107/head
Ink33 4 years ago
parent 24fdeff599
commit 7d3bc3f0f1
No known key found for this signature in database
GPG Key ID: 5D8B1D036EFB0D2E

@ -9,26 +9,22 @@ jobs:
name: Build name: Build
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: steps:
- name: Set up Go 1.17
- name: Set up Golang uses: actions/setup-go@v2
uses: actions/setup-go@v1
with: with:
go-version: 1.17 go-version: "1.17"
id: go id: go
- name: Check out code into the Go module directory - name: Check out code into the Go module directory
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
clean: false clean: false
submodules: 'recursive' submodules: "recursive"
- run: | - run: |
git fetch --prune --unshallow --tags git fetch --prune --unshallow --tags
- name: Get dependencies and build - name: Get dependencies and build
run: | run: |
go install github.com/rakyll/statik
export PATH=$PATH:~/go/bin/
statik -src=models -f
sudo apt-get update sudo apt-get update
sudo apt-get -y install gcc-mingw-w64-x86-64 sudo apt-get -y install gcc-mingw-w64-x86-64
sudo apt-get -y install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross sudo apt-get -y install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross

@ -27,8 +27,9 @@ jobs:
- name: Build static files - name: Build static files
run: | run: |
cd assets cd assets
yarn install mkdir build
yarn run build cd build
touch test.html
- name: Test - name: Test
run: go test -coverprofile=coverage.txt -covermode=atomic ./... run: go test -coverprofile=coverage.txt -covermode=atomic ./...

@ -4,10 +4,11 @@ go:
node_js: "12.16.3" node_js: "12.16.3"
git: git:
depth: 1 depth: 1
install:
- go get github.com/rakyll/statik
before_script: before_script:
- statik -src=models -f - cd assets
- mkdir build
- cd mkdir
- touch test.html
script: script:
- go test -coverprofile=coverage.txt -covermode=atomic ./... - go test -coverprofile=coverage.txt -covermode=atomic ./...
after_success: after_success:

@ -28,8 +28,6 @@ RUN set -ex \
&& apk add gcc libc-dev git \ && apk add gcc libc-dev git \
&& export COMMIT_SHA=$(git rev-parse --short HEAD) \ && export COMMIT_SHA=$(git rev-parse --short HEAD) \
&& export VERSION=$(git describe --tags) \ && export VERSION=$(git describe --tags) \
&& (cd && go get github.com/rakyll/statik) \
&& statik -src=assets/build/ -include=*.html,*.js,*.json,*.css,*.png,*.svg,*.ico -f \
&& go install -ldflags "-X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.BackendVersion=${VERSION}' \ && go install -ldflags "-X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.BackendVersion=${VERSION}' \
-X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.LastCommit=${COMMIT_SHA}'\ -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.LastCommit=${COMMIT_SHA}'\
-w -s" -w -s"

@ -68,7 +68,7 @@ chmod +x ./cloudreve
## :gear: 构建 ## :gear: 构建
自行构建前需要拥有 `Go >= 1.16`、`yarn`等必要依赖。 自行构建前需要拥有 `Go >= 1.17`、`yarn`等必要依赖。
#### 克隆代码 #### 克隆代码

@ -1,13 +1,16 @@
#!/bin/bash #!/bin/bash
REPO=$(cd $(dirname $0); pwd) REPO=$(
cd $(dirname $0)
pwd
)
COMMIT_SHA=$(git rev-parse --short HEAD) COMMIT_SHA=$(git rev-parse --short HEAD)
VERSION=$(git describe --tags) VERSION=$(git describe --tags)
ASSETS="false" ASSETS="false"
BINARY="false" BINARY="false"
RELEASE="false" RELEASE="false"
debugInfo () { debugInfo() {
echo "Repo: $REPO" echo "Repo: $REPO"
echo "Build assets: $ASSETS" echo "Build assets: $ASSETS"
echo "Build binary: $BINARY" echo "Build binary: $BINARY"
@ -16,28 +19,22 @@ debugInfo () {
echo "Commit: $COMMIT_SHA" echo "Commit: $COMMIT_SHA"
} }
buildAssets () { buildAssets() {
cd $REPO cd $REPO
rm -rf assets/build rm -rf assets/build
rm -f statik/statik.go
export CI=false export CI=false
cd $REPO/assets cd $REPO/assets
yarn --update-checksums
yarn install yarn install
yarn run build yarn run build
cd build
if ! [ -x "$(command -v statik)" ]; then rm -rf *.map
export CGO_ENABLED=0
go get github.com/rakyll/statik
fi
cd $REPO
statik -src=assets/build/ -include=*.html,*.js,*.json,*.css,*.png,*.svg,*.ico,*.ttf -f
} }
buildBinary () { buildBinary() {
cd $REPO cd $REPO
go build -a -o cloudreve -ldflags " -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.BackendVersion=$VERSION' -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.LastCommit=$COMMIT_SHA'" go build -a -o cloudreve -ldflags " -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.BackendVersion=$VERSION' -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.LastCommit=$COMMIT_SHA'"
} }
@ -74,7 +71,7 @@ _build() {
fi fi
} }
release(){ release() {
cd $REPO cd $REPO
## List of architectures and OS to test coss compilation. ## List of architectures and OS to test coss compilation.
SUPPORTED_OSARCH="linux/amd64/gcc linux/arm/arm-linux-gnueabihf-gcc windows/amd64/x86_64-w64-mingw32-gcc linux/arm64/aarch64-linux-gnu-gcc" SUPPORTED_OSARCH="linux/amd64/gcc linux/arm/arm-linux-gnueabihf-gcc windows/amd64/x86_64-w64-mingw32-gcc linux/arm64/aarch64-linux-gnu-gcc"
@ -86,8 +83,8 @@ release(){
} }
usage() { usage() {
echo "Usage: $0 [-a] [-c] [-b] [-r]" 1>&2; echo "Usage: $0 [-a] [-c] [-b] [-r]" 1>&2
exit 1; exit 1
} }
while getopts "bacr:d" o; do while getopts "bacr:d" o; do
@ -114,7 +111,7 @@ while getopts "bacr:d" o; do
;; ;;
esac esac
done done
shift $((OPTIND-1)) shift $((OPTIND - 1))
if [ "$DEBUG" = "true" ]; then if [ "$DEBUG" = "true" ]; then
debugInfo debugInfo

Loading…
Cancel
Save