Proposals 9179-9181 #799
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches-ignore: gh-pages | |
pull_request: | |
branches-ignore: gh-pages | |
concurrency: ci-${{ github.ref }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: "recursive" | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: zulu | |
java-version: 17 | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew assemble --no-daemon --no-watch-fs | |
- name: Run the tests | |
run: ./gradlew check --no-daemon --no-watch-fs | |
- name: Build application distribution | |
run: ./gradlew installDist --no-daemon --no-watch-fs | |
- name: Upload application distribution | |
uses: actions/upload-artifact@v3 | |
with: | |
name: assessor_dist | |
path: build/install/assessor | |
reports_generate: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: zulu | |
java-version: 17 | |
- name: Fetch distribution | |
uses: actions/[email protected] | |
with: | |
name: assessor_dist | |
path: dist | |
- name: Generate reports | |
run: | | |
chmod +x dist/bin/assessor | |
dist/bin/assessor all --long --dir reports | |
dist/bin/assessor all --json --dir reports/json | |
dist/bin/assessor all --proposals --dir reports/proposal | |
dist/bin/assessor all --statistics --dir reports/statistics | |
- name: Generate index.md | |
run: | | |
REPORTS_DIR=reports | |
shopt -s nullglob | |
REPORTS=("$REPORTS_DIR"/*.txt) | |
IFS=$'\n' REPORTS=($(sort -n -r -t $'-' -k 1 <<<"${REPORTS[*]}")) | |
unset IFS | |
LATEST_REPORT_DEST="$REPORTS_DIR/latest.txt" | |
INDEX_FILE="$REPORTS_DIR/index.md" | |
touch $INDEX_FILE | |
echo "Reports: ${REPORTS[*]}" | |
echo "# Assessor's Archive" >> $INDEX_FILE | |
echo "" >> $INDEX_FILE | |
echo "[Latest Assessment]($(basename "${REPORTS[0]}"))" >> $INDEX_FILE | |
echo "" >> $INDEX_FILE | |
echo "List of assessments:" >> $INDEX_FILE | |
echo "" >> $INDEX_FILE | |
for report in "${REPORTS[@]}"; do | |
REPORT_FILENAME=$(basename "$report") | |
echo "* [$REPORT_FILENAME]($REPORT_FILENAME)" >> $INDEX_FILE; | |
done; | |
cp -- "${REPORTS[0]}" "$LATEST_REPORT_DEST" | |
- name: Upload reports artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: reports | |
path: reports | |
reports_deploy: | |
if: github.ref == 'refs/heads/main' | |
needs: reports_generate | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: "recursive" | |
- name: Fetch reports artifact | |
uses: actions/[email protected] | |
with: | |
name: reports | |
path: artifacts/reports | |
- name: Copy reports to gh-pages dir | |
run: "cp -R artifacts/reports/* generation/gh-pages" | |
- name: Deploy reports to Github Pages | |
run: | | |
# Set Git committer identity | |
git config user.name "ci-build" | |
git config user.email "[email protected]" | |
# Clear the index | |
EMPTY_TREE="$(git hash-object -t tree /dev/null)" | |
git read-tree -- "$EMPTY_TREE" | |
# Add site data to index | |
git add generation/gh-pages | |
git fetch origin gh-pages | |
ORIG_SITE_TREE="$(git rev-parse origin/gh-pages^{tree})" | |
NEW_SITE_TREE="$(git write-tree --prefix=generation/gh-pages)" | |
if [ "$ORIG_SITE_TREE" != "$NEW_SITE_TREE" ]; then | |
SITE_COMMIT="$(git commit-tree -p origin/gh-pages -m "[skip ci] CI Updates" -- "$NEW_SITE_TREE")" | |
echo Updating GitHub pages site to commit "$SITE_COMMIT" | |
git push origin "$SITE_COMMIT":gh-pages | |
else | |
echo Not updating GitHub pages site | |
fi |