Skip to content

Commit 9e89f35

Browse files
committed
hmm
1 parent f207bdd commit 9e89f35

File tree

3 files changed

+34
-12
lines changed

3 files changed

+34
-12
lines changed

.github/workflows/build_push_pr_ecr.yml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
env:
88
CONDA_CHANNEL: "s3://hls-conda-channels/hls-atmospheric-correction/pr-${{ github.event.pull_request.number }}"
9-
CHANNEL_DIR: "channel/"
9+
CONDA_CHANNEL_HTTP: "https://hls-conda-channels.s3.amazonaws.com/hls-atmospheric-correction/pr-${{ github.event.pull_request.number }}"
1010
# FIXME: for now set "--frozen" since we're having trouble with inconsistent lockfiles
1111
PIXI_FROZEN: true
1212

@@ -44,11 +44,10 @@ jobs:
4444
# ------------------------------------------------------------------
4545
build-and-publish:
4646
needs: analyze
47+
if: needs.analyze.outputs.has_changes == 'true'
4748
runs-on: ubuntu-latest
4849
steps:
4950
- uses: actions/checkout@v4
50-
with:
51-
ref: ${{ github.event.pull_request.head.ref }}
5251

5352
- uses: prefix-dev/setup-pixi@v0.9.2
5453
with:
@@ -65,40 +64,63 @@ jobs:
6564
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
6665
aws-region: us-west-2
6766

68-
- name: Build and publish packages
69-
if: needs.analyze.outputs.has_changes == 'true'
67+
- name: Execute Build Sequence
7068
run: |
71-
export CHANNEL_DIR
7269
pixi run -e build \
7370
build-publish-packages \
7471
"${{ needs.analyze.outputs.build_order }}"
7572
73+
# ------------------------------------------------------------------
74+
# JOB 3: Docker Build & Lockfile Update
75+
# ------------------------------------------------------------------
76+
build-docker:
77+
needs: [analyze, build-and-publish]
78+
# Run if Docker changed OR if packages were rebuilt (and build job succeeded)
79+
if: |
80+
always() &&
81+
(needs.analyze.outputs.docker_changed == 'true' || needs.analyze.outputs.has_changes == 'true') &&
82+
(needs.build-and-publish.result == 'success' || needs.build-and-publish.result == 'skipped')
83+
runs-on: ubuntu-latest
84+
steps:
85+
- uses: actions/checkout@v4
86+
with:
87+
ref: ${{ github.event.pull_request.head.ref }}
88+
89+
- uses: prefix-dev/setup-pixi@v0.9.2
90+
with:
91+
frozen: true
92+
environments: build
93+
7694
- name: Update Lockfile
7795
if: needs.analyze.outputs.has_changes == 'true'
7896
run: |
7997
echo "Updating lockfile for: ${{ needs.analyze.outputs.build_order }}"
8098
8199
# Add local package builds to "pr" feature as top priority
82-
pixi workspace channel add --no-install --prepend ./${CHANNEL_DIR}
100+
pixi workspace channel add --no-install --prepend ${CONDA_CHANNEL_HTTP}
83101
84102
# Update for these new builds
85103
pixi update --no-install ${{ needs.analyze.outputs.build_order }}
86104
105+
- name: Configure AWS Credentials
106+
uses: aws-actions/configure-aws-credentials@v4
107+
with:
108+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
109+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
110+
aws-region: us-west-2
111+
87112
- name: Login to Amazon ECR
88-
if: needs.analyze.outputs.docker_changed == 'true'
89113
id: login-ecr
90114
uses: aws-actions/amazon-ecr-login@v2
91115

92116
- name: Build and Push Docker Image
93-
if: needs.analyze.outputs.docker_changed == 'true'
94117
env:
95118
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
96119
ECR_REPOSITORY: hls-atmospheric-correction
97120
IMAGE_TAG: ${{ github.event.pull_request.number }}
98121
run: |
99122
docker build \
100123
-t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \
101-
--build-arg CHANNEL_DIR=${CHANNEL_DIR} \
102124
.
103125
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
104126

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# syntax=docker/dockerfile:1.7-labs
22
ARG PLATFORM=linux/amd64
33
ARG ENVIRONMENT=default
4-
ARG CHANNEL_DIR=channel
54
FROM --platform=${PLATFORM} ghcr.io/prefix-dev/pixi:bookworm-slim AS build
65

76
WORKDIR /app
@@ -15,7 +14,7 @@ RUN apt-get update && \
1514

1615
ENV PIXI_FROZEN=true
1716

18-
COPY --parents pixi.toml pixi.lock ${CHANNEL_DIR} /app/
17+
COPY --parents pixi.toml pixi.lock /app/
1918
RUN --mount=type=cache,target=/root/.cache/rattler/cache,sharing=private \
2019
pixi install -e $ENVIRONMENT
2120

scripts/ci/build-and-publish.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ echo "☁️ Uploading to S3..."
3535
echo "------------------------------------------------"
3636
rattler-build upload s3 --force --channel ${CONDA_CHANNEL} ${CHANNEL_DIR}/**/*.conda
3737
rattler-index s3 ${CONDA_CHANNEL}
38+
rattler-index s3 --target-platform osx-arm64 ${CONDA_CHANNEL}
3839

3940
echo "🎉 Done."

0 commit comments

Comments
 (0)