Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scheduled build #95

Merged
merged 31 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0860cc4
Workflow reuse attempt for scheduling and slack notification
Mark90 Feb 10, 2022
ccdea49
Workflow reuse attempt for scheduling and slack notification
Mark90 Feb 10, 2022
e0732bd
Workflow reuse attempt for scheduling and slack notification
Mark90 Feb 10, 2022
64d41e4
Workflow reuse attempt for scheduling and slack notification
Mark90 Feb 10, 2022
1822b25
Workflow reuse attempt for scheduling and slack notification
Mark90 Feb 10, 2022
b1ad15f
Workflow reuse attempt for scheduling and slack notification
Mark90 Feb 10, 2022
ecafe2c
Workflow reuse attempt for scheduling and slack notification
Mark90 Feb 10, 2022
2fb8a89
Env context does not work when calling another workflow...
Mark90 Feb 10, 2022
c38bbf6
Secret context does not work when calling another workflow...
Mark90 Feb 10, 2022
310f7b9
Fix setting env var
Mark90 Feb 10, 2022
5872902
Consistent slack message with gitlab
Mark90 Feb 10, 2022
3aa3040
Cleanup
Mark90 Feb 11, 2022
b0f0778
Cleanup
Mark90 Feb 11, 2022
c4ec528
Test action from marketplace
Mark90 Feb 11, 2022
67e8810
Test action from marketplace
Mark90 Feb 11, 2022
689a4d3
Test action from marketplace
Mark90 Feb 11, 2022
35abd2a
Test action from marketplace
Mark90 Feb 11, 2022
0ff6fec
Test action from marketplace
Mark90 Feb 11, 2022
bfddde3
Change message style to gitlab
Mark90 Feb 11, 2022
0e84607
Use slack.sh again
Mark90 Feb 11, 2022
5a41190
Update scheduled-check.yml
Mark90 Feb 11, 2022
11553da
Update scheduled-check.yml
Mark90 Feb 11, 2022
02d0b01
Update scheduled-check.yml
Mark90 Feb 11, 2022
269b2fa
Test build canceling itself
Mark90 Feb 11, 2022
f59a11d
Test build canceling itself
Mark90 Feb 11, 2022
4e2f9f5
Test build canceling itself
Mark90 Feb 11, 2022
6625352
Test build canceling itself
Mark90 Feb 11, 2022
c6e1fc7
...
Mark90 Feb 11, 2022
72586fb
Almost
Mark90 Feb 11, 2022
4f3c529
Final
Mark90 Feb 11, 2022
d95700b
Remove push trigger
Mark90 Feb 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/run-linting-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
pull_request:
branches: [master]
workflow_call:

jobs:
build:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Unit tests
on: push
on:
push:
workflow_call:

jobs:
container_job:
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/scheduled-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Scheduled build and test

on:
schedule: # Targets the default branch
- cron: '0 6 * * MON' # This is UTC, no TZ option yet unfortunately

jobs:
check_week:
runs-on: ubuntu-latest
# Custom check as github does not support modulo syntax from gitlab ("0 7 * * MON%2")
outputs:
should_cancel: ${{ steps.week-modulo.outputs.should_cancel }}
steps:
- run: echo "::set-output name=should_cancel::$(expr `date +%W` % 2)"
id: week-modulo
- name: Cancel workflow every other week
uses: andymckay/[email protected]
if: ${{ steps.week-modulo.outputs.should_cancel == '1' }}

run_build:
uses: ./.github/workflows/run-linting-tests.yml
needs: [check_week]

run_tests:
uses: ./.github/workflows/run-unit-tests.yml
needs: [run_build]

slack:
needs: [check_week, run_tests]
runs-on: ubuntu-latest
if: ${{ needs.check_week.outputs.should_cancel != '1' }}
steps:
- uses: technote-space/workflow-conclusion-action@v2
- run: echo "ICON=$([ \"$WORKFLOW_CONCLUSION\" == \"success\" ] && echo white_check_mark || echo zap)" >> $GITHUB_ENV
- run: echo "REPO=$(echo "$GITHUB_REPOSITORY" | cut -d '/' -f2-)" >> $GITHUB_ENV
- run: echo "MSG=$([ \"$WORKFLOW_CONCLUSION\" == \"success\" ] && echo "Successful build" || echo "Build failed")" >> $GITHUB_ENV
- run: echo "CI_JOB_URL=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV
- run: wget --quiet https://raw.githubusercontent.com/workfloworchestrator/nitpick-style/main/ci/scripts/slack.sh && chmod +x slack.sh
- run: ./slack.sh "${{ secrets.CI_SLACK_NOTIFICATION_CHANNEL }}" "$MSG $REPO $CI_JOB_URL" $ICON "Github Pipeline"
if: ${{ contains(fromJson('["failure", "timed_out", "success"]'), env.WORKFLOW_CONCLUSION) }} # notify on success, failure, timeout
env:
CI_SLACK_WEBHOOK_URL: ${{ secrets.CI_SLACK_WEBHOOK_URL }}