Skip to content

test(helpers): add comprehensive tests for HTTPError #737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 24 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- { xcode: 15.2, command: test }
- { xcode: 15.2, platform: MAC_CATALYST }
- { xcode: 15.2, platform: TVOS }
- { xcode: 15.2, platform: VISIONOS }
#- { xcode: 15.2, platform: VISIONOS }
- { xcode: 15.2, platform: WATCHOS }
- { command: test, platform: WATCHOS }
include:
Expand Down Expand Up @@ -104,55 +104,40 @@ jobs:
if: matrix.skip_release != '1'
run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Release PLATFORM="${{ matrix.platform }}" xcodebuild

linux_android:
name: Linux and Android
runs-on: ubuntu-24.04
linux:
name: Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Remove IntegrationTests"
run: rm -r Tests/IntegrationTests/*
- name: "Build Swift Package on Linux"
- name: "Build Swift Package"
run: swift build
- name: "Test Swift Package on Android"

android:
name: Android
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Remove IntegrationTests"
run: rm -r Tests/IntegrationTests/*
- name: "Test Swift Package"
uses: skiptools/swift-android-action@v2
with:
# need to copy over the Tests folder because it contains __Snapshots__
copy-files: Tests
# tests are not yet passing on Android
run-tests: false

# linux:
# name: linux
# strategy:
# matrix:
# swift-version: ["5.10"]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: swift-actions/setup-swift@v2
# with:
# swift-version: ${{ matrix.swift-version }}
# - name: Cache build
# uses: actions/cache@v3
# with:
# path: |
# .build
# key: |
# build-spm-linux-${{ matrix.swift-version }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift', '**/Package.resolved') }}
# restore-keys: |
# build-spm-linux-${{ matrix.swift-version }}-
# - name: Run tests
# run: swift test --skip IntegrationTests

# library-evolution:
# name: Library (evolution)
# runs-on: macos-14
# steps:
# - uses: actions/checkout@v4
# - name: Select Xcode 15.4
# run: sudo xcode-select -s /Applications/Xcode_15.4.app
# - name: Build for library evolution
# run: make build-for-library-evolution
library-evolution:
name: Library (evolution)
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Select Xcode 15.4
run: sudo xcode-select -s /Applications/Xcode_15.4.app
- name: Build for library evolution
run: make build-for-library-evolution

examples:
name: Examples
Expand Down Expand Up @@ -186,4 +171,4 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Test docs
run: make test-docs
run: make test-docs
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,5 @@ iOSInjectionProject/
Secrets.swift
lcov.info
temp_coverage

.cursor
15 changes: 0 additions & 15 deletions Dockerfile

This file was deleted.

45 changes: 20 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,tvOS,TV)
PLATFORM_VISIONOS = visionOS Simulator,id=$(call udid_for,visionOS,Vision)
PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,watchOS,Watch)


PLATFORM = IOS
DESTINATION = platform="$(PLATFORM_$(PLATFORM))"

PLATFORM_ID = $(shell echo "$(DESTINATION)" | sed -E "s/.+,id=(.+)/\1/")

SCHEME = Supabase

WORKSPACE = Supabase.xcworkspace
Expand All @@ -26,19 +27,25 @@ XCODEBUILD_FLAGS = \
-destination $(DESTINATION) \
-scheme "$(SCHEME)" \
-skipMacroValidation \
-workspace $(WORKSPACE) \
-workspace $(WORKSPACE)

XCODEBUILD_COMMAND = xcodebuild $(XCODEBUILD_ARGUMENT) $(XCODEBUILD_FLAGS)

ifneq ($(strip $(shell which xcbeautify)),)
XCODEBUILD = set -o pipefail && $(XCODEBUILD_COMMAND) | xcbeautify --quiet
XCODEBUILD = set -o pipefail && $(XCODEBUILD_COMMAND) | xcbeautify
else
XCODEBUILD = $(XCODEBUILD_COMMAND)
endif

TEST_RUNNER_CI = $(CI)

xcodebuild:
warm-simulator:
@test "$(PLATFORM_ID)" != "" \
&& xcrun simctl boot $(PLATFORM_ID) \
&& open -a Simulator --args -CurrentDeviceUDID $(PLATFORM_ID) \
|| exit 0

xcodebuild: warm-simulator
$(XCODEBUILD)

test-integration:
Expand All @@ -48,6 +55,7 @@ test-integration:

build-for-library-evolution:
swift build \
-q \
-c release \
--target Supabase \
-Xswiftc -emit-module-interface \
Expand All @@ -67,31 +75,18 @@ test-docs:
&& exit 1)

format:
@swift format -i -r --ignore-unparsable-files .


test-linux:
docker run \
--rm \
-v "$(PWD):$(PWD)" \
-w "$(PWD)" \
swift:5.10 \
bash -c 'swift test -c $(CONFIG)'

build-linux:
docker run \
--rm \
-v "$(PWD):$(PWD)" \
-w "$(PWD)" \
swift:5.9 \
bash -c 'swift build -c $(CONFIG)'
find . \
-path '*/Documentation/docc' -prune -o \
-name '*.swift' \
-not -path '*/.*' -print0 \
| xargs -0 xcrun swift-format --ignore-unparsable-files --in-place

.PHONY: build-for-library-evolution format xcodebuild test-docs test-integration
.PHONY: build-for-library-evolution format warm-simulator xcodebuild test-docs test-integration

.PHONY: coverage
coverage:
@DERIVED_DATA_PATH=$(DERIVED_DATA_PATH) ./scripts/generate-coverage.sh

define udid_for
$(shell xcrun simctl list devices available '$(1)' | grep '$(2)' | sort -r | head -1 | awk -F '[()]' '{ print $$(NF-3) }')
endef
$(shell xcrun simctl list --json devices available '$(1)' | jq -r '[.devices|to_entries|sort_by(.key)|reverse|.[].value|select(length > 0)|.[0]][0].udid')
endef
Loading
Loading