new bridge and boiler related operations #98
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: Run tado API tests with Maven | |
on: | |
push: | |
branches: [ "main" ] | |
tags: [ 'v*' ] | |
pull_request: | |
branches: [ "main" ] | |
schedule: | |
# run every Monday at 10.00 UTC | |
- cron: "0 10 * * 1" | |
jobs: | |
# verify whether the tado api spec matches the actual API by | |
# - generating API client code based on the spec | |
# - executing integration tests which uses the generated API client to call API methods | |
verify-api-spec: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Java 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: maven | |
- name: Run API test-suite | |
env: | |
TADO_USERNAME: ${{ secrets.TADO_USERNAME }} | |
TADO_PASSWORD: ${{ secrets.TADO_PASSWORD }} | |
run: mvn --batch-mode --update-snapshots clean verify -P local-api-spec --file pom.xml | |
# Building the site must be a separate step, otherwise no aggregated reports are available | |
# https://www.prient.co.uk/2017/03/aggregating-reports-in-multi-module.html | |
- name: Build maven site | |
run: mvn --batch-mode --update-snapshots -Dmaven.test.skip=true site -P local-api-spec --file pom.xml | |
# https://github.com/actions/upload-pages-artifact | |
- name: Upload maven site as github build artifact | |
id: upload-github-artifact | |
uses: actions/upload-pages-artifact@v3 # or specific "vX.X.X" version tag for this action | |
with: | |
path: target/site | |
# Deploy the mvn site to github pages (https://github.com/actions/deploy-pages) | |
deploy-site: | |
# run deploy-site job regardless the result of the verification job | |
# --> https://stackoverflow.com/questions/58858429/how-to-run-a-github-actions-step-even-if-the-previous-step-fails-while-still-f | |
# run deploy-site job only on changes to the main branch | |
# --> https://stackoverflow.com/questions/58139406/only-run-job-on-specific-branch-with-github-actions | |
if: (success() || failure()) && github.ref == 'refs/heads/main' | |
# Run after the verify-api-spec job (that job uploads the github build artifact that we're publishing in this job) | |
needs: verify-api-spec | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.pages_deployment.outputs.page_url }} | |
# Specify runner + deployment step | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy maven site to GitHub Pages | |
id: pages_deployment | |
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action | |
status-mail: | |
runs-on: ubuntu-latest | |
needs: [verify-api-spec, deploy-site] | |
# only execute when workflow is triggered by a schedule, regardless of the result of the workflow | |
if: (success() || failure()) && github.event_name == 'schedule' | |
steps: | |
- name: Send workflow run status mail | |
uses: dawidd6/action-send-mail@v3 | |
with: | |
# Required mail server address if not connection_url | |
server_address: smtp.gmail.com | |
# Server port, default 25: | |
server_port: 465 | |
# Optional (recommended) mail server username: | |
username: ${{secrets.MAIL_USERNAME}} | |
# Optional (recommended) mail server password: | |
password: ${{secrets.MAIL_APP_PASSWORD}} | |
# Required mail subject: | |
subject: '[GitHub | ${{ github.repository }}] Tado API verification job has finished with status ${{ needs.verify-api-spec.result }}' | |
# Required recipients' addresses: | |
to: [email protected] | |
# Required sender full name (address can be skipped): | |
from: GitHub workflow | |
# Optional plain body: | |
# (see https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs | |
# for available context values) | |
body: > | |
Tado API verification job has finished with status ${{ needs.verify-api-spec.result }} | |
Details: | |
* repo: ${{ github.repository }} | |
* workflow: ${{ github.workflow }} | |
* workflow trigger: ${{ github.event_name }} | |
* github reference: ${{ github.ref_type }} ${{ github.ref_name }} (${{ github.ref }}) | |
Relevant links: | |
* GitHub workflow run: https://github.com/kritsel/tado-openapispec-v2/actions/runs/${{github.run_id}} | |
* API test results: https://kritsel.github.io/tado-openapispec-v2/failsafe-report.html |