From 68057aaa388a3fb7bfaa81b718c2186cfe74d449 Mon Sep 17 00:00:00 2001 From: John Cairns Date: Fri, 9 Feb 2024 09:47:44 -0600 Subject: [PATCH] 58: introducing yamlfmt --- .github/workflows/ci-image.yml | 12 +++--------- .github/workflows/ghcr-image.yml | 26 +++++++------------------- .github/workflows/prod-ci-image.yml | 14 ++++---------- Dockerfile | 2 ++ 4 files changed, 16 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci-image.yml b/.github/workflows/ci-image.yml index 3f6f419..70a1f00 100644 --- a/.github/workflows/ci-image.yml +++ b/.github/workflows/ci-image.yml @@ -1,5 +1,4 @@ name: Build Dev Image CI - on: workflow_dispatch: pull_request: @@ -8,19 +7,15 @@ on: push: branches: - "*" - jobs: build: runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - - - name: Set up QEMU + - name: Set up QEMU uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Build CI uses: docker/build-push-action@v3 @@ -31,4 +26,3 @@ jobs: build-args: | VERSION=latest CARGO_INCREMENTAL=0 - diff --git a/.github/workflows/ghcr-image.yml b/.github/workflows/ghcr-image.yml index 92d05d3..a5e8322 100644 --- a/.github/workflows/ghcr-image.yml +++ b/.github/workflows/ghcr-image.yml @@ -1,56 +1,44 @@ name: Docker Image Build Push - on: push: tags: - "*" - concurrency: group: "docker-image" cancel-in-progress: true - jobs: build: runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - - - name: Set up QEMU + - name: Set up QEMU uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Generate repository name run: | echo "REPOSITORY_PATH=$( echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]' )" >> ${GITHUB_ENV} echo "REPOSITORY_SHA=$( echo ${GITHUB_SHA} | cut -c 1-8 )" >> ${GITHUB_ENV} - - - name: Login to GitHub Container Registry + - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and Push + - name: Build and Push uses: docker/build-push-action@v3 with: context: . file: ./prod/Dockerfile platforms: linux/amd64,linux/arm64 push: true - build-args: | - VERSION=${{ github.ref_name }} - CARGO_INCREMENTAL=0 + build-args: "VERSION=${{ github.ref_name }}\nCARGO_INCREMENTAL=0 \n" tags: | ghcr.io/${{ env.REPOSITORY_PATH }}:v${{ github.ref_name }} ghcr.io/${{ env.REPOSITORY_PATH }}:${{ env.REPOSITORY_SHA }} ghcr.io/${{ env.REPOSITORY_PATH }}:latest - - - name: GitHub Release + - name: GitHub Release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/prod-ci-image.yml b/.github/workflows/prod-ci-image.yml index 16027cb..d3b2d4a 100644 --- a/.github/workflows/prod-ci-image.yml +++ b/.github/workflows/prod-ci-image.yml @@ -1,5 +1,4 @@ name: Build Prod Image CI - on: workflow_dispatch: pull_request: @@ -8,28 +7,23 @@ on: push: branches: - "*" - jobs: build: runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - - - name: Set up QEMU + - name: Set up QEMU uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Build Prod Image CI uses: docker/build-push-action@v3 with: context: . - file: prod/Dockerfile + file: prod/Dockerfile platforms: linux/amd64 push: false build-args: | VERSION=latest CARGO_INCREMENTAL=0 - diff --git a/Dockerfile b/Dockerfile index dcc012b..d202c15 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,8 @@ COPY --chown=xmtp:xmtp . . ENV PATH=~${USER}/.cargo/bin:$PATH ENV USER=xmtp +RUN yamlfmt -lint .github/workflows/*.yml + ENV CARGO_INCREMENTAL=${CARGO_INCREMENTAL:-1} RUN cargo check RUN cargo fmt --check