Test template (daily) #307
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: Test template (daily) | |
on: | |
workflow_dispatch: # allows manual triggering | |
schedule: | |
- cron: "8 0 * * *" # run on a daily basis | |
jobs: | |
test-template: | |
name: Test template | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
path: repo | |
- name: Setup | |
uses: ./repo/.github/actions/common-setup | |
with: | |
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_TWEAG_JUPYTER_NIX_AUTH_TOKEN }} | |
- name: Initialize template | |
run: | | |
nix flake new --template github:tweag/jupyterWith example | |
- name: Build | |
run: | | |
cd example/ | |
nix build | |
- name: Get current date | |
id: date | |
if: always() | |
run: echo "::set-output name=date::$(TZ=GMT date +'%Y-%m-%d %H:%M:%S %Z')" | |
- name: Get status | |
id: status | |
if: always() | |
uses: ASzc/change-string-case-action@v5 | |
with: | |
string: ${{ job.status }} | |
- name: Get status emoji | |
id: status_emoji | |
if: always() | |
uses: haya14busa/action-cond@v1 | |
with: | |
cond: ${{ steps.status.outputs.lowercase == 'success' }} | |
if_true: "🎉" | |
if_false: "💩" | |
- name: Send message to matrix | |
id: matrix-chat-message-always-notifiy | |
if: always() | |
uses: fadenb/matrix-chat-message@v0.0.6 | |
with: | |
homeserver: 'matrix.org' | |
token: ${{ secrets.MATRIX_TOKEN }} | |
channel: '!JVjIaYhrLXOiLWJfnL:matrix.org' # notifications room | |
message: | | |
${{ steps.status_emoji.outputs.value }} ***${{ steps.status.outputs.uppercase }}***\ | |
Workflow ***${{ github.workflow }}***\ | |
Job ***${{ github.job }}***\ | |
Triggered by ***${{ github.event_name }}***\ | |
For `${{ github.ref }}`\ | |
On `${{ github.sha }}`\ | |
At ${{ steps.date.outputs.date }}\ | |
With schedule `${{ github.event.schedule }}` | |
- name: Send message to matrix | |
id: matrix-chat-message-failure-notifiy | |
if: ${{ steps.status_emoji.outputs.value == 'failure' }} | |
uses: fadenb/matrix-chat-message@v0.0.6 | |
with: | |
homeserver: 'matrix.org' | |
token: ${{ secrets.MATRIX_TOKEN }} | |
channel: '!hrqXNOEWKJRLLIJlcS:matrix.org' # dev room | |
message: | | |
${{ steps.status_emoji.outputs.value }} ***${{ steps.status.outputs.uppercase }}***\ | |
Workflow ***${{ github.workflow }}***\ | |
Job ***${{ github.job }}***\ | |
Triggered by ***${{ github.event_name }}***\ | |
For `${{ github.ref }}`\ | |
On `${{ github.sha }}`\ | |
At ${{ steps.date.outputs.date }}\ | |
With schedule `${{ github.event.schedule }}` |