Skip to content

Commit 91a2576

Browse files
authored
Update CI to run on PRs (#6)
1 parent 31286a1 commit 91a2576

3 files changed

Lines changed: 29 additions & 7 deletions

File tree

.github/workflows/run.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,46 @@
11
name: Run pipeline
22

3-
on: push
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
48

59
permissions:
610
contents: write
711

12+
# Make sure we only ever run one per branch so we don't have issues pushing
13+
# after running the pipeline
14+
concurrency:
15+
group: calkit-run-${{ github.ref }}
16+
cancel-in-progress: false
17+
818
jobs:
919
main:
1020
name: Run
1121
runs-on: ubuntu-latest
1222
steps:
1323
- uses: actions/checkout@v4
24+
with:
25+
# For PRs, checkout the head ref to avoid detached HEAD
26+
ref: ${{ github.head_ref || github.ref_name }}
27+
token: ${{ secrets.GITHUB_TOKEN }}
1428
- name: Configure Git credentials
1529
run: |
1630
git config user.name github-actions[bot]
1731
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v3
34+
- name: Setup uv
35+
uses: astral-sh/setup-uv@v5
1836
- name: Setup Miniforge
1937
uses: conda-incubator/setup-miniconda@v3
2038
with:
2139
miniforge-version: latest
2240
auto-activate-base: true
2341
conda-remove-defaults: true
24-
- run: pip install calkit-python
42+
- name: Install Calkit
43+
run: uv tool install calkit-python
2544
- name: Restore DVC cache
2645
id: cache-dvc-restore
2746
uses: actions/cache/restore@v4
@@ -33,8 +52,9 @@ jobs:
3352
- run: calkit config remote-auth
3453
env:
3554
CALKIT_DVC_TOKEN: ${{ secrets.CALKIT_DVC_TOKEN }}
36-
- run: dvc pull
55+
- run: calkit dvc pull
3756
- run: calkit run
57+
# If running on a PR, push to that branch, else push to main
3858
- run: calkit save -am "Run pipeline"
3959
env:
4060
CALKIT_DVC_TOKEN: ${{ secrets.CALKIT_DVC_TOKEN }}

dvc.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ stages:
6565
nfiles: 2
6666
- path: paper/paper.tex
6767
hash: md5
68-
md5: 1480301e18c57bf533d604e1a3593101
69-
size: 653
68+
md5: 09f2923d7ec5a75fefe95497d6e177cd
69+
size: 678
7070
outs:
7171
- path: paper/paper.pdf
7272
hash: md5
73-
md5: 13ee8eb76f777de6242c16c15d054673
74-
size: 94915
73+
md5: bff1721a57af4275b13af9dd8033ad9a
74+
size: 95417
7575
_check_env_py:
7676
cmd: calkit check conda-env --file environment.yml --output
7777
.calkit/env-locks/py.yml

paper/paper.tex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ \section{Section 2}
4040

4141
This is another sentence in the second section.
4242

43+
This was added in a PR.
44+
4345
%--/Paper--
4446

4547
\end{document}

0 commit comments

Comments
 (0)