Skip to content

Commit

Permalink
Add swift-format 5.10
Browse files Browse the repository at this point in the history
  • Loading branch information
mtgto committed Mar 8, 2024
1 parent 094cc46 commit c45e4d8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 11 additions & 0 deletions Dockerfile.5.9
Original file line number Diff line number Diff line change
@@ -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"]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ 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

### 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 .
```

0 comments on commit c45e4d8

Please sign in to comment.