From c45e4d8981a3b37d365b6d8d68da6a399197b154 Mon Sep 17 00:00:00 2001 From: mtgto Date: Sat, 9 Mar 2024 08:20:37 +0900 Subject: [PATCH] Add swift-format 5.10 --- .github/workflows/build.yml | 12 ++++++------ Dockerfile | 4 ++-- Dockerfile.5.9 | 11 +++++++++++ README.md | 6 +++--- 4 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 Dockerfile.5.9 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6ea8d6f..ec81225 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,24 +13,24 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: context: . push: true - tags: mtgto/swift-format:5.9 + tags: mtgto/swift-format:latest,mtgto/swift-format:5.10 platforms: linux/amd64,linux/arm64/v8 diff --git a/Dockerfile b/Dockerfile index f4ea2ba..0b2e259 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ -FROM --platform=$BUILDPLATFORM swift:5.9-jammy +FROM --platform=$BUILDPLATFORM swift:5.10-jammy WORKDIR /swift-format RUN env DEBIAN_FRONTEND=noninteractive apt-get update RUN env DEBIAN_FRONTEND=noninteractive apt-get install wget -RUN wget --quiet --output-document=- https://github.com/apple/swift-format/archive/509.0.0.tar.gz | tar zxf - --strip-components 1 +RUN wget --quiet --output-document=- https://github.com/apple/swift-format/archive/swift-5.10-RELEASE.tar.gz | tar zxf - --strip-components 1 RUN swift build --product swift-format --configuration release -Xswiftc -static-stdlib FROM --platform=$BUILDPLATFORM ubuntu:jammy diff --git a/Dockerfile.5.9 b/Dockerfile.5.9 new file mode 100644 index 0000000..f4ea2ba --- /dev/null +++ b/Dockerfile.5.9 @@ -0,0 +1,11 @@ +FROM --platform=$BUILDPLATFORM swift:5.9-jammy + +WORKDIR /swift-format +RUN env DEBIAN_FRONTEND=noninteractive apt-get update +RUN env DEBIAN_FRONTEND=noninteractive apt-get install wget +RUN wget --quiet --output-document=- https://github.com/apple/swift-format/archive/509.0.0.tar.gz | tar zxf - --strip-components 1 +RUN swift build --product swift-format --configuration release -Xswiftc -static-stdlib + +FROM --platform=$BUILDPLATFORM ubuntu:jammy +COPY --from=0 /swift-format/.build/*/release/swift-format /usr/bin +ENTRYPOINT ["/usr/bin/swift-format"] diff --git a/README.md b/README.md index 2c690da..495e6de 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,13 @@ Unofficial docker image of [apple/swift-format](https://github.com/apple/swift-f ### Lint ```console -$ docker run --rm --workdir=/work --volume=$PWD:/work mtgto/swift-format:5.9 lint --recursive . +$ docker run --rm --workdir=/work --volume=$PWD:/work mtgto/swift-format:5.10 lint --recursive . ``` ### Format ```console -$ docker run --rm --workdir=/work --volume=$PWD:/work mtgto/swift-format:5.9 format --in-place --recursive . +$ docker run --rm --workdir=/work --volume=$PWD:/work mtgto/swift-format:5.10 format --in-place --recursive . ``` ## Development @@ -23,5 +23,5 @@ $ docker run --rm --workdir=/work --volume=$PWD:/work mtgto/swift-format:5.9 for ### Build & Push ```console -docker buildx build --platform linux/arm64/v8,linux/amd64 -t mtgto/swift-format:latest -t mtgto/swift-format:5.9 --push . +docker buildx build --platform linux/arm64/v8,linux/amd64 -t mtgto/swift-format:latest -t mtgto/swift-format:5.10 --push . ```