From 58cd2eb78c7177eaf5839ce7d09c7b0c9b0ef94a Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 1 Jun 2024 12:54:45 +0800 Subject: [PATCH] activate CI --- .github/workflows/main.yml | 310 +++++++++++++++++----------------- .github/workflows/website.yml | 78 ++++----- 2 files changed, 194 insertions(+), 194 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b91004f7..f9bc8291 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,157 +1,157 @@ -# name: build -# on: -# push: -# paths-ignore: -# - 'docs/**' -# - 'web/**' -# - '**.md' -# pull_request: -# paths-ignore: -# - 'docs/**' -# - 'web/**' -# - '**.md' -# jobs: -# build_win32_amalgamated: -# runs-on: windows-latest -# steps: -# - uses: actions/checkout@v4 -# - uses: ilammy/msvc-dev-cmd@v1 -# - name: Compile -# shell: powershell -# run: | -# python amalgamate.py -# cd amalgamated -# cl.exe /std:c++17 /EHsc /utf-8 /Ox /I. /DPK_ENABLE_OS=1 main.cpp /link /out:pkpy.exe -# - uses: actions/upload-artifact@v3 -# with: -# path: amalgamated/pkpy.exe -# build_win32: -# runs-on: windows-latest -# steps: -# - uses: actions/checkout@v4 -# - uses: ilammy/msvc-dev-cmd@v1 -# - name: Compile -# shell: bash -# run: | -# mkdir -p output/windows/x86_64 -# python cmake_build.py -# cp main.exe output/windows/x86_64 -# cp pocketpy.dll output/windows/x86_64 -# - uses: actions/upload-artifact@v3 -# with: -# path: output -# - name: Unit Test -# run: python scripts/run_tests.py -# - name: Benchmark -# run: python scripts/run_tests.py benchmark -# build_linux: -# runs-on: ubuntu-20.04 -# steps: -# - uses: actions/checkout@v4 -# - name: Setup Clang -# uses: egor-tensin/setup-clang@v1 -# with: -# version: 15 -# platform: x64 -# - name: Install libc++ -# run: sudo apt-get install -y libc++-15-dev libc++1-15 libc++abi-15-dev libc++abi1-15 libclang-rt-15-dev -# - name: Unit Test with Coverage -# run: bash run_tests.sh -# - name: Upload coverage reports to Codecov -# uses: codecov/codecov-action@v4 -# with: -# token: ${{ secrets.CODECOV_TOKEN }} -# directory: .coverage -# if: github.ref == 'refs/heads/main' -# - name: Compile -# run: | -# mkdir -p output/linux/x86_64 -# python cmake_build.py -# cp main output/linux/x86_64 -# cp libpocketpy.so output/linux/x86_64 -# env: -# CXX: clang++ -# CC: clang -# - uses: actions/upload-artifact@v3 -# with: -# path: output -# - name: Benchmark -# run: python scripts/run_tests.py benchmark -# - name: C Binding Test -# run: bash run_c_binding_test.sh -# build_linux_x86: -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# - name: Setup Alpine Linux for aarch64 -# uses: jirutka/setup-alpine@v1 -# with: -# arch: x86 -# packages: gcc g++ make cmake libc-dev linux-headers python3 -# - name: Build and Test -# run: | -# uname -m -# python cmake_build.py -# python scripts/run_tests.py -# python scripts/run_tests.py benchmark -# shell: alpine.sh --root {0} -# build_darwin: -# runs-on: macos-latest -# steps: -# - uses: actions/checkout@v4 -# - name: Compile and Test -# run: | -# python cmake_build.py -# python scripts/run_tests.py -# - name: Benchmark -# run: python scripts/run_tests.py benchmark -# - run: | -# python amalgamate.py -# cd plugins/macos/pocketpy -# mkdir -p output/macos -# xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -# cp -r build/Release/pocketpy.bundle output/macos -# - uses: actions/upload-artifact@v3 -# with: -# path: plugins/macos/pocketpy/output -# build_android: -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# - uses: nttld/setup-ndk@v1 -# id: setup-ndk -# with: -# ndk-version: r23 -# local-cache: false -# add-to-path: false -# - name: Compile Shared Library -# run: | -# bash build_android.sh arm64-v8a -# bash build_android.sh armeabi-v7a -# bash build_android.sh x86_64 +name: build +on: + push: + paths-ignore: + - 'docs/**' + - 'web/**' + - '**.md' + pull_request: + paths-ignore: + - 'docs/**' + - 'web/**' + - '**.md' +jobs: + build_win32_amalgamated: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: ilammy/msvc-dev-cmd@v1 + - name: Compile + shell: powershell + run: | + python amalgamate.py + cd amalgamated + cl.exe /std:c++17 /EHsc /utf-8 /Ox /I. /DPK_ENABLE_OS=1 main.cpp /link /out:pkpy.exe + - uses: actions/upload-artifact@v3 + with: + path: amalgamated/pkpy.exe + build_win32: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: ilammy/msvc-dev-cmd@v1 + - name: Compile + shell: bash + run: | + mkdir -p output/windows/x86_64 + python cmake_build.py + cp main.exe output/windows/x86_64 + cp pocketpy.dll output/windows/x86_64 + - uses: actions/upload-artifact@v3 + with: + path: output + - name: Unit Test + run: python scripts/run_tests.py + - name: Benchmark + run: python scripts/run_tests.py benchmark + build_linux: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - name: Setup Clang + uses: egor-tensin/setup-clang@v1 + with: + version: 15 + platform: x64 + - name: Install libc++ + run: sudo apt-get install -y libc++-15-dev libc++1-15 libc++abi-15-dev libc++abi1-15 libclang-rt-15-dev + - name: Unit Test with Coverage + run: bash run_tests.sh + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + directory: .coverage + if: github.ref == 'refs/heads/main' + - name: Compile + run: | + mkdir -p output/linux/x86_64 + python cmake_build.py + cp main output/linux/x86_64 + cp libpocketpy.so output/linux/x86_64 + env: + CXX: clang++ + CC: clang + - uses: actions/upload-artifact@v3 + with: + path: output + - name: Benchmark + run: python scripts/run_tests.py benchmark + - name: C Binding Test + run: bash run_c_binding_test.sh + build_linux_x86: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Alpine Linux for aarch64 + uses: jirutka/setup-alpine@v1 + with: + arch: x86 + packages: gcc g++ make cmake libc-dev linux-headers python3 + - name: Build and Test + run: | + uname -m + python cmake_build.py + python scripts/run_tests.py + python scripts/run_tests.py benchmark + shell: alpine.sh --root {0} + build_darwin: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - name: Compile and Test + run: | + python cmake_build.py + python scripts/run_tests.py + - name: Benchmark + run: python scripts/run_tests.py benchmark + - run: | + python amalgamate.py + cd plugins/macos/pocketpy + mkdir -p output/macos + xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO + cp -r build/Release/pocketpy.bundle output/macos + - uses: actions/upload-artifact@v3 + with: + path: plugins/macos/pocketpy/output + build_android: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: r23 + local-cache: false + add-to-path: false + - name: Compile Shared Library + run: | + bash build_android.sh arm64-v8a + bash build_android.sh armeabi-v7a + bash build_android.sh x86_64 -# mkdir -p output/android/arm64-v8a -# mkdir -p output/android/armeabi-v7a -# mkdir -p output/android/x86_64 + mkdir -p output/android/arm64-v8a + mkdir -p output/android/armeabi-v7a + mkdir -p output/android/x86_64 -# cp build/android/arm64-v8a/libpocketpy.so output/android/arm64-v8a -# cp build/android/armeabi-v7a/libpocketpy.so output/android/armeabi-v7a -# cp build/android/x86_64/libpocketpy.so output/android/x86_64 -# env: -# ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} -# - uses: actions/upload-artifact@v3 -# with: -# path: output -# build_ios: -# runs-on: macos-latest -# steps: -# - uses: actions/checkout@v4 -# - name: Compile Frameworks -# run: | -# git clone https://github.com/leetal/ios-cmake --depth 1 ~/ios-cmake -# bash build_ios.sh -# mkdir -p output/ios -# cp -r build/pocketpy.xcframework output/ios/pocketpy.xcframework -# - uses: actions/upload-artifact@v3 -# with: -# path: output + cp build/android/arm64-v8a/libpocketpy.so output/android/arm64-v8a + cp build/android/armeabi-v7a/libpocketpy.so output/android/armeabi-v7a + cp build/android/x86_64/libpocketpy.so output/android/x86_64 + env: + ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} + - uses: actions/upload-artifact@v3 + with: + path: output + build_ios: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - name: Compile Frameworks + run: | + git clone https://github.com/leetal/ios-cmake --depth 1 ~/ios-cmake + bash build_ios.sh + mkdir -p output/ios + cp -r build/pocketpy.xcframework output/ios/pocketpy.xcframework + - uses: actions/upload-artifact@v3 + with: + path: output diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index ac8c79b2..7d80a048 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -1,42 +1,42 @@ -# name: website +name: website -# on: -# push: -# branches: [ main ] -# pull_request: -# branches: [ main ] +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] -# permissions: -# contents: write +permissions: + contents: write -# jobs: -# deploy: -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# ################################################### -# - uses: actions/setup-node@v3.1.1 -# - name: Retype build -# run: | -# python scripts/build_references.py -# cd docs -# npm install retypeapp --global -# retype build -# ################################################### -# - name: Setup emsdk -# uses: mymindstorm/setup-emsdk@v12 -# with: -# version: 3.1.25 -# actions-cache-folder: 'emsdk-cache' -# - name: Compile -# run: | -# bash build_web.sh -# mv web docs/.retype/static -# ################################################### -# - uses: crazy-max/ghaction-github-pages@v3 -# with: -# target_branch: gh-pages -# build_dir: docs/.retype -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# if: github.ref == 'refs/heads/main' +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + ################################################### + - uses: actions/setup-node@v3.1.1 + - name: Retype build + run: | + python scripts/build_references.py + cd docs + npm install retypeapp --global + retype build + ################################################### + - name: Setup emsdk + uses: mymindstorm/setup-emsdk@v12 + with: + version: 3.1.25 + actions-cache-folder: 'emsdk-cache' + - name: Compile + run: | + bash build_web.sh + mv web docs/.retype/static + ################################################### + - uses: crazy-max/ghaction-github-pages@v3 + with: + target_branch: gh-pages + build_dir: docs/.retype + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: github.ref == 'refs/heads/main'