-
Notifications
You must be signed in to change notification settings - Fork 124
95 lines (91 loc) · 3.51 KB
/
comment_trigger_test_itensorglmakie.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Run ITensorGLMakie tests from comment trigger
# https://dev.to/zirkelc/trigger-github-workflow-for-comment-on-pull-request-45l2
on:
issue_comment:
types: [created]
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ matrix.threads }} thread(s)
if: github.event.issue.pull_request && contains(github.event.comment.body, '[test ITensorGLMakie]')
runs-on: ${{ matrix.os }}
env:
JULIA_NUM_THREADS: ${{ matrix.threads }}
strategy:
matrix:
version:
- '1.6'
- '1'
os:
- ubuntu-20.04 # Needed for proper CI installation?
threads:
- '2'
arch:
- x64
steps:
- name: Get PR branch
uses: xt0rted/pull-request-comment-branch@v1
id: comment-branch
- name: Set latest commit status as pending
uses: myrotvorets/set-commit-status-action@master
with:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
- name: Checkout PR branch
uses: actions/checkout@v3
with:
# https://github.com/actions/checkout/issues/331#issuecomment-1438220926
ref: refs/pull/${{ github.event.issue.number }}/head
- name: Setup Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
- name: Install Julia dependencies
shell: julia --project=monorepo {0}
run: |
using Pkg;
Pkg.develop(path=".");
Pkg.develop(path="./NDTensors");
Pkg.develop(path="./ITensorVisualizationBase");
Pkg.develop(path="./ITensorMakie");
Pkg.develop(path="./ITensorGLMakie");
- name: Run the tests
run: |
DISPLAY=:0 xvfb-run -s '-screen 0 1024x768x24' julia --project=monorepo --depwarn=yes -e 'using Pkg; Pkg.test("ITensorGLMakie")'
- name: Set latest commit status as ${{ job.status }}
uses: myrotvorets/set-commit-status-action@master
if: always()
with:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
- name: Add comment to PR
uses: actions/github-script@v6
if: always()
with:
script: |
const name = '${{ github.workflow }}';
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
const success = '${{ job.status }}' === 'success';
const body = `${name}: ${success ? 'succeeded ✅' : 'failed ❌'}\n${url}`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})