Skip to content

Commit

Permalink
update swift
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp committed Jan 24, 2024
1 parent e0c3f72 commit d7f57dc
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 70 deletions.
8 changes: 4 additions & 4 deletions scripts/ci/actions/restore-artifacts/builddir/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/ci/actions/restore-artifacts/builddir/index.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions scripts/docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ARG CSHARP_VERSION

FROM dart:${DART_VERSION} AS dart-builder
FROM mcr.microsoft.com/dotnet/sdk:${CSHARP_VERSION} AS csharp-builder
FROM golang:${GO_VERSION}-bullseye AS go-builder
FROM golang:${GO_VERSION}-alpine AS go-builder
FROM python:${PYTHON_VERSION}-bullseye AS python-builder
FROM php:${PHP_VERSION}-bullseye AS builder

Expand Down Expand Up @@ -46,9 +46,9 @@ RUN echo "export PATH=$PATH:/usr/local/bin/python" >> ~/.profile \

# Go
COPY --from=go-builder /usr/local/go/ /usr/local/go/
RUN echo "export PATH=$PATH:/usr/local/go/bin:/root/go/bin" >> ~/.profile
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
RUN go install golang.org/x/tools/cmd/goimports@latest
RUN echo "export PATH=$PATH:/usr/local/go/bin:/root/go/bin" >> ~/.profile && source ~/.profile \
&& curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2 \
&& go install golang.org/x/tools/cmd/goimports@latest


# Dart
Expand All @@ -62,7 +62,7 @@ COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
# C#
COPY --from=csharp-builder /usr/share/dotnet /usr/share/dotnet
RUN echo "export PATH=$PATH:/usr/share/dotnet:/root/.dotnet/tools" >> ~/.profile && source ~/.profile \
&& dotnet tool install --global csharpier
&& dotnet tool install --global csharpier

WORKDIR /app

Expand Down
11 changes: 4 additions & 7 deletions scripts/docker/Dockerfile.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
ARG SWIFT_VERSION

FROM ghcr.io/nicklockwood/swiftformat:latest as swiftFormat
FROM swift:${SWIFT_VERSION}-jammy

SHELL ["/bin/bash", "--login", "-c"]
Expand Down Expand Up @@ -26,13 +28,8 @@ RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | b
&& nvm use default \
&& npm install -g yarn


# Swift formatter
ARG SWIFT_VERSION
RUN git clone --depth 1 -b release/${SWIFT_VERSION} https://github.com/apple/swift-format.git /tmp/swift-format \
&& cd /tmp/swift-format && swift build -c release \
&& mv .build/release/swift-format /usr/bin \
&& cd /app && rm -rf /tmp/swift-format
# Swift
COPY --from=swiftFormat /usr/bin/swiftformat /usr/bin/swiftformat

# Autolink repository https://docs.github.com/en/packages/learn-github-packages/connecting-a-repository-to-a-package
LABEL org.opencontainers.image.source=https://github.com/algolia/api-clients-automation
Expand Down
21 changes: 4 additions & 17 deletions scripts/docker/publish.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#! /bin/bash

export NODE_VERSION=$(cat .nvmrc)
eval $(find config -name '.*-version' | xargs -I{} sh -c 'l=$(echo "{}" | sed -e "s/-/_/;s/config\/\.//" | tr "[a-z]" "[A-Z]");echo "export $l=$(cat {})"')
while read line; do
arr=($line)
export $(echo ${arr[1]} | sed -e "s/-/_/;s/config\/\.//" | tr "[a-z]" "[A-Z]")=${arr[0]}
done < <(find config -name '.*-version' -exec jq --raw-input -r '. + " " + input_filename' {} \;)

docker buildx build --push \
--platform linux/amd64 \
Expand All @@ -14,19 +17,3 @@ docker buildx build --push \
--build-arg PYTHON_VERSION \
-t ghcr.io/algolia/apic-base:latest \
-f scripts/docker/Dockerfile.base .

docker buildx build --push \
--platform linux/amd64 \
--build-arg RUBY_VERSION \
--build-arg JAVA_VERSION \
--build-arg NODE_VERSION \
-t ghcr.io/algolia/apic-ruby:latest \
-f scripts/docker/Dockerfile.ruby .

docker buildx build --push \
--platform linux/arm64 \
--build-arg SWIFT_VERSION \
--build-arg JAVA_VERSION \
--build-arg NODE_VERSION \
-t ghcr.io/algolia/apic-swift:latest \
-f scripts/docker/Dockerfile.swift .
2 changes: 1 addition & 1 deletion scripts/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export async function formatter(language: string, cwd: string): Promise<void> {
await run('sbt -Dsbt.server.forcestart=true scalafmtAll scalafmtSbt', { cwd, language });
break;
case 'swift':
await run('swift-format --recursive --in-place .', { cwd, language });
await run('swiftformat .', { cwd, language });
break;
default:
spinner.warn(`no formatter for '${language}'`);
Expand Down
35 changes: 0 additions & 35 deletions tests/output/go/tests/requests/common.go

This file was deleted.

0 comments on commit d7f57dc

Please sign in to comment.