Skip to content

Commit

Permalink
Update workflow to push the raport to gh page branch
Browse files Browse the repository at this point in the history
  • Loading branch information
MaciejG604 committed May 17, 2023
1 parent 7d2935a commit 16fcbc8
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 2 deletions.
32 changes: 31 additions & 1 deletion .github/workflows/compare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,43 @@ jobs:
steps:
- name: Git Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
- name: Install coursier
uses: coursier/setup-action@v1
with:
apps: scala-cli

- run: echo "filename=$(./scripts/get_filename.sh)" >> "$GITHUB_ENV"
id: filename
- name: Generate raport
env:
ES_USER: ${{ secrets.OPENCB_ELASTIC_USER }}
ES_PASSWORD: ${{ secrets.OPENCB_ELASTIC_PSWD }}
run: ./scripts/raport-regressions.scala ${{ inputs.scala-version }} --compareWith=${{ inputs.compare-with-scala-version }} --buildId=${{ inputs.build-id }} --compareWithBuildId=${{ inputs.compare-with-build-id }}
run: |
./scripts/create_post_with_front_matter.sh "$HOME/${{ env.filename }}"
./scripts/raport-regressions.scala ${{ inputs.scala-version }} \
--compareWith=${{ inputs.compare-with-scala-version }} \
--buildId=${{ inputs.build-id }} \
--compareWithBuildId=${{ inputs.compare-with-build-id }} \
>> "$HOME/${{ env.filename }}"
- name: Push raport
run: |
if [ -s "$HOME/${{ env.filename }}" ]; then
echo "The raport file is non-empty."
git checkout gh-page
mkdir -p "./_posts"
cat "$HOME/${{ env.filename }}" > "./_posts/${{ env.filename }}"
git config --global user.name "GitHub Actions"
git config --global user.email "mgajek@virtuslab.com"
git add "./_posts/${{ env.filename }}"
git commit -m "Upload build raport"
git push origin gh-page
else
echo "The raport file is empty."
exit(0)
fi
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,11 @@ node_modules
/tmp

# scala-cli
**/.scala-build
**/.scala-build

# jekyll
_site
.sass-cache
.jekyll-cache
.jekyll-metadata
vendor
16 changes: 16 additions & 0 deletions scripts/create_post_with_front_matter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

filename="$1"

if [ -z "$filename" ]; then
echo "Please provide a filename as an argument."
exit 1
fi

echo "---" > "$filename"
echo "layout: post" >> "$filename"
echo "date: $(date "+%Y-%m-%d %H:%M:%S %z")" >> "$filename"
echo "---" >> "$filename"
echo "" >> "$filename"

echo "Content has been written to $filename."
9 changes: 9 additions & 0 deletions scripts/get_filename.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

current_date=$(date "+%Y-%m-%d")

second_of_day=$(date "+%H3600+%M60+%S" | bc)

filename="${current_date}-build-result-${second_of_day}.md"

echo $filename

0 comments on commit 16fcbc8

Please sign in to comment.