Skip to content

Commit

Permalink
Merge pull request #182 from SciML/cdg/rebuildaction
Browse files Browse the repository at this point in the history
Use new RebuildAction
  • Loading branch information
christopher-dG committed Jun 23, 2020
2 parents 9f10e63 + 0676e41 commit 563c1ec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 168 deletions.
82 changes: 7 additions & 75 deletions .github/workflows/rebuild.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rebuild Tutorials
name: Rebuild Content
on:
schedule:
- cron: 0 0 */3 * *
Expand All @@ -7,81 +7,13 @@ on:
- created
push:
status:
env:
GITLAB_PROJECT: ${{ secrets.GITLAB_PROJECT }}
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
jobs:
TriggerRebuild:
if: github.event_name == 'schedule' || github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '!rebuild')
Rebuild:
runs-on: ubuntu-latest
steps:
- run: |
cmd="$(jq -r .comment.body < "$GITHUB_EVENT_PATH" | head -n1 | cut -d' ' -f2-)"
while [[ "$cmd" != '' && "$cmd" != '!rebuild' ]]; do
arg="$(echo $cmd | cut -d' ' -f1)"
key="$(echo $arg | cut -d= -f1)"
val="$(echo $arg | cut -d= -f2)"
case "$key" in
branch)
branch="$val"
;;
file)
folder="$(echo $val | cut -d/ -f1)"
file="$(echo $val | cut -d/ -f2)"
;;
*)
echo "Unknown command $key"
exit 1
;;
esac
if echo "$cmd" | grep -q ' '; then
cmd="$(echo $cmd | cut -d' ' -f2)"
else
cmd=""
fi
done
curl --fail \
-F "token=${{ secrets.GITLAB_TOKEN }}" \
-F "ref=master" \
-F "variables[BRANCH]=$branch" \
-F "variables[FOLDER]=$folder" \
-F "variables[FILE]=$file" \
https://gitlab.com/api/v4/projects/19345468/trigger/pipeline
- if: github.event_name == 'issue_comment'
uses: actions/github-script@v2
- uses: SciML/RebuildAction@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.reactions.createForIssueComment({
...context.repo,
comment_id: context.payload.comment.id,
content: "+1",
})
OpenPR:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/rebuild/')
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.pulls.create({
...context.repo,
title: "Rebuild tutorials",
head: "${{ github.ref }}".slice(11),
base: "master",
})
FixStatus:
if: github.event_name == 'status' && github.event.context == 'ci/gitlab/gitlab.com' && github.event.state == 'failure'
runs-on: ubuntu-latest
steps:
# TODO: Replace this SHA with a tag when the next version is released.
- uses: actions/github-script@82b33c82ef5e155cb8e0de0862e5dbde0cd451eb
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.repos.createCommitStatus({
...context.repo,
sha: context.payload.sha,
state: "success",
context: context.payload.context,
description: "This status can be ignored",
target_url: context.payload.target_url,
})
token: ${{ secrets.GITHUB_TOKEN }}
31 changes: 6 additions & 25 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
stages:
- setup
- rebuild

setup:
stage: setup
only:
- triggers
image: python
script: |
pip install pyyaml
python make_pipeline.py > rebuild.yml
artifacts:
paths:
- rebuild.yml

rebuild:
stage: rebuild
trigger:
include:
- artifact: rebuild.yml
job: setup
strategy: depend
variables: # TODO: Delete after JuliaGPU/gitlab-ci#20
JULIA_PROJECT: "@."
include: https://raw.githubusercontent.com/SciML/RebuildAction/master/rebuild.yml
variables:
CONTENT_DIR: tutorials
EXCLUDE: exercises/02-workshop_solutions, models/06-pendulum_bayesian_inference
NEEDS_GPU: advanced/01-beeler_reuter
GITHUB_REPOSITORY: SciML/DiffEqTutorials.jl
68 changes: 0 additions & 68 deletions make_pipeline.py

This file was deleted.

0 comments on commit 563c1ec

Please sign in to comment.