Skip to content

Commit

Permalink
Update CI scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNetAdmin committed May 13, 2022
1 parent 9e67fd4 commit 84297c7
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 158 deletions.
211 changes: 117 additions & 94 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
- "**/*.md"

jobs:

ci_skip:
runs-on: [ubuntu-latest]
if: "!contains(github.event.head_commit.message, '[ci skip]')"
Expand All @@ -22,122 +21,146 @@ jobs:
- name: Current version
run: echo ${GITHUB_REF}

build_all_without_diff:
runs-on: ubuntu-latest
needs: [ci_skip]
steps:
- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Download Fonts
run: setup_lipsum=n ./script/ci/setup.sh
- name: Build Grad in Docker
run: docker run --mount src=$GITHUB_WORKSPACE/,target=/zjuthesis,type=bind adnrv/texlive:full /zjuthesis/script/ci/github-action/build_grad.sh
- name: Build Undergrad in Docker
run: docker run --mount src=$GITHUB_WORKSPACE/,target=/zjuthesis,type=bind adnrv/texlive:full /zjuthesis/script/ci/github-action/build_undergrad.sh
- name: Upload Output Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: dist-all
path: dist
- name: Upload Log Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: out-ci-all
path: out-ci

build_undergrad:
runs-on: ubuntu-latest
needs: [ci_skip]
steps:
- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Download Fonts
run: ./script/ci/setup.sh
- name: Build Test in Docker
run: docker run --mount src=$GITHUB_WORKSPACE/,target=/zjuthesis,type=bind adnrv/texlive:full /zjuthesis/script/ci/github-action/build_undergrad.sh
- name: Upload Output Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: dist-undergrad
path: dist
- name: Upload Log Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: out-ci-undergrad
path: out-ci
- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Download Fonts
run: ./script/ci/setup.sh
- name: Build Test in Docker
run: docker run --mount src=$GITHUB_WORKSPACE/,target=/zjuthesis,type=bind adnrv/texlive:full /zjuthesis/script/ci/github-action/build_undergrad.sh
- name: Upload Output Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: dist-undergrad
path: dist
- name: Upload Log Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: out-ci-undergrad
path: out-ci

build_grad:
runs-on: ubuntu-latest
needs: [ci_skip]
steps:
- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Download Fonts
run: ./script/ci/setup.sh
- name: Build Test in Docker
run: docker run --mount src=$GITHUB_WORKSPACE/,target=/zjuthesis,type=bind adnrv/texlive:full /zjuthesis/script/ci/github-action/build_grad.sh
- name: Upload Output Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: dist-grad
path: dist
- name: Upload Log Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: out-ci-grad
path: out-ci
- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Download Fonts
run: ./script/ci/setup.sh
- name: Build Test in Docker
run: docker run --mount src=$GITHUB_WORKSPACE/,target=/zjuthesis,type=bind adnrv/texlive:full /zjuthesis/script/ci/github-action/build_grad.sh
- name: Upload Output Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: dist-grad
path: dist
- name: Upload Log Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: out-ci-grad
path: out-ci

diff_pdf:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: [build_grad, build_undergrad]
steps:
- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Download Artifacts
uses: actions/download-artifact@v2
- name: Move Artifacts
run: |
mkdir -p dist
mv dist-grad/*.pdf dist/
mv dist-undergrad/*.pdf dist/
- name: PDF Diff
run: bash script/ci/pdf-diff/diff_report.sh
- name: Upload PDF Diff Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: pdf-diff
path: diff

- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Download Artifacts
uses: actions/download-artifact@v2
- name: Move Artifacts
run: |
mkdir -p dist
mv dist-grad/*.pdf dist/
mv dist-undergrad/*.pdf dist/
- name: PDF Diff
run: bash script/ci/pdf-diff/diff_report.sh
- name: Upload PDF Diff Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: pdf-diff
path: diff

overleaf_update:
runs-on: ubuntu-latest
needs: [diff_pdf]
needs: [diff_pdf, build_all_without_diff]
if: "contains(github.repository_owner, 'TheNetAdmin')"
steps:
- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Git setup username
run: git config --global user.name "TheNetAdmin"
- name: Git setup email
run: git config --global user.email "[email protected]"
- name: Install Python packages
run: pip3 install pexpect click
- name: Clone Overleaf Repo
run: python3 ./script/ci/overleaf/overleaf.py ${{ secrets.OVERLEAF_ID }} zjuthesis ${{ secrets.OVERLEAF_USER }} ${{ secrets.OVERLEAF_PASSWD }} clone
- name: Update Overleaf Repo
run: python3 ./script/ci/overleaf/overleaf.py ${{ secrets.OVERLEAF_ID }} zjuthesis ${{ secrets.OVERLEAF_USER }} ${{ secrets.OVERLEAF_PASSWD }} update
- name: Push Overleaf Repo
run: python3 ./script/ci/overleaf/overleaf.py ${{ secrets.OVERLEAF_ID }} zjuthesis ${{ secrets.OVERLEAF_USER }} ${{ secrets.OVERLEAF_PASSWD }} push
- name: Check result
run: ls -la ./zjuthesis
- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Git setup username
run: git config --global user.name "TheNetAdmin"
- name: Git setup email
run: git config --global user.email "[email protected]"
- name: Install Python packages
run: pip3 install pexpect click
- name: Clone Overleaf Repo
run: python3 ./script/ci/overleaf/overleaf.py ${{ secrets.OVERLEAF_ID }} zjuthesis ${{ secrets.OVERLEAF_USER }} ${{ secrets.OVERLEAF_PASSWD }} clone
- name: Update Overleaf Repo
run: python3 ./script/ci/overleaf/overleaf.py ${{ secrets.OVERLEAF_ID }} zjuthesis ${{ secrets.OVERLEAF_USER }} ${{ secrets.OVERLEAF_PASSWD }} update
- name: Push Overleaf Repo
run: python3 ./script/ci/overleaf/overleaf.py ${{ secrets.OVERLEAF_ID }} zjuthesis ${{ secrets.OVERLEAF_USER }} ${{ secrets.OVERLEAF_PASSWD }} push
- name: Check result
run: ls -la ./zjuthesis

gitee_sync:
runs-on: ubuntu-latest
needs: [diff_pdf]
if: "contains(github.repository_owner, 'TheNetAdmin')"
steps:
- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Sync to Gitee
uses: Yikun/[email protected]
with:
src: github/TheNetAdmin
dst: gitee/netadmin
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
static_list: "zjuthesis"


- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Sync to Gitee
uses: Yikun/[email protected]
with:
src: github/TheNetAdmin
dst: gitee/netadmin
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
static_list: "zjuthesis"
98 changes: 49 additions & 49 deletions .github/workflows/release_code.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
name: Release Code

on:
on:
push:
tags:
- '*'
tags:
- "*"

jobs:
release_code:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v1
- name: Pack Release Code
run: bash ./script/release/package_release.sh dist

- name: Pack Release Overleaf Code
run: bash ./script/release/package_overleaf.sh dist
- name: Current version
run: echo $GITHUB_REF

- name: Download Fonts
run: ./script/ci/setup.sh
- name: Pull TexLive Docker
uses: docker://adnrv/texlive:full
- name: Build Undergrad in Docker
run: docker run --mount src=$GITHUB_WORKSPACE/,target=/zjuthesis,type=bind adnrv/texlive:full /zjuthesis/script/ci/github-action/build_undergrad.sh
- name: Build Grad in Docker
run: docker run --mount src=$GITHUB_WORKSPACE/,target=/zjuthesis,type=bind adnrv/texlive:full /zjuthesis/script/ci/github-action/build_grad.sh
- name: PDF Diff
run: bash script/ci/pdf-diff/diff_report.sh
- name: Print Info
run: echo ${code_tag}
- name: Release Code and Sample Files
if: "!contains(github.ref, 'rc')"
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*.pdf,dist/*.zip"
token: ${{ secrets.RELEASE_TOKEN }}
allowUpdates: true
- name: Pre-Release Code and Sample Files
if: "contains(github.ref, 'rc')"
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*.pdf,dist/*.zip"
token: ${{ secrets.RELEASE_TOKEN }}
allowUpdates: true
prerelease: true
- name: Checkout Repo
uses: actions/checkout@v1

- name: Pack Release Code
run: bash ./script/release/package_release.sh dist

- name: Pack Release Overleaf Code
run: bash ./script/release/package_overleaf.sh dist

- name: Current version
run: echo $GITHUB_REF

- name: Download Fonts
run: ./script/ci/setup.sh

- name: Pull TexLive Docker
uses: docker://adnrv/texlive:full

- name: Build Undergrad in Docker
run: docker run --mount src=$GITHUB_WORKSPACE/,target=/zjuthesis,type=bind adnrv/texlive:full /zjuthesis/script/ci/github-action/build_undergrad.sh

- name: Build Grad in Docker
run: docker run --mount src=$GITHUB_WORKSPACE/,target=/zjuthesis,type=bind adnrv/texlive:full /zjuthesis/script/ci/github-action/build_grad.sh

- name: PDF Diff
run: bash script/ci/pdf-diff/diff_report.sh

- name: Print Info
run: echo ${code_tag}

- name: Release Code and Sample Files
if: "!contains(github.ref, 'rc')"
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*.pdf,dist/*.zip"
token: ${{ secrets.RELEASE_TOKEN }}
allowUpdates: true

- name: Pre-Release Code and Sample Files
if: "contains(github.ref, 'rc')"
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*.pdf,dist/*.zip"
token: ${{ secrets.RELEASE_TOKEN }}
allowUpdates: true
prerelease: true
2 changes: 1 addition & 1 deletion script/ci/github-action/build_single.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ cd "$project_path" || exit 1

mkdir -p dist

build_zjuthesis "$@"
build_zjuthesis "$@"
12 changes: 6 additions & 6 deletions script/ci/github-action/build_undergrad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ mkdir -p dist
# Should improve the build_zjuthesis.sh::build_zjuthesis function
build_zjuthesis $degree "general" "thesis" "final" "true" "doctor" "chinese"

for major in ${main_majors[@]}; do
for period in ${periods[@]}; do
for type in ${types[@]}; do
build_zjuthesis $degree $major $type $period "false" "doctor" "chinese"
done
done
for major in "${main_majors[@]}"; do
for period in "${periods[@]}"; do
for type in "${types[@]}"; do
build_zjuthesis $degree $major $type $period "false" "doctor" "chinese"
done
done
done

build_zjuthesis $degree "cs" "design" "proposal" "false" "doctor" "chinese"
Expand Down
Loading

0 comments on commit 84297c7

Please sign in to comment.