|
14 | 14 | - name: Checkout repository |
15 | 15 | uses: actions/checkout@v4 |
16 | 16 |
|
| 17 | + - uses: Swatinem/rust-cache@v2 |
| 18 | + |
| 19 | + - name: Set up Docker Buildx |
| 20 | + uses: docker/setup-buildx-action@v3 |
| 21 | + |
17 | 22 | - name: Build Docker image |
18 | | - run: docker build --build-arg RUST_VERSION=${{ env.RUST_VERSION }} -t glim-test . |
| 23 | + uses: docker/build-push-action@v5 |
| 24 | + with: |
| 25 | + context: . |
| 26 | + push: false |
| 27 | + tags: glim-test |
| 28 | + build-args: | |
| 29 | + RUST_VERSION=${{ env.RUST_VERSION }} |
| 30 | + cache-from: type=gha |
| 31 | + cache-to: type=gha,mode=max |
19 | 32 |
|
20 | 33 | - name: Test image functionality |
21 | 34 | run: | |
@@ -112,15 +125,16 @@ jobs: |
112 | 125 |
|
113 | 126 | # Check image size - capture return code, not output |
114 | 127 | check_image_size "glim-test" "100M" |
| 128 | + RET_CODE=$? |
115 | 129 |
|
116 | 130 | # Handle return code |
117 | | - if [ $? -ge 1 ]; then |
| 131 | + if [ $RET_CODE -eq 1 ]; then |
118 | 132 | echo "::error::Image is too large" |
119 | 133 | exit 1 |
120 | | - elif [ $? -eq 2 ]; then |
121 | | - echo "::warning::Image is within 10% of the limit" |
122 | | - exit 0 # required, otherwise the function call above will provide the exit code '2' |
123 | | - elif [ $? -eq -1 ]; then |
| 134 | + elif [ $RET_CODE -eq -1 ]; then |
124 | 135 | echo "::warning::Image size check failed" |
125 | 136 | exit 1 |
| 137 | + elif [ $RET_CODE -eq 2 ]; then |
| 138 | + echo "::warning::Image is within 10% of the limit" |
| 139 | + exit 0 |
126 | 140 | fi |
0 commit comments