Skip to content

Commit

Permalink
CI corrections, refactor defaults, template on submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
maldins46 committed Feb 17, 2021
1 parent e1a0c83 commit da83e3d
Show file tree
Hide file tree
Showing 36 changed files with 810 additions and 177 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ name: CI

on:
push:
branches:
- main
- dev

pull_request:
branches:
- dev
- main
- 'release/**'
- 'hotfix/**'

jobs:
lint:
name: Lint
Lint:
runs-on: ubuntu-18.04
steps:
- name: Checkout repository
Expand All @@ -28,5 +30,5 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Code lint
- name: Lint Markdown
run: ./gradlew spotlessCheck
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- 'hotfix/**'

jobs:
prerelease:
Deploy:
name: Opt-in pre-release
if: contains(github.event.head_commit.message, '[prerelease]')
runs-on: ubuntu-18.04
Expand Down Expand Up @@ -50,25 +50,29 @@ jobs:
id: date
run: echo "::set-output name=date::$(date +'%d-%m-%Y')"

- name: Generate PPS report
- name: Prepare environment
run: |
mkdir docs
- name: Generate PPS report PDF
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./src/markdown/pps-report/pps-latex-default.yml -o report/PPSReport-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}
args: -d ./pandoc/pps-report/latex.yaml -o docs/PPSReport-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}

- name: Generate LSS report
- name: Generate LSS report PDF
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./src/markdown/lss-report/lss-latex-default.yml -o report/LSSReport-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}
args: -d ./pandoc/lss-report/latex.yaml -o docs/LSSReport-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}

- name: Generate appendix documents
- name: Generate appendix documents PDF
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./src/markdown/appendix/appendix-latex-default.yml -o report/Appendix-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}
args: -d ./pandoc/appendix/latex.yaml -o docs/Appendix-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}

- name: Upload release assets
uses: dwenegar/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create-release.outputs.id }}
assets_path: ./report
assets_path: ./docs
72 changes: 32 additions & 40 deletions .github/workflows/releases.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Generate release
name: Release

# Generates a new release, after a release/* branch is successfully
# merged into main. The tag name is inferred from the branch name.

on:
pull_request:
branches:
Expand All @@ -10,8 +11,7 @@ on:
- closed

jobs:
release:
name: Generate release
Deploy:

# only merged pull requests must trigger this job
if: github.event.pull_request.merged == true
Expand All @@ -20,16 +20,9 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Checkout GitHub Pages
uses: actions/checkout@v2
with:
ref: gh-pages
path: ./gh-pages

- name: Checkout web template
run: |
git clone https://github.com/scalaquest/PandocBootstrap.git ./template
fetch-depth: 0
submodules: 'recursive'

- name: Extract version from branch name (for release branches)
if: startsWith(github.event.pull_request.head.ref, 'release/')
Expand All @@ -45,15 +38,14 @@ jobs:
VERSION=${BRANCH_NAME#hotfix/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
# Only locally: this is useful to have the right release name on .jar(s) and
# Scaladoc' titles, as the version of the projects are based on gitSemVer.
- name: Add local tag
- name: Add tag
run: |
git config user.name releaserbot
git config user.email github-actions@github.com
git tag ${{ env.RELEASE_VERSION }} -a -m "Local tag"
git tag ${{ env.RELEASE_VERSION }} -a -m "Release ${{ env.RELEASE_VERSION }}"
git push --follow-tags
- name: Create Release
- name: Create release
id: create-release
uses: actions/create-release@v1
env:
Expand All @@ -63,7 +55,7 @@ jobs:
release_name: ${{ env.RELEASE_VERSION }}
prerelease: false

- name: Merge main into dev branch
- name: Create "merge into dev" pull request
uses: thomaseizinger/create-pull-request@1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -72,44 +64,44 @@ jobs:
base: dev
title: Merge main into dev branch
body: |
This PR merges the master branch back into dev. This happens to ensure that the updates that happend on the release branch, i.e. CHANGELOG and manifest updates, are also present on the dev branch.
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
This PR merges the main branch back into dev. This happens to ensure that the updates that happend on the release branch, i.e. CHANGELOG and manifest updates, are also present on the dev branch.
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%d-%m-%Y')"

- name: Generate PPS report
- name: Prepare environment
run: |
mkdir docs
- name: Generate PPS report PDF
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./src/markdown/pps-report/pps-latex-default.yml -o report/PPSReport-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}
args: -d ./pandoc/pps-report/latex.yaml -o docs/PPSReport-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}

- name: Generate LSS report
- name: Generate LSS report PDF
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./src/markdown/lss-report/lss-latex-default.yml -o report/LSSReport-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}
args: -d ./pandoc/lss-report/latex.yaml -o docs/LSSReport-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}

- name: Generate appendix documents
- name: Generate appendix documents PDF
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./src/markdown/appendix/appendix-latex-default.yml -o report/Appendix-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}
args: -d ./pandoc/appendix/latex.yaml -o docs/Appendix-${{ env.RELEASE_VERSION }}.pdf -M date:${{steps.date.outputs.date}}

- name: Upload release assets
uses: dwenegar/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create-release.outputs.id }}
assets_path: ./report
assets_path: ./docs

- name: Checkout GitHub Pages
uses: actions/checkout@v2
with:
ref: gh-pages
path: ./gh-pages

- name: Prepare gh-pages environment
run: |
Expand All @@ -119,17 +111,17 @@ jobs:
- name: Generate PPS report HTML
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./src/markdown/pps-report/pps-html-default.yml -o ./gh-pages/reports/pps.html
args: -d ./pandoc/pps-report/html.yaml -o ./gh-pages/reports/pps.html

- name: Generate LSS report HTML
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./src/markdown/lss-report/lss-html-default.yml -o ./gh-pages/reports/lss.html
args: -d ./pandoc/lss-report/html.yaml -o ./gh-pages/reports/lss.html

- name: Generate LSS report HTML
- name: Generate Appendix documents HTML
uses: docker://pandoc/latex:2.11.4
with:
args: -d ./src/markdown/appendix/appendix-html-default.yml -o ./gh-pages/reports/appendix.html
args: -d ./pandoc/appendix/html.yaml -o ./gh-pages/reports/appendix.html

- name: Push reports to gh-pages
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "html-template"]
path = pandoc/templates
url = https://github.com/scalaquest/PandocBootstrap.git
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ gitSemVer {

tasks.register("generateVersionFile") {
mkdir("build")
File(buildDir.toString() + "/version").writeText(version.toString())
File("$buildDir/version").writeText(version.toString())
}
10 changes: 10 additions & 0 deletions pandoc/appendix/html.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
defaults:
- ./src/lss-report/index
- ./pandoc/defaults/html

output-file: Appendix.html
resource-path: ['./src/appendix']

metadata:
title: ScalaQuest Appendix Documents

Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from: markdown

defaults:
- ./src/markdown/appendix/appendix-default
- ./src/appendix/index
- ./pandoc/defaults/latex

output-file: Appendix.pdf
resource-path: ['./src/appendix']

metadata:
title: ScalaQuest
subtitle: Appendix Documents
lang: it-IT
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from: markdown

input-files:
- ./src/markdown/lss-report/1-introduzione.md
table-of-contents: true
toc-depth: 2
number-sections: true
top-level-division: chapter
template: template.html
data-dir: pandoc

metadata:
author:
Expand All @@ -15,8 +18,4 @@ metadata:

filters:
- pandoc-crossref
table-of-contents: true
toc-depth: 2
number-sections: true
resource-path: ['./src/markdown/lss-report']
top-level-division: chapter

Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
from: markdown
table-of-contents: true
toc-depth: 2
number-sections: true
top-level-division: chapter

input-files:
- ./src/markdown/appendix/sprints-historical-overview.md
filters:
- pandoc-crossref

metadata:
title: ScalaQuest
subtitle: Report
lang: it-IT
author:
- Thomas Angelini
- Jacopo Corina
Expand All @@ -12,11 +19,3 @@ metadata:
- Filippo Nardini
autoSectionLabels: true
chapters: true

filters:
- pandoc-crossref
table-of-contents: true
toc-depth: 2
number-sections: true
resource-path: ['./src/markdown/appendix']
top-level-division: chapter
10 changes: 10 additions & 0 deletions pandoc/lss-report/html.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
defaults:
- ./src/lss-report/index
- ./pandoc/defaults/html

output-file: LSSReport.html
resource-path: ['./src/lss-report']

metadata:
title: ScalaQuest LSS Report

10 changes: 10 additions & 0 deletions pandoc/lss-report/latex.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
defaults:
- ./src/pps-report/index
- ./pandoc/defaults/latex

output-file: LSSReport.pdf
resource-path: ['./src/lss-report']

metadata:
title: ScalaQuest
subtitle: LSS Report
10 changes: 10 additions & 0 deletions pandoc/pps-report/html.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
defaults:
- ./src/pps-report/index
- ./pandoc/defaults/html

output-file: PPSReport.html
resource-path: ['./src/pps-report']

metadata:
title: ScalaQuest PPS Report

Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from: markdown

defaults:
- ./src/markdown/pps-report/pps-default
- ./src/pps-report/index
- ./pandoc/defaults/latex

output-file: PPSReport.pdf
resource-path: ['./src/pps-report']

metadata:
title: ScalaQuest
subtitle: PPS Report
lang: it-IT
2 changes: 2 additions & 0 deletions pandoc/templates/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.html
*.md

0 comments on commit da83e3d

Please sign in to comment.