From 1043b3d56736908470b25d64c17822565fd1ea76 Mon Sep 17 00:00:00 2001 From: Vladimir Milosevic Date: Wed, 16 Oct 2024 14:02:53 +0000 Subject: [PATCH] Move to action --- .github/actions/build-image/action.yml | 27 ++++++++++++++++++++++++++ .github/workflows/build-and-test.yml | 14 +++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 .github/actions/build-image/action.yml diff --git a/.github/actions/build-image/action.yml b/.github/actions/build-image/action.yml new file mode 100644 index 000000000..0eb2dbf6d --- /dev/null +++ b/.github/actions/build-image/action.yml @@ -0,0 +1,27 @@ +name: Build Docker +description: Build and Publish Docker Image +runs: + using: 'composite' + steps: + - name: Fix permissions + run: sudo chown ubuntu:ubuntu -R $(pwd) + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Docker images and output the image name + id: build + shell: bash + run: | + # Output the image name + set pipefail + DOCKER_CI_IMAGE=$(.github/build-docker-images.sh | tail -n 1) + echo "DOCKER_CI_IMAGE $DOCKER_CI_IMAGE" + echo "docker-image=$DOCKER_IMAGE" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index cdd81e6aa..20c57c27f 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -8,8 +8,14 @@ on: jobs: build-image: - uses: ./.github/workflows/build-image.yml - + runs-on: + - in-service + - builder + outputs: + docker-image: ${{ steps.build.outputs.docker-image }} + steps: + - uses: .github/actions/build-image + build-ttmlir: needs: build-image timeout-minutes: 120 @@ -28,6 +34,10 @@ jobs: image: ${{ needs.build-image.outputs.docker-image }} steps: + + - run: | + echo "Docker: ${{ needs.build-image.outputs.docker-image }}" + - uses: actions/checkout@v4 with: fetch-depth: 0