Skip to content

Commit

Permalink
fix: use gh-pages over wiki for coverage push
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Jan 22, 2024
1 parent e611a06 commit 6aab03b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 31 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/remote_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ jobs:
# Parse JSON with multiline strings, using delimeter (Github specific)
to_envs() { jq -r "to_entries[] | \"\(.key)<<$delim\n\(.value)\n$delim\n\""; }
# Set all vars
echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_ENV
# Set VARS_CONTEXT if not null
if [ "${VARS_CONTEXT}" != "null" ]; then
echo "${VARS_CONTEXT}" | to_envs >> $GITHUB_ENV
Expand All @@ -61,8 +58,8 @@ jobs:
echo "Substituting variables from .env.example --> .env"
./envsubst < .env.example > .env
else
echo ".env.example not found, creating .env with GIT_BRANCH only"
echo "GIT_BRANCH=${GIT_BRANCH}" > .env
echo ".env.example not found, creating .env"
touch .env
fi
echo "GIT_BRANCH=${GIT_BRANCH}" >> .env
Expand Down
33 changes: 12 additions & 21 deletions .github/workflows/test_compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ on:
type: string
default: "test"

permissions:
contents: write

jobs:
check-img-cache:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -204,10 +207,6 @@ jobs:
# Parse JSON with multiline strings, using delimeter (Github specific)
to_envs() { jq -r "to_entries[] | \"\(.key)<<$delim\n\(.value)\n$delim\n\""; }
# Set all vars
echo "TAG_OVERRIDE=${TAG_OVERRIDE}" >> $GITHUB_ENV
echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_ENV
# Set VARS_CONTEXT if not null
if [ "${VARS_CONTEXT}" != "null" ]; then
echo "${VARS_CONTEXT}" | to_envs >> $GITHUB_ENV
Expand All @@ -230,11 +229,12 @@ jobs:
echo "Substituting variables from .env.example --> .env"
./envsubst < .env.example > .env
else
echo ".env.example not found, creating .env with GIT_BRANCH only"
echo "GIT_BRANCH=${GIT_BRANCH}" > .env
echo ".env.example not found, creating .env"
touch .env
fi
echo "GIT_BRANCH=${GIT_BRANCH}" >> .env
echo "TAG_OVERRIDE=${TAG_OVERRIDE}" >> .env
- name: Run Tests
if: ${{ ! inputs.coverage }}
Expand All @@ -261,27 +261,18 @@ jobs:
- name: Upload Coverage
if: ${{ inputs.coverage }}
run: |
# Pull content from gh-pages
mkdir tmp_pages
cd tmp_pages
git init
# Checkout to gh-pages
git config user.name svchot
git config user.email [email protected]
git pull https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki
cd ..
# Sync coverage index and badge using rsync
sudo apt-get update && sudo apt-get install -y rsync --no-install-recommends
git checkout gh-pages
# Overwrite coverage index and badge
echo "Coverage dir contents:"
ls ${{ github.workspace }}/coverage
echo ""
cp ${{ github.workspace }}/coverage/coverage.* docs/
rsync -av --delete docs/ tmp_pages/ --exclude .git
mv ${{ github.workspace }}/coverage/* ${{ github.workspace }}
# Push content to gh-pages
cd tmp_pages
git add .
git commit -m "docs: automated wiki update on push"
git push -f --set-upstream https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git master
git commit -m "docs: update coverage summary and badge"
git push --set-upstream https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git gh-pages
7 changes: 2 additions & 5 deletions .github/workflows/test_pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ jobs:
# Parse JSON with multiline strings, using delimeter (Github specific)
to_envs() { jq -r "to_entries[] | \"\(.key)<<$delim\n\(.value)\n$delim\n\""; }
# Set all vars
echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_ENV
# Set VARS_CONTEXT if not null
if [ "${VARS_CONTEXT}" != "null" ]; then
echo "${VARS_CONTEXT}" | to_envs >> $GITHUB_ENV
Expand All @@ -166,8 +163,8 @@ jobs:
echo "Substituting variables from .env.example --> .env"
./envsubst < .env.example > .env
else
echo ".env.example not found, creating .env with GIT_BRANCH only"
echo "GIT_BRANCH=${GIT_BRANCH}" > .env
echo ".env.example not found, creating .env"
touch .env
fi
echo "GIT_BRANCH=${GIT_BRANCH}" >> .env
Expand Down

0 comments on commit 6aab03b

Please sign in to comment.