From 2c2c2d3dafd67c927427b7d721dacecc54f44164 Mon Sep 17 00:00:00 2001 From: Xi Zhang Date: Mon, 30 Dec 2024 17:41:37 -0600 Subject: [PATCH] other: Build and test localnet on macos --- .github/workflows/docker-localnet.yml | 49 +++++++++++++++++++++------ 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker-localnet.yml b/.github/workflows/docker-localnet.yml index fcdafeca..f693c13e 100644 --- a/.github/workflows/docker-localnet.yml +++ b/.github/workflows/docker-localnet.yml @@ -12,7 +12,7 @@ jobs: docker: strategy: matrix: - docker_image: [emerald-localnet, sapphire-localnet] + docker_image: [sapphire-localnet] runs-on: ubuntu-latest steps: - name: Checkout code @@ -24,13 +24,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Login to ghcr.io - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Compute version # Version docker image by date and git revision. run: | @@ -52,8 +45,17 @@ jobs: working-directory: docker/${{ matrix.docker_image }} run: ./test.sh + - name: Export + run: docker save ghcr.io/oasisprotocol/${{ matrix.docker_image }}:local --output /tmp/${{ matrix.docker_image }}.tar + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.docker_image }} + path: /tmp/${{ matrix.docker_image }}.tar + - name: Push - if: ${{ github.event_name == 'push' }} + if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' }} uses: docker/build-push-action@v6 with: build-args: | @@ -69,7 +71,7 @@ jobs: org.opencontainers.image.revision=${{ github.sha }} - name: Prune old ghcr.io/oasisprotocol/${{ matrix.docker_image }} images - if: ${{ github.event_name == 'push' }} + if: ${{ github.event_name == 'push' && matrix.os == 'ubuntu-latest' }} uses: vlaurin/action-ghcr-prune@v0.6.0 with: token: ${{ secrets.GITHUB_TOKEN }} @@ -79,3 +81,30 @@ jobs: keep-last: 2 prune-untagged: true prune-tags-regexes: ^latest- + mac: + needs: docker + runs-on: macos-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + # We need history to determine oasis-web3-gateway version from git tag. + fetch-depth: 0 + + - name: Download artifact + uses: actions/upload-artifact@v4 + with: + ## name: ${{ matrix.docker_image }} + name: sapphire-localnet + ## file: /tmp/${{ matrix.docker_image }}.tar + path: /tmp/sapphire-localnet.tar + + - name: Set up Docker + uses: docker/setup-docker-action@v4 + env: + LIMA_START_ARGS: --cpus 4 --memory 8 + + - name: Test + timeout-minutes: 3 + working-directory: docker/sapphire-localnet + run: ./test.sh