Skip to content

Commit

Permalink
Checkout specific webR git commit in Docker CI
Browse files Browse the repository at this point in the history
  • Loading branch information
georgestagg committed Mar 13, 2024
1 parent ff0ab78 commit 1a6ee7f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,20 @@ jobs:
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
- name: Short commit SHA
id: short
run: |
SHA="${{github.event.pull_request.head.sha}}${{ github.sha }}"
SHORT_SHA=${SHA:0:7}
echo "sha: $SHORT_SHA"
echo "sha=$SHORT_SHA" >> $GITHUB_OUTPUT
- name: Build and publish Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args:
- WEBRCI_SHA=${{ steps.short.outputs.sha }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-nix:
Expand Down
32 changes: 17 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ARG BASE=ghcr.io/r-wasm/flang-wasm:main
ARG WEBRCI_SHA=HEAD
FROM $BASE as webr

# Setup environment for Emscripten
Expand All @@ -15,13 +16,13 @@ ENV EMFC="/opt/flang/host/bin/flang-new"
FROM webr as deb_build
RUN mkdir /opt/fake_rust/ && \
apt-get update && \
apt-get install -y equivs lsb-release &&\
equivs-control fake_rust && \
sed -i 's/Package:.*/Package: rustc/' fake_rust && \
sed -i 's/# Version:.*/Version: 99.0/' fake_rust && \
equivs-build fake_rust && \
sed -i 's/Package:.*/Package: cargo/' fake_rust && \
equivs-build fake_rust && \
apt-get install -y equivs lsb-release &&\
equivs-control fake_rust && \
sed -i 's/Package:.*/Package: rustc/' fake_rust && \
sed -i 's/# Version:.*/Version: 99.0/' fake_rust && \
equivs-build fake_rust && \
sed -i 's/Package:.*/Package: cargo/' fake_rust && \
equivs-build fake_rust && \
mv rustc_99.0_all.deb cargo_99.0_all.deb /opt/fake_rust/

# Step 2: Do the necessary setups
Expand All @@ -31,7 +32,7 @@ RUN mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | \
gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] \
https://deb.nodesource.com/node_18.x nodistro main" | \
https://deb.nodesource.com/node_18.x nodistro main" | \
tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update && \
apt-get install nodejs -y
Expand All @@ -46,12 +47,12 @@ RUN set -eux; \
echo "0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db *rustup-init" | sha256sum -c -; \
chmod +x rustup-init; \
./rustup-init -y \
--no-modify-path \
--profile minimal \
--default-toolchain nightly \
--default-host x86_64-unknown-linux-gnu \
--target wasm32-unknown-emscripten \
--component rust-src; \
--no-modify-path \
--profile minimal \
--default-toolchain nightly \
--default-host x86_64-unknown-linux-gnu \
--target wasm32-unknown-emscripten \
--component rust-src; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
Expand All @@ -75,7 +76,8 @@ ENV R_LIBS_USER=/opt/R/current/lib/R/site-library
RUN rig add 4.3.2

# Download webR and configure for LLVM flang
RUN git clone --depth=1 https://github.com/r-wasm/webr.git /opt/webr
RUN git clone https://github.com/r-wasm/webr.git /opt/webr
RUN git checkout ${WEBRCI_SHA}
WORKDIR /opt/webr
RUN ./configure

Expand Down

0 comments on commit 1a6ee7f

Please sign in to comment.