From 4a971da50c211b97429f906972fbbddde6ec0f59 Mon Sep 17 00:00:00 2001 From: mrjones-plip Date: Tue, 4 Aug 2020 15:52:28 -0700 Subject: [PATCH] pin muffet to 1.3.3, merge ci files w conditional calls to push live for master, add test alerts to my own private channel #259 --- .github/workflows/build-any.branch.yml | 61 ---------------- .github/workflows/ci.yml | 99 +++++++++++++++++--------- 2 files changed, 67 insertions(+), 93 deletions(-) delete mode 100644 .github/workflows/build-any.branch.yml diff --git a/.github/workflows/build-any.branch.yml b/.github/workflows/build-any.branch.yml deleted file mode 100644 index 9badc20e2..000000000 --- a/.github/workflows/build-any.branch.yml +++ /dev/null @@ -1,61 +0,0 @@ -on: - push: - branches: - - 259-add-link-checker-to-ci # todo - remove after testing - # - '*' # todo - make sure this isn't commented out when done testing - # - '!master' # todo - make sure this isn't commented out when done testing -name: Build Any Branch -jobs: - BuildAnyBranch: - name: - runs-on: ubuntu-18.04 - steps: - - - name: Git checkout - uses: actions/checkout@v2 - with: - submodules: recursive # Fetch the Docsy theme - fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod - - - name: Install Node depencies - uses: actions/setup-node@v1 - with: - node-version: '12.x' - - run: npm install - - run: npm install -g postcss-cli - - run: npm i -D autoprefixer - - - name: Setup hugo - uses: peaceiris/actions-hugo@v2 - with: - hugo-version: "0.71.1" - extended: true - - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: '1.14' # Pinning to current version as of Aug 3, 2020 for stability - - - name: Install Muffet - run: go get -u github.com/raviqqe/muffet - - - name: Serve Hugo site - run: hugo server& # run in background so CI doesn't hang waiting for ctrl + c - - - name: Sleep to ensure hugo server is ready - run: sleep 5 - - - name: Run Muffet link checkier - run: muffet http://localhost:1313 --buffer-size 50000 --timeout 15 --concurrency 1 --ignore-fragments --exclude ".*demo\.app\.medicmobile\.org.*" --exclude ".*download\.docker\.com.*" --exclude ".*www\.npmjs\.com/org/medic/team/developers" --exclude ".*github\.com/medic/cht-docs/issues/new.*" --exclude ".*localhost:5984.*" - - # todo - remove this comment: - # muffet -f -e ".*github\.com.*" -e ".*demo\.app\.medicmobile\.org.*" -e ".*download\.docker\.com.*" -e ".*www\.npmjs\.com/org/medic/team/developers.*" -e ".*github\.com/medic/cht-docs/issues/new.*" -e ".*localhost:5984.*" http://localhost:1313 - - - name: Check if if Master - if: github.ref == 'refs/heads/master' - run: echo "This is Main" - - # todo - - name: Check if 259-add-link-checker-to-ci - if: github.ref == 'refs/heads/259-add-link-checker-to-ci' - run: echo "This is 259-add-link-checker-to-ci" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b8223919..b5b424642 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,29 +1,31 @@ -name: CHT Documentation Site Build - -on: +on: push: branches: - - master + # todo - make this run on all branches as we have conditionals below to only push to prod if we're on master + - 259-add-link-checker-to-ci + # - '*' + # - '!master' +name: Test site and push live if we're on Master jobs: - build: - + BuildAnyBranch: + name: runs-on: ubuntu-18.04 - - steps: + steps:Z - name: Git checkout uses: actions/checkout@v2 with: submodules: recursive # Fetch the Docsy theme fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod - - name: Install Node depencies - uses: actions/setup-node@v1 - with: - node-version: '12.x' - - run: npm install - - run: npm install -g postcss-cli - - run: npm i -D autoprefixer + # todo - verify this is safe to remove - not sure why we need node here +# - name: Install Node depencies +# uses: actions/setup-node@v1 +# with: +# node-version: '12.x' +# - run: npm install +# - run: npm install -g postcss-cli +# - run: npm i -D autoprefixer - name: Setup hugo uses: peaceiris/actions-hugo@v2 @@ -31,29 +33,62 @@ jobs: hugo-version: "0.71.1" extended: true - - name: Build + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: '1.14' # Pinning to current version as of Aug 3, 2020 for stability + + - name: Install Muffet + run: env GO111MODULE="on" go get github.com/raviqqe/muffet@1.3.3 # Pinning to current version as of Aug 3, 2020 for stability + + - name: Serve Hugo site + run: hugo server& # run in background so CI doesn't hang waiting for ctrl + c + + - name: Sleep so hugo server is ready + run: sleep 5 + + - name: Run Muffet link checkier + run: | + muffet http://localhost:1313 \ + --buffer-size 50000 --timeout 15 --concurrency 1 --ignore-fragments --exclude ".*demo\.app\.medicmobile\.org.*" --exclude ".*download\.docker\.com.*" --exclude ".*www\.npmjs\.com/org/medic/team/developers" --exclude ".*github\.com/medic/cht-docs/issues/new.*" --exclude ".*localhost:5984.*" + + - name: Build if on Master + if: github.ref == 'refs/heads/master' run: env HUGO_ENV="production" hugo --minify - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - personal_token: ${{ secrets.DEPOLY_TO_SITE}} - external_repository: medic/medic.github.io - publish_dir: ./public - user_name: medic-ci - user_email: medic-ci@github - publish_branch: master - - - name: Failed Deploy + # todo - uncomment before closing - push docs live +# - name: Deploy to GH pages if on Master +# if: github.ref == 'refs/heads/master' +# uses: peaceiris/actions-gh-pages@v3 +# with: +# personal_token: ${{ secrets.DEPOLY_TO_SITE}} +# external_repository: medic/medic.github.io +# publish_dir: ./public +# user_name: medic-ci +# user_email: medic-ci@github +# publish_branch: master + + # todo - remove this before merging to master ;) + - name: Report errors to slack if on Master + if: ${{ failure() }} && github.ref != 'refs/heads/master' uses: rtCamp/action-slack-notify@v2.0.2 - if: ${{ failure() }} env: SLACK_WEBHOOK: '${{ secrets.SLACK_WEB_HOOK }}' - SLACK_CHANNEL: '#cht-squad-docs' + SLACK_CHANNEL: '#mrjones-testing-channel' SLACK_COLOR: '#3278BD' SLACK_ICON: ":flappingphone:" - SLACK_MESSAGE: 'Deploy Failed' - SLACK_TITLE: CHT DOCS DEPLOY + SLACK_MESSAGE: 'GH Action Testing Failed - zomg!' + SLACK_TITLE: CHT DOCS DEPLOY SLACK_USERNAME: Medic-Bot - + - name: Report errors to slack if on Master + if: ${{ failure() }} && github.ref == 'refs/heads/master' + uses: rtCamp/action-slack-notify@v2.0.2 + env: + SLACK_WEBHOOK: '${{ secrets.SLACK_WEB_HOOK }}' + SLACK_CHANNEL: '#cht-squad-docs' + SLACK_COLOR: '#3278BD' + SLACK_ICON: ":flappingphone:" + SLACK_MESSAGE: 'Deploy Failed' + SLACK_TITLE: CHT DOCS DEPLOY + SLACK_USERNAME: Medic-Bot \ No newline at end of file