* feat: docker

* fix: permission

* fix: permission

* fix: permission

* feat: test for spec

* fix: test
This commit is contained in:
msojocs 2023-09-23 21:31:54 +08:00 committed by GitHub
parent 2db605d015
commit 88e6989060
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 155 additions and 7 deletions

View File

@ -30,8 +30,6 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
submodules: 'recursive' submodules: 'recursive'
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
- name: Prepare - name: Prepare
run: | run: |
@ -51,11 +49,17 @@ jobs:
echo "::set-output name=tag::$tag" echo "::set-output name=tag::$tag"
echo "::set-output name=name::$name" echo "::set-output name=name::$name"
- name: Configure the project # - name: Configure the project
uses: threeal/cmake-action@v1.3.0 # uses: threeal/cmake-action@v1.3.0
# - name: Build the project
# run: cmake --build build
- name: Build the project - name: Build the project
run: cmake --build build run: |
export DOCKER_UID=$UID
export DOCKER_GID=$GID
docker-compose up
- name: Upload prepare - name: Upload prepare
run: | run: |
@ -71,13 +75,87 @@ jobs:
uses: actions/upload-artifact@v2.3.1 uses: actions/upload-artifact@v2.3.1
with: with:
# Artifact name # Artifact name
name: wechat-devtools-${{ matrix.ARCH }}.build name: wx-compiler-${{ matrix.ARCH }}.build
path: tmp/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: upload:
name: Create release and upload artifacts name: Create release and upload artifacts
needs: needs:
- build - test
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Download artifacts - name: Download artifacts

18
docker-compose.yml Normal file
View File

@ -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"

35
docker/docker-entrypoint Executable file
View File

@ -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

13
docker/entrypoint Executable file
View File

@ -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

View File

@ -4,6 +4,7 @@ test_dir=$(cd `dirname $0`/../.. && pwd -P)
project_dir="$test_dir/projects/${0##*/}" project_dir="$test_dir/projects/${0##*/}"
cd "$project_dir" cd "$project_dir"
echo "prepare for ${project_dir}"
git submodule set-url miniprogram/packageSkylineExamples https://github.com/wechat-miniprogram/awesome-skyline.git git submodule set-url miniprogram/packageSkylineExamples https://github.com/wechat-miniprogram/awesome-skyline.git
git submodule update git submodule update

View File

@ -5,9 +5,12 @@ test_dir=$(cd `dirname $0`/../.. && pwd -P)
project_dir="$test_dir/projects/${0##*/}" project_dir="$test_dir/projects/${0##*/}"
cd "$project_dir" cd "$project_dir"
echo "prepare for ${project_dir}"
echo "exec pnpm install" echo "exec pnpm install"
sed -i 's#"^#"~#g' ./package.json
pnpm install pnpm install
pnpm add tdesign-miniprogram@1.0.0
echo "build miniprogram_npm" echo "build miniprogram_npm"
node "$test_dir/spec/build-npm-mini.js" "$project_dir" node "$test_dir/spec/build-npm-mini.js" "$project_dir"