Skip to content

Commit fd11d27

Browse files
authored
Merge pull request #12 from DukeCosmology/action_make_image
Update make_test_image action
2 parents 64f1ee7 + ab38af0 commit fd11d27

3 files changed

Lines changed: 32 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ on:
44
workflow_dispatch: null
55

66
permissions:
7-
content: write
7+
contents: write
8+
9+
env:
10+
BRANCH_NAME: ${{ github.ref_name }}
811

912
jobs:
1013
build:
@@ -16,36 +19,46 @@ jobs:
1619
steps:
1720
- uses: actions/checkout@v6
1821
with:
19-
# lfs: true
20-
ref: ${{ github.head_ref }}
22+
lfs: true
23+
ref: ${{ github.ref || github.ref_name }}
2124

22-
- name: Configure Git and pull from LFS
25+
# https://github.com/actions/checkout?tab=readme-ov-file#push-a-commit-using-the-built-in-token
26+
- name: Configure Git for pushing from actions
27+
run: |
2328
git config user.name "github-actions[bot]"
2429
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
25-
git config lfs.fetchexclude "reference"
26-
git lfs pull
27-
28-
- name: Set up Python
29-
uses: actions/setup-python@v6
30-
with:
31-
python-version: ${{ matrix.python-version }}
32-
cache: pip
3330
3431
- name: Install roman_imsim
35-
run: pip install git+https://github.com/DukeCosmology/roman_imsim.git
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install git+https://github.com/DukeCosmology/roman_imsim.git@${BRANCH_NAME}
3635
3736
- name: Run GalSim
3837
run: |
39-
galsim hack.yaml output.dir=reference/RomanWAS_new/images/truth output.truth.dir=reference/RomanWAS_new/truth
38+
galsim hack.yaml
4039
41-
# https://github.com/actions/checkout?tab=readme-ov-file#push-a-commit-using-the-built-in-token
4240
- name: Commit and push output
4341
run: |
42+
if zdiff output/RomanWAS_new/images/truth/Roman_WAS_truth_J129_12909_4.fits.gz reference/RomanWAS_new/images/truth/Roman_WAS_truth_J129_12909_4.fits.gz; then
43+
echo "reference image is unchanged"
44+
else
45+
echo "reference image is changed"
46+
mv -v output/RomanWAS_new/images/truth/Roman_WAS_truth_J129_12909_4.fits.gz reference/RomanWAS_new/images/truth/Roman_WAS_truth_J129_12909_4.fits.gz
47+
fi
48+
49+
if diff output/RomanWAS_new/truth/Roman_WAS_index_J129_12909_4.txt reference/RomanWAS_new/truth/Roman_WAS_index_J129_12909_4.txt; then
50+
echo "reference table is unchanged"
51+
else
52+
echo "reference table is changed"
53+
mv -v output/RomanWAS_new/truth/Roman_WAS_index_J129_12909_4.txt reference/RomanWAS_new/truth/Roman_WAS_index_J129_12909_4.txt
54+
fi
55+
4456
if git diff --exit-code; then
4557
echo "reference/ is unchanged; no action needed"
4658
else
4759
echo "reference/ is changed; pushing updates"
4860
git add reference
49-
git commit -m "Update reference image"
61+
git commit -m "Update reference"
5062
git push
5163
fi
64+
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:b981cc76864755e6dfd92e6a623ad44c7e8032a892b5b241347ee64b7db07793
3-
size 17799648
2+
oid sha256:4c563979b52f0a61c93fb91e2f8351081292388537daeb3d360e4aeaecf930fd
3+
size 18820298
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:4dc8369ae0aa03a5054abd249aa7bf30a6aebcdb5acb34b868f635c087a59a9b
2+
oid sha256:bbd7aab85c8b8afc6f92179fac49b776440c3678ca523ad19a2d26e3418f0059
33
size 2923527

0 commit comments

Comments
 (0)