Skip to content

Commit a6bf30f

Browse files
revert changes, add cache
1 parent 6395c9f commit a6bf30f

File tree

3 files changed

+25
-56
lines changed

3 files changed

+25
-56
lines changed

.github/workflows/preview-branches-publish-images.yml

+23-54
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- service: api
2424
runner: ubuntu-latest-8-cores
2525
- service: client
26-
runner: blacksmith-32vcpu-ubuntu-2204
26+
runner: ubuntu-latest-64-cores
2727
- service: connection
2828
runner: ubuntu-latest-8-cores
2929
- service: files
@@ -47,81 +47,50 @@ jobs:
4747
with:
4848
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_DEVELOPMENT }}
4949
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEVELOPMENT }}
50-
aws-region: us-east-1
50+
aws-region: ${{ secrets.AWS_REGION }}
5151

52-
- name: Login to Amazon ECR Public
52+
- name: Login to Amazon ECR Private
5353
id: login-ecr
5454
uses: aws-actions/amazon-ecr-login@v2
55-
with:
56-
registry-type: public
5755

5856
- name: Define repository name
5957
id: repo-name
6058
run: |
6159
echo "REPO_NAME=quadratic-${{ matrix.service }}-development" >> $GITHUB_OUTPUT
6260
63-
- name: Create Public ECR Repository if not exists
61+
- name: Create Private ECR Repository if not exists
6462
id: create-ecr
6563
env:
6664
REPO_NAME: ${{ steps.repo-name.outputs.REPO_NAME }}
6765
run: |
6866
# Try to describe the repository first
69-
if ! aws ecr-public describe-repositories --repository-names $REPO_NAME 2>/dev/null; then
67+
if ! aws ecr describe-repositories --repository-names $REPO_NAME 2>/dev/null; then
7068
# Repository doesn't exist, create it
71-
aws ecr-public create-repository --repository-name $REPO_NAME
69+
aws ecr create-repository --repository-name $REPO_NAME || true
7270
fi
7371
7472
# Get the repository URI either way
75-
REPO_INFO=$(aws ecr-public describe-repositories --repository-names $REPO_NAME)
73+
REPO_INFO=$(aws ecr describe-repositories --repository-names $REPO_NAME)
7674
ECR_URL=$(echo $REPO_INFO | jq -r '.repositories[0].repositoryUri')
7775
echo "ECR_URL=$ECR_URL" >> $GITHUB_OUTPUT
7876
79-
# - name: Set up Docker Buildx
80-
# uses: docker/setup-buildx-action@v3
81-
# with:
82-
# buildkitd-flags: --debug
83-
84-
# - name: Cache Docker layers
85-
# uses: actions/cache@v3
86-
# with:
87-
# path: /tmp/.buildx-cache
88-
# key: ${{ runner.os }}-buildx-${{ matrix.service }}-${{ github.sha }}
89-
# restore-keys: |
90-
# ${{ runner.os }}-buildx-${{ matrix.service }}-
91-
# ${{ runner.os }}-buildx-
92-
93-
# - name: Create and initialize buildx cache
94-
# run: |
95-
# mkdir -p /tmp/.buildx-cache
96-
# CACHE_TAG="${{ runner.os }}-buildx-${{ matrix.service }}"
97-
# echo "{\"layers\":{},\"manifests\":{\"$CACHE_TAG\":{\"layers\":[]}}}" > /tmp/.buildx-cache/index.json
98-
99-
# - name: Build, Tag, and Push Image to Amazon ECR Private
100-
# env:
101-
# ECR_URL: ${{ steps.create-ecr.outputs.ECR_URL }}
102-
# run: |
103-
# docker buildx build \
104-
# --cache-from=type=local,src=/tmp/.buildx-cache \
105-
# --cache-to=type=local,dest=/tmp/.buildx-cache-new \
106-
# --build-arg BUILD_TIME="${{ steps.build-metadata.outputs.BUILD_TIME }}" \
107-
# --build-arg GIT_SHA="${{ github.sha }}" \
108-
# --build-arg PR_NUMBER="${{ github.event.pull_request.number }}" \
109-
# --label "org.opencontainers.image.created=${{ steps.build-metadata.outputs.BUILD_TIME }}" \
110-
# --label "org.opencontainers.image.revision=${{ github.sha }}" \
111-
# --push \
112-
# -t $ECR_URL:pr-${{ github.event.pull_request.number }} \
113-
# -t $ECR_URL:${{ steps.build-metadata.outputs.BRANCH_NAME }} \
114-
# -t $ECR_URL:${{ steps.build-metadata.outputs.GIT_SHA_SHORT }} \
115-
# -f quadratic-${{ matrix.service }}/Dockerfile .
116-
117-
# - name: Move cache
118-
# run: |
119-
# rm -rf /tmp/.buildx-cache
120-
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache
77+
- name: Set up Docker Buildx
78+
uses: docker/setup-buildx-action@v3
79+
with:
80+
buildkitd-flags: --debug
12181

122-
- name: Build, Tag, and Push Image to Amazon ECR Public
82+
- name: Build, Tag, and Push Image to Amazon ECR Private
12383
env:
12484
ECR_URL: ${{ steps.create-ecr.outputs.ECR_URL }}
12585
run: |
126-
docker build -t $ECR_URL:pr-${{ github.event.pull_request.number }} -f quadratic-${{ matrix.service }}/Dockerfile .
127-
docker push $ECR_URL:pr-${{ github.event.pull_request.number }}
86+
docker buildx build \
87+
--cache-from=type=registry,ref=$ECR_URL:buildcache \
88+
--cache-to=type=registry,ref=$ECR_URL:buildcache,mode=max \
89+
--build-arg BUILD_TIME="${{ steps.build-metadata.outputs.BUILD_TIME }}" \
90+
--build-arg GIT_SHA="${{ github.sha }}" \
91+
--build-arg PR_NUMBER="${{ github.event.pull_request.number }}" \
92+
--label "org.opencontainers.image.created=${{ steps.build-metadata.outputs.BUILD_TIME }}" \
93+
--label "org.opencontainers.image.revision=${{ github.sha }}" \
94+
--push \
95+
-t $ECR_URL:pr-${{ github.event.pull_request.number }} \
96+
-f quadratic-${{ matrix.service }}/Dockerfile .

quadratic-core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"start": "cargo watch -s 'wasm-pack build --dev --target web --out-dir ../quadratic-client/src/app/quadratic-core --weak-refs'",
77
"performance": "cargo watch -s 'wasm-pack build --target web --out-dir ../quadratic-client/src/app/quadratic-core --weak-refs'",
8-
"build": "wasm-pack build --release --target web --out-dir ../quadratic-client/src/app/quadratic-core",
8+
"build": "wasm-pack build --dev --target web --out-dir ../quadratic-client/src/app/quadratic-core --weak-refs",
99
"coverage": "npm run coverage:clean && npm run coverage:wasm:gen && npm run coverage:wasm:html && npm run coverage:wasm:view",
1010
"coverage:wasm:gen": "CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='coverage/cargo-test-%p-%m.profraw' cargo test",
1111
"coverage:wasm:html": "grcov . --binary-path ../target/debug/deps/ -s src -t html --branch --ignore-not-existing --ignore 'src/wasm_bindings/*' --ignore 'src/bin/*' --ignore '../*' --ignore '/*' -o coverage/html",

quadratic-rust-client/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "quadratic-rust-client",
33
"private": true,
44
"scripts": {
5-
"build": "wasm-pack build --release --target web --out-dir ../quadratic-client/src/app/quadratic-rust-client",
5+
"build": "wasm-pack build --target web --out-dir ../quadratic-client/src/app/quadratic-rust-client --weak-refs",
66
"dev": "cargo watch -s 'wasm-pack build --dev --target web --out-dir ../quadratic-client/src/app/quadratic-rust-client --weak-refs'",
77
"dev:perf": "cargo watch -s 'wasm-pack build --target web --out-dir ../quadratic-client/src/app/quadratic-rust-client --weak-refs'"
88
}

0 commit comments

Comments
 (0)