From 89837495aad6912bfb8a0896fedacf80f5acf0a8 Mon Sep 17 00:00:00 2001 From: lifegpc Date: Thu, 28 Jul 2022 12:43:14 +0800 Subject: [PATCH] Add github pages for document --- .github/workflows/github-pages.yaml | 86 +++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/github-pages.yaml diff --git a/.github/workflows/github-pages.yaml b/.github/workflows/github-pages.yaml new file mode 100644 index 0000000..4c781eb --- /dev/null +++ b/.github/workflows/github-pages.yaml @@ -0,0 +1,86 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "master" branch + push: + branches: [ "master" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Check out + uses: actions/checkout@v3 + with: + fetch-depth: 0 + submodules: true + - name: Get cache key + id: cache_key + run: | + cd scripts + python3 get_cache_key.py exiv2 libzip x264 ffmpeg || exit 1 + - name: Cache + id: cache + uses: actions/cache@v2 + with: + path: clib/ + key: ${{ runner.os }}-${{ steps.cache_key.outputs.cache_key }} + - name: Setup NASM + if: steps.cache.outputs.cache-hit != 'true' + uses: ilammy/setup-nasm@v1 + - name: Build thirdparty library + if: steps.cache.outputs.cache-hit != 'true' + run: | + export PKG_CONFIG_PATH=`pwd`/clib/lib/pkgconfig + cp scripts/build_*.sh -v ./ || exit 1 + ./build_exiv2.sh || exit 1 + ./build_libzip.sh || exit 1 + ./build_x264.sh || exit 1 + ./build_ffmpeg.sh || exit 1 + - name: Build + run: | + export PKG_CONFIG_PATH=`pwd`/clib/lib/pkgconfig + export CMAKE_PREFIX_PATH=`pwd`/clib + export "LIBRARY_PATH=$LIBRARY_PATH:`pwd`/clib/lib" + export "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/clib/lib" + cargo build --features all -vv || exit 1 + - name: Document + run: | + export PKG_CONFIG_PATH=`pwd`/clib/lib/pkgconfig + export CMAKE_PREFIX_PATH=`pwd`/clib + export "LIBRARY_PATH=$LIBRARY_PATH:`pwd`/clib/lib" + export "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/clib/lib" + cargo doc --features all -vv || exit 1 + - name: Add index files + run: | + echo 'Content Moved' > target/doc/index.html + - name: Package document files + run: | + tar \ + --dereference --hard-dereference \ + --directory target/doc \ + -cvf ${{ runner.temp }}/artifact.tar \ + --exclude=.git \ + --exclude=.github \ + . + - name: Upload documents + uses: actions/upload-artifact@main + with: + name: github-pages + path: ${{ runner.temp }}/artifact.tar + retention-days: 31