mirror of
https://github.com/msojocs/wx-compiler.git
synced 2025-07-19 00:00:04 +08:00
209 lines
6.7 KiB
YAML
209 lines
6.7 KiB
YAML
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
|
|
name: Build Packages
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
push:
|
|
tags:
|
|
- v*
|
|
branches: [ master, dev, ci, module]
|
|
pull_request:
|
|
branches: [ master ]
|
|
# # Allows you to run this workflow manually from the Actions tab
|
|
# workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Base Packages
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
ARCH: ['x86_64']
|
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: 'recursive'
|
|
|
|
- name: Prepare
|
|
run: |
|
|
cd compiler && npm install
|
|
echo "$UID, $GID"
|
|
|
|
- name: Generate TAG
|
|
id: Tag
|
|
run: |
|
|
tag='continuous'
|
|
name='Continuous Build'
|
|
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
|
|
tag='${{ github.ref_name }}'
|
|
name='${{ github.ref_name }}'
|
|
fi
|
|
echo "tag result: $tag - $name"
|
|
echo "::set-output name=tag::$tag"
|
|
echo "::set-output name=name::$name"
|
|
|
|
# - name: Configure the project
|
|
# uses: threeal/cmake-action@v1.3.0
|
|
|
|
# - name: Build the project
|
|
# run: cmake --build build
|
|
|
|
- name: Build the project
|
|
run: |
|
|
export DOCKER_UID=$UID
|
|
export DOCKER_GID=$GID
|
|
docker-compose up
|
|
|
|
- name: Upload prepare
|
|
run: |
|
|
ls -l
|
|
echo "------------------------"
|
|
ls -l build
|
|
mkdir -p tmp/build
|
|
mv build/{wcc,wcsc,wcc_module.node,wcsc_module.node} tmp/build
|
|
cd tmp/build
|
|
ls -l
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v2.3.1
|
|
with:
|
|
# Artifact name
|
|
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: [18.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: '18.12.0'
|
|
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
|
|
cp **build/wcc_module.node build
|
|
cp **build/wcsc_module.node 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
|
|
sudo apt install -y xvfb
|
|
ls -l build
|
|
ls -l test/runner/nwjs/wcc/build/Release
|
|
pnpm run test
|
|
# - uses: ./.github/actions/test
|
|
# with:
|
|
# who-to-greet: 'Mona the Octocat'
|
|
|
|
upload:
|
|
name: Create release and upload artifacts
|
|
needs:
|
|
- test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v2
|
|
- name: Inspect directory after downloading artifacts
|
|
run: ls -alFR
|
|
|
|
- name: Generate TAG
|
|
id: Tag
|
|
run: |
|
|
tag='continuous'
|
|
name='Continuous Build'
|
|
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
|
|
tag='${{ github.ref_name }}'
|
|
name='${{ github.ref_name }}'
|
|
fi
|
|
echo "tag result: $tag - $name"
|
|
echo "::set-output name=tag::$tag"
|
|
echo "::set-output name=name::$name"
|
|
|
|
- name: Create release and upload artifacts
|
|
if: startsWith(github.ref, 'refs/heads/')
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
sudo apt install -y fuse
|
|
wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage
|
|
chmod +x pyuploadtool-x86_64.AppImage
|
|
./pyuploadtool-x86_64.AppImage **build/wcc **build/wcsc
|
|
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v1
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
with:
|
|
# note you'll typically need to create a personal access token
|
|
# with permissions to create releases in the other repo
|
|
name: ${{ steps.tag.outputs.name }}
|
|
tag_name: ${{ steps.tag.outputs.tag }}
|
|
files: |
|
|
**build/wcc
|
|
**build/wcsc
|
|
**build/wcc_module.node
|
|
**build/wcsc_module.node
|