-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (83 loc) · 2.83 KB
/
run.yml
File metadata and controls
87 lines (83 loc) · 2.83 KB
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
name: Run pipeline
on:
push:
branches:
- main
pull_request:
permissions:
contents: write
pull-requests: write # Add this for PR comments
# Make sure we only ever run one per branch so we don't have issues pushing
# after running the pipeline
concurrency:
group: calkit-run-${{ github.ref }}
cancel-in-progress: false
jobs:
main:
name: Run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# For PRs, checkout the head ref to avoid detached HEAD
ref: ${{ github.head_ref || github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Setup uv
uses: astral-sh/setup-uv@v5
- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
auto-activate-base: true
conda-remove-defaults: true
- name: Install Calkit
run: uv tool install calkit-python
- name: Restore DVC cache
id: cache-dvc-restore
uses: actions/cache/restore@v4
with:
path: .dvc/cache
key: ${{ runner.os }}-dvc-cache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-dvc-cache-
- run: calkit config remote-auth
env:
CALKIT_DVC_TOKEN: ${{ secrets.CALKIT_DVC_TOKEN }}
- run: calkit dvc pull
- run: calkit run
# If running on a PR, push to that branch, else push to main
- run: calkit save -am "Run pipeline"
env:
CALKIT_DVC_TOKEN: ${{ secrets.CALKIT_DVC_TOKEN }}
- name: Upload PDF artifact
uses: actions/upload-artifact@v4
with:
name: paper-pdf
path: paper/paper.pdf
if-no-files-found: warn
- name: Comment on PR with PDF link
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
if (fs.existsSync('paper/paper.pdf')) {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '📄 **Pipeline completed!** The generated PDF is available as an artifact in this workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
});
}
- name: Save DVC cache
id: cache-dvc-save
uses: actions/cache/save@v4
with:
path: .dvc/cache
key: ${{ runner.os }}-dvc-cache-${{ github.sha }}