diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8a6eeaa..11aa9f9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,8 +30,6 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'recursive' - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - name: Prepare run: | @@ -51,11 +49,17 @@ jobs: echo "::set-output name=tag::$tag" echo "::set-output name=name::$name" - - name: Configure the project - uses: threeal/cmake-action@v1.3.0 + # - name: Configure the project + # uses: threeal/cmake-action@v1.3.0 + # - name: Build the project + # run: cmake --build build + - name: Build the project - run: cmake --build build + run: | + export DOCKER_UID=$UID + export DOCKER_GID=$GID + docker-compose up - name: Upload prepare run: | @@ -71,13 +75,87 @@ jobs: uses: actions/upload-artifact@v2.3.1 with: # Artifact name - name: wechat-devtools-${{ matrix.ARCH }}.build + name: wx-compiler-${{ matrix.ARCH }}.build path: tmp/build + test: + name: Test for spec + needs: + - build + runs-on: ubuntu-20.04 + strategy: + matrix: + node-version: [16.x] + ARCH: ['x86_64'] + steps: + - uses: actions/checkout@v2 + with: + submodules: 'recursive' + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + # Version Spec of the version to use in SemVer notation. + # It also emits such aliases as lts, latest, nightly and canary builds + # Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node + node-version: '16.20.2' + check-latest: false + - name: Download artifacts + uses: actions/download-artifact@v2 + + - name: Inspect directory after downloading artifacts + run: ls -alFR + + - name: Prepare + run: | + set -x -u -o pipefail + source /etc/os-release + + # Get rid of packages installed from ppa:ondrej/php so that we will be able to install wine32:i386 without conflicts + # (see issue https://github.com/actions/virtual-environments/issues/4589) + # In detail we: + # 1. Remove all packages that ppa:ondrej/php has but plain Ubuntu doesn't, e.g. everything PHP + # 2. Revert (remaining) packages that ppa:ondrej/php and plain Ubuntu share, back to the plain Ubuntu version + # 3. Assert that no packages from ppa:ondrej/php are left installed + dpkg -l | grep '^ii' | grep -F deb.sury.org | awk '{print $2}' | grep '^php' \ + | xargs -r -t sudo apt-get remove --yes libpcre2-posix3 libzip4 + dpkg -l | grep '^ii' | grep -F deb.sury.org | awk '{print $2}' | sed "s,\$,/${UBUNTU_CODENAME}," \ + | xargs -r -t sudo apt-get install --yes --no-install-recommends --allow-downgrades -V + ! dpkg -l | grep '^ii' | grep -F deb.sury.org + + sudo apt update + sudo apt install -y wine64 + sudo apt-add-repository universe + sudo dpkg --add-architecture i386 + dpkg --print-foreign-architectures + + sudo apt update + sudo apt install libwine + echo "install wine32..." + sudo apt install wine32 + sudo apt-get install wine-binfmt + sudo update-binfmts --import /usr/share/binfmts/wine + + corepack enable + ls -l + mkdir build + cp **build/wcc build + cp **build/wcsc build + chmod +x build/* + ls -l build + node -v + pnpm install + + - name: Test + run: | + ls -l test/wine + # ./test/wine/wcc.exe + pnpm run test-prepare + pnpm run test + upload: name: Create release and upload artifacts needs: - - build + - test runs-on: ubuntu-latest steps: - name: Download artifacts diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c1d5761 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3" +services: + wx_compiler: + image: jiyecafe/wechat-devtools-build:v3 + # build: + # context: ./docker + # dockerfile: Dockerfile + volumes: + - .:/workspace + environment: + # - ACTION_MODE=${ACTION_MODE:-false} + # - https_proxy=${https_proxy:-} + - WINE=${WINE:-false} + - LOCAL_USER_ID=${DOCKER_UID:-1000} + - LOCAL_GROUP_ID=${DOCKER_GID:-1000} + # - BUILD_VERSION=${BUILD_VERSION:-v0} + entrypoint: /workspace/docker/docker-entrypoint + userns_mode: "host" \ No newline at end of file diff --git a/docker/docker-entrypoint b/docker/docker-entrypoint new file mode 100755 index 0000000..c21416c --- /dev/null +++ b/docker/docker-entrypoint @@ -0,0 +1,35 @@ +#!/bin/bash + +strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBC +echo "----" +strings /lib/x86_64-linux-gnu/libc.so.6 | grep GLIBC_ + +notice() { + echo -e "\033[36m $1 \033[0m " +} + +rm -rf /tmp/vscode-ripgrep-cache-1.13.2/ripgrep-v13.0.0-4-x86_64-unknown-linux-musl.tar.gz + +if [ "$(id -u)" -eq '0' ];then + USER_ID=${LOCAL_USER_ID:-1000} + GROUP_ID=${LOCAL_GROUP_ID:-1000} + notice "$USER_ID, $GROUP_ID" + usermod -u ${USER_ID} -g ${GROUP_ID} user > /dev/null 2>&1 + chown -R ${USER_ID}:${GROUP_ID} /workspace > /dev/null 2>&1 + # apt install software-properties-common -y + # add-apt-repository ppa:ubuntu-toolchain-r/test + # apt update + # apt install gcc-6 g++-6 -y + # cd /usr/bin + # rm gcc g++ + # ln -s ./gcc-6 gcc + # ln -s ./g++-6 g++ + # ls -l + # cat /etc/passwd + apt install cmake -y + exec gosu user docker/entrypoint + +fi + +echo "nothing" +# exec /usr/local/bin/gosu user entrypoint \ No newline at end of file diff --git a/docker/entrypoint b/docker/entrypoint new file mode 100755 index 0000000..10bbbc4 --- /dev/null +++ b/docker/entrypoint @@ -0,0 +1,13 @@ +#!/bin/bash +gcc --version +g++ --version +# cmake --verion +cd /workspace +rm -rf ./build +mkdir build +cd build +cmake .. +cmake --build . --config Release --target wcc +cmake --build . --config Release --target wcsc +readelf -s ./wcc | grep -oP "GLIBC.*" | sort | uniq +readelf -s ./wcsc | grep -oP "GLIBC.*" | sort | uniq \ No newline at end of file diff --git a/test/spec/prepare/miniprogram-demo b/test/spec/prepare/miniprogram-demo index 0788bee..77ae032 100755 --- a/test/spec/prepare/miniprogram-demo +++ b/test/spec/prepare/miniprogram-demo @@ -4,6 +4,7 @@ test_dir=$(cd `dirname $0`/../.. && pwd -P) project_dir="$test_dir/projects/${0##*/}" cd "$project_dir" +echo "prepare for ${project_dir}" git submodule set-url miniprogram/packageSkylineExamples https://github.com/wechat-miniprogram/awesome-skyline.git git submodule update diff --git a/test/spec/prepare/tdesign-miniprogram-starter-retail b/test/spec/prepare/tdesign-miniprogram-starter-retail index 225f9bb..fd0b69b 100755 --- a/test/spec/prepare/tdesign-miniprogram-starter-retail +++ b/test/spec/prepare/tdesign-miniprogram-starter-retail @@ -5,9 +5,12 @@ test_dir=$(cd `dirname $0`/../.. && pwd -P) project_dir="$test_dir/projects/${0##*/}" cd "$project_dir" +echo "prepare for ${project_dir}" echo "exec pnpm install" +sed -i 's#"^#"~#g' ./package.json pnpm install +pnpm add tdesign-miniprogram@1.0.0 echo "build miniprogram_npm" node "$test_dir/spec/build-npm-mini.js" "$project_dir"