Skip to content

Commit 0c36f33

Browse files
GitHub Actions - Release Build (#5784) (#5789)
* Github Actions Release * github release fixes * update secret name * Fixes tests * Adds doc step and dev biweekly build * Add in biweekly logic
1 parent 6aae8c1 commit 0c36f33

File tree

4 files changed

+326
-32
lines changed

4 files changed

+326
-32
lines changed
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: Github Actions - Build Dev Biweekly Anaconda Release
2+
3+
env:
4+
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
5+
ENCRYPTION_KEY: ${{ secrets.KDU_ENC_KEY }}
6+
7+
on:
8+
schedule:
9+
- cron: '0 5 * * 6' # 10:00 PM MST Friday (UTC: Saturday 5:00 AM)
10+
jobs:
11+
build:
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, macos-13]
16+
runs-on: ${{ matrix.os }}
17+
18+
steps:
19+
- name: Skip odd weeks
20+
run: |
21+
WEEK_NUM=$(date +%V)
22+
if (( WEEK_NUM % 2 != 0 )); then
23+
echo "Skipping this week ($WEEK_NUM is odd)."
24+
exit 0
25+
fi
26+
27+
- uses: actions/checkout@v4
28+
29+
- name: Set up Mambaforge
30+
uses: conda-incubator/setup-miniconda@v3
31+
with:
32+
miniforge-variant: Miniforge3
33+
auto-update-conda: true
34+
use-mamba: true
35+
36+
- name: Build Release
37+
run: |
38+
export ISIS_VERSION=$(date +%Y.%m.%d)
39+
echo $ISIS_VERSION
40+
41+
mamba install conda-build anaconda-client
42+
git fetch origin
43+
git checkout dev
44+
cd recipe
45+
46+
echo $ENCRYPTION_KEY | openssl enc -aes-256-cbc -d -in kakadu/kakadu_7_9.zip.enc -out kakadu/kakadu_7_9.zip -pbkdf2 -iter 10000 -pass stdin
47+
unzip -j kakadu/kakadu_7_9.zip -d /tmp/kakadu_7_9 -x "__MACOSX/*"
48+
49+
50+
if [[ "$OSTYPE" == "darwin"* ]]; then
51+
sed -i '' "s|/isisData/kakadu|/tmp/kakadu_7_9|g" build.sh
52+
sed -i '' "s/{% set version = \"[^\"]*\" %}/{% set version = \"$ISIS_VERSION\" %}/" meta.yaml
53+
sed -i '' "s/version: {{ version }}.0_RC[^ ]*/version: {{ version }}/" meta.yaml
54+
sed -i '' "s/git_tag: {{ version }}/git_tag: 'dev'/" meta.yaml
55+
else
56+
sed -i "s|/isisData/kakadu|/tmp/kakadu_7_9|g" build.sh
57+
sed -i "s/{% set version = \"[^\"]*\" %}/{% set version = \"$ISIS_VERSION\" %}/" meta.yaml
58+
sed -i "s/version: {{ version }}.0_RC[^ ]*/version: {{ version }}/" meta.yaml
59+
sed -i "s/git_tag: {{ version }}/git_tag: 'dev'/" meta.yaml
60+
fi
61+
62+
conda build . -c conda-forge -c usgs-astrogeology --override-channels --user usgs-astrogeology --label dev
63+
64+
BUILT_DIR=$(conda info --base)/conda-bld
65+
BUILT_PACKAGE=$(find "$BUILT_DIR" -name "isis-${ISIS_VERSION}-*.conda" | head -n1)
66+
echo "$BUILT_PACKAGE" > built_package.txt
67+
68+
- name: Upload artifact
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: built-package-${{ matrix.os }}
72+
path: built_package.txt
73+
74+
test:
75+
runs-on: ${{ matrix.os }}
76+
needs: build
77+
strategy:
78+
fail-fast: false
79+
matrix:
80+
os: [ubuntu-latest, macos-13]
81+
include:
82+
- os: ubuntu-latest
83+
python: "3.10"
84+
- os: macos-13
85+
python: "3.12"
86+
87+
steps:
88+
- name: Set up Miniforge
89+
uses: conda-incubator/setup-miniconda@v3
90+
with:
91+
miniforge-variant: Miniforge3
92+
auto-update-conda: true
93+
activate-environment: isis-test
94+
use-mamba: true
95+
mamba-version: "1.5.3"
96+
python-version: ${{ matrix.python-version }}
97+
98+
- name: Conda install and test spiceinit
99+
run: |
100+
export ISIS_VERSION=$(date +%Y.%m.%d)
101+
102+
source "${CONDA}/etc/profile.d/conda.sh"
103+
conda activate isis-test
104+
105+
conda install -c conda-forge -c usgs-astrogeology usgs-astrogeology/label/dev::isis=${ISIS_VERSION} -y
106+
107+
export ISISROOT=$CONDA_PREFIX
108+
conda list isis
109+
spiceinit -h
110+
111+
- name: Cleanup Anaconda package if spiceinit fails
112+
if: failure()
113+
run: |
114+
echo "Cleaning up Anaconda download..."
115+
BUILT_PACKAGE=${{ needs.build.outputs.built_package }}
116+
echo "Removing package: $BUILT_PACKAGE"
117+
anaconda --token ${{ secrets.ANACONDA_TOKEN }} remove usgs-astrogeology/isis/${BUILT_PACKAGE} -y
118+
119+
docs:
120+
name: Build and Upload ISIS Dev Docs
121+
runs-on: ubuntu-latest
122+
needs: test
123+
if: ${{ success() }}
124+
steps:
125+
- uses: actions/checkout@v4
126+
127+
- name: Set up Conda for doc build
128+
uses: conda-incubator/setup-miniconda@v3
129+
with:
130+
miniforge-variant: Miniforge3
131+
auto-update-conda: true
132+
environment-file: environment.yml
133+
activate-environment: isis
134+
use-mamba: true
135+
136+
- name: Build documentation
137+
run: |
138+
source "${CONDA}/etc/profile.d/conda.sh"
139+
conda activate isis
140+
mkdir build && cd build
141+
export ISISROOT=$(pwd)
142+
cmake -GNinja ../isis
143+
ninja docs
144+
145+
- name: Set AWS credentials for upload
146+
uses: aws-actions/configure-aws-credentials@0e613a0980cbf65ed5b322eb7a1e075d28913a83
147+
with:
148+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
149+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
150+
aws-region: us-west-2
151+
152+
- name: Upload to S3
153+
run: |
154+
cd docs && cd "$(find . -maxdepth 1 -type d ! -name .)"
155+
echo "Uploading documentation to S3..."
156+
aws s3 sync ./ s3://asc-public-docs/isis-site/dev/ --delete
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
name: Github Actions - Build Anaconda Release
2+
3+
env:
4+
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
5+
ENCRYPTION_KEY: ${{ secrets.KDU_ENC_KEY }}
6+
7+
on:
8+
release:
9+
types: [prereleased, released]
10+
push:
11+
branches:
12+
- '*.*.*_RC*'
13+
- '*.*.*_LTS'
14+
jobs:
15+
build:
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest, macos-13]
20+
runs-on: ${{ matrix.os }}
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up Mambaforge
26+
uses: conda-incubator/setup-miniconda@v3
27+
with:
28+
miniforge-variant: Miniforge3
29+
auto-update-conda: true
30+
use-mamba: true
31+
32+
- name: Build Release
33+
env:
34+
ISIS_VERSION: ${{ github.event.release.tag_name || github.ref_name }}
35+
run: |
36+
mamba install conda-build anaconda-client
37+
git fetch origin
38+
if [[ "$ISIS_VERSION" =~ .*_RC[0-9]$ ]]; then
39+
git checkout $ISIS_VERSION
40+
else
41+
git checkout refs/tags/$ISIS_VERSION
42+
fi
43+
cd recipe
44+
echo $ENCRYPTION_KEY | openssl enc -aes-256-cbc -d -in kakadu/kakadu_7_9.zip.enc -out kakadu/kakadu_7_9.zip -pbkdf2 -iter 10000 -pass stdin
45+
unzip -j kakadu/kakadu_7_9.zip -d /tmp/kakadu_7_9 -x "__MACOSX/*"
46+
if [[ "$OSTYPE" == "darwin"* ]]; then
47+
sed -i '' "s|/isisData/kakadu|/tmp/kakadu_7_9|g" build.sh
48+
else
49+
sed -i "s|/isisData/kakadu|/tmp/kakadu_7_9|g" build.sh
50+
fi
51+
52+
if [[ "$ISIS_VERSION" =~ .*_RC[0-9]$ ]]; then
53+
conda build . -c conda-forge -c usgs-astrogeology --override-channels --user usgs-astrogeology --label RC
54+
elif [[ "$ISIS_VERSION" =~ .*_LTS$ ]]; then
55+
conda build . -c conda-forge -c usgs-astrogeology --override-channels --user usgs-astrogeology --label LTS
56+
else
57+
conda build . -c conda-forge -c usgs-astrogeology --override-channels --user usgs-astrogeology --label LTS --label main
58+
fi
59+
60+
BUILT_DIR=$(conda info --base)/conda-bld
61+
BUILT_PACKAGE=$(find "$BUILT_DIR" -name "isis-${ISIS_VERSION}-*.conda" | head -n1)
62+
echo "$BUILT_PACKAGE" > built_package.txt
63+
64+
- name: Upload artifact
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: built-package-${{ matrix.os }}
68+
path: built_package.txt
69+
70+
test:
71+
runs-on: ${{ matrix.os }}
72+
needs: build
73+
strategy:
74+
fail-fast: false
75+
matrix:
76+
os: [ubuntu-latest, macos-13]
77+
include:
78+
- os: ubuntu-latest
79+
python: "3.10"
80+
- os: macos-13
81+
python: "3.12"
82+
env:
83+
ISIS_VERSION: ${{ github.event.release.tag_name || github.ref_name }}
84+
85+
steps:
86+
- name: Set up Miniforge
87+
uses: conda-incubator/setup-miniconda@v3
88+
with:
89+
miniforge-variant: Miniforge3
90+
auto-update-conda: true
91+
activate-environment: isis-test
92+
use-mamba: true
93+
mamba-version: "1.5.3"
94+
python-version: ${{ matrix.python-version }}
95+
96+
- name: Conda install and test spiceinit
97+
run: |
98+
source "${CONDA}/etc/profile.d/conda.sh"
99+
conda activate isis-test
100+
if [[ "$ISIS_VERSION" =~ .*_RC[0-9]$ ]]; then
101+
conda install -c conda-forge -c usgs-astrogeology usgs-astrogeology/label/RC::isis=${ISIS_VERSION} -y
102+
elif [[ "$ISIS_VERSION" =~ .*_LTS$ ]]; then
103+
conda install -c conda-forge -c usgs-astrogeology usgs-astrogeology/label/LTS::isis=${ISIS_VERSION} -y
104+
else
105+
conda install -c conda-forge -c usgs-astrogeology isis=${ISIS_VERSION} -y
106+
fi
107+
108+
export ISISROOT=$CONDA_PREFIX
109+
conda list isis
110+
spiceinit -h
111+
112+
- name: Cleanup Anaconda package if spiceinit fails
113+
if: failure()
114+
run: |
115+
echo "Cleaning up Anaconda download..."
116+
BUILT_PACKAGE=${{ needs.build.outputs.built_package }}
117+
echo "Removing package: $BUILT_PACKAGE"
118+
anaconda --token ${{ secrets.ANACONDA_TOKEN }} remove usgs-astrogeology/isis/${BUILT_PACKAGE} -y
119+
120+
docs:
121+
name: Build and Upload ISIS Public Release Docs
122+
runs-on: ubuntu-latest
123+
needs: test
124+
env:
125+
ISIS_VERSION: ${{ github.event.release.tag_name || github.ref_name }}
126+
if: |
127+
${{
128+
success() &&
129+
!contains(env.ISIS_VERSION, '_RC') &&
130+
!contains(env.ISIS_VERSION, '_LTS')
131+
}}
132+
steps:
133+
- uses: actions/checkout@v4
134+
135+
- name: Set up Conda for doc build
136+
uses: conda-incubator/setup-miniconda@v3
137+
with:
138+
miniforge-variant: Miniforge3
139+
auto-update-conda: true
140+
environment-file: environment.yml
141+
activate-environment: isis
142+
use-mamba: true
143+
144+
- name: Build documentation
145+
run: |
146+
source "${CONDA}/etc/profile.d/conda.sh"
147+
conda activate isis
148+
mkdir build && cd build
149+
export ISISROOT=$(pwd)
150+
cmake -GNinja ../isis
151+
ninja docs
152+
153+
- name: Set AWS credentials for upload
154+
uses: aws-actions/configure-aws-credentials@0e613a0980cbf65ed5b322eb7a1e075d28913a83
155+
with:
156+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
157+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
158+
aws-region: us-west-2
159+
160+
- name: Upload to S3
161+
run: |
162+
cd docs
163+
if [ -d "${ISIS_VERSION}" ]; then
164+
cd "${ISIS_VERSION}"
165+
echo "Uploading documentation to S3..."
166+
aws s3 sync ./ s3://asc-public-docs/isis-site/${ISIS_VERSION}/ --delete
167+
else
168+
echo "Error: docs/${ISIS_VERSION} directory not found!"
169+
exit 1
170+
fi

.github/workflows/gitlab-release.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

recipe/kakadu/kakadu_7_9.zip.enc

959 KB
Binary file not shown.

0 commit comments

Comments
 (0)