Skip to content

Commit

Permalink
Update ci configs
Browse files Browse the repository at this point in the history
  • Loading branch information
kaedea committed Aug 13, 2021
1 parent 7822d5d commit 4f02e9a
Showing 1 changed file with 79 additions and 79 deletions.
158 changes: 79 additions & 79 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ workflows:
branches:
only: ci/build-hexo
- build-hexo-generate:
requires:
- build-hexo
requires:
- build-hexo
- publish-github-hexo:
requires:
- build-hexo-generate

requires:
- build-hexo-generate

jobs:
build-readme:
Expand All @@ -53,91 +52,90 @@ jobs:
- image: cimg/python:3.8
steps:
- attach_workspace:
at: ~/project
at: ~/project
- checkout
- run:
name: pip install
command: |
pip install notion
pip install pangu
pip install notion
pip install pangu
- run:
name: Run tests
command: |
python -m unittest test.notion_ci_test.NotionCiTest.test_generate_read_me
python -m unittest test.notion_ci_test.NotionCiTest.test_generate_read_me
- run:
name: Dump outputs
command: |
echo "Generated MD file:\n" |
cat "$(find ~/project/build -name "*.md" -type f | head -1)"
echo "\n---\n"
pwd && ls -l
echo "Generated MD file:\n" |
cat "$(find ~/project/build -name "*.md" -type f | head -1)"
echo "\n---\n"
pwd && ls -l
- persist_to_workspace:
root: ~/project
paths:
- ./build

publish-github-readme:
parameters:
branch_deploy:
type: string
default: master
working_directory: ~/dist
docker:
- image: cibuilds/github:0.10
steps:
- attach_workspace:
at: ~/project
- checkout
- run: git checkout << parameters.branch_deploy >>
# - run: git submodule sync
# - run: git submodule update --init
- run:
name: "Dump files"
command: |
pwd && ls -l ~/project
echo "n--n"
ls -l ~/project/build/NotionDown
parameters:
branch_deploy:
type: string
default: master
working_directory: ~/dist
docker:
- image: cibuilds/github:0.10
steps:
- attach_workspace:
at: ~/project
- checkout
- run: git checkout << parameters.branch_deploy >>
# - run: git submodule sync
# - run: git submodule update --init
- run:
name: "Dump files"
command: |
pwd && ls -l ~/project
echo "n--n"
# assets files
if [ -d ~/project/build/NotionDown/assets/ ]; then
echo "copy assets files"
cp -rv ~/project/build/NotionDown/assets/. ~/dist/assets
else
echo "No assets files"
fi
ls -l ~/project/build/NotionDown
# md file
# find ~/project/build -name "*.md" -type f | head -1 | xargs -n1 sh -c "echo mv $0 $1 ~/dist/README.md"
echo "mv $(find ~/project/build -name "*.md" -type f | head -1) ~/dist/README.md"
mv $(find ~/project/build -name "*.md" -type f | head -1) ~/dist/README.md
cat ~/dist/README.md
- run:
name: "Push"
command: |
pwd
echo "\n--\n"
# assets files
if [ -d ~/project/build/NotionDown/assets/ ]; then
echo "copy assets files"
cp -rv ~/project/build/NotionDown/assets/. ~/dist/assets
else
echo "No assets files"
fi
# git ls-files -m
# has_modified=$(git ls-files -m)
# md file
# find ~/project/build -name "*.md" -type f | head -1 | xargs -n1 sh -c "echo mv $0 $1 ~/dist/README.md"
echo "mv $(find ~/project/build -name "*.md" -type f | head -1) ~/dist/README.md"
mv $(find ~/project/build -name "*.md" -type f | head -1) ~/dist/README.md
cat ~/dist/README.md
- run:
name: "Push"
command: |
pwd
echo "\n--\n"
# git diff HEAD --name-only --diff-filter=ACMR --ignore-space-at-eol -M100%
has_modified="$(git diff HEAD --name-only --diff-filter=ACMR --ignore-space-at-eol -M100%)"
# git ls-files -m
# has_modified=$(git ls-files -m)
if [ -z "$has_modified" ] ; then
echo "not modified"
else
echo "has modified, try git push"
git config user.name "Kaede"
git config user.email "kidhaibara@gmail.com"
# git pull origin << parameters.branch_deploy >>
git add *
git status
git commit -a -m "Update README via CircleciBot - ${CIRCLE_BUILD_NUM}"
git status
git push --quiet "https://${GH_TOKEN}@github.com/kaedea/notion-down.git" << parameters.branch_deploy >>:<< parameters.branch_deploy >>
fi
# git diff HEAD --name-only --diff-filter=ACMR --ignore-space-at-eol -M100%
has_modified="$(git diff HEAD --name-only --diff-filter=ACMR --ignore-space-at-eol -M100%)"
if [ -z "$has_modified" ] ; then
echo "not modified"
else
echo "has modified, try git push"
git config user.name "Kaede"
git config user.email "kidhaibara@gmail.com"
# git pull origin << parameters.branch_deploy >>
git add *
git status
git commit -a -m "Update README via CircleciBot - ${CIRCLE_BUILD_NUM}"
git status
git push --quiet "https://${GH_TOKEN}@github.com/kaedea/notion-down.git" << parameters.branch_deploy >>:<< parameters.branch_deploy >>
fi
build-pycorrector-test:
parameters:
Expand All @@ -149,25 +147,24 @@ jobs:
- image: cimg/python:3.8
steps:
- attach_workspace:
at: ~/spell-inspect
at: ~/spell-inspect
- checkout
- run:
name: pip install
command: |
pip install notion
pip install pangu
pip install pycorrector
pip install https://github.com/kpu/kenlm/archive/master.zip
# pip install -r requirements.txt
pip install notion
pip install pangu
pip install pycorrector
pip install https://github.com/kpu/kenlm/archive/master.zip
# pip install -r requirements.txt
- run:
name: Run tests
command: |
python -m unittest test.corrects_test.CorrectsApiTest.test_pycorrector_spelling_inspect_writer_r2
python -m unittest test.corrects_test.CorrectsApiTest.test_pycorrector_spelling_inspect_writer_r2
- store_artifacts:
path: ~/spell-inspect/build/SpellInspect


build-hexo:
parameters:
branch_build:
Expand Down Expand Up @@ -269,7 +266,7 @@ jobs:
- image: cibuilds/github:0.10
steps:
- attach_workspace:
at: ~/project-hexo-source
at: ~/project-hexo-source
- run:
name: Checkout hexo source repo
command: |
Expand All @@ -281,6 +278,11 @@ jobs:
rm -rf docs
mv ~/project-hexo-source/notion-down-hexo-showcase/hexo-blog/public docs
ls -l docs
echo "Configure CNAME"
if [ -f "docs/CNAME" ]; then
rm docs/CNAME
fi
echo "hexo.kaedea.com" > docs/CNAME
- run:
name: Git push hexo dist
command: |
Expand All @@ -292,5 +294,3 @@ jobs:
git status
git commit -a -m "Circleci-bot deploy - ${CIRCLE_BUILD_NUM}"
git push --force --quiet "https://${GH_TOKEN}@github.com/kaedea/notion-down-hexo-showcase.git" master:master

0 comments on commit 4f02e9a

Please sign in to comment.