Skip to content
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

test: integration tests revamp #645

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3e5d532
ci: run integrations tests on linux
grdsdev Jan 17, 2025
d4391e9
fix linux build
grdsdev Jan 17, 2025
4616bb5
ci: linux tests and cache linux build
grdsdev Jan 17, 2025
33dc5f1
add dotenv
grdsdev Jan 17, 2025
3c01aaa
remove dot-env
grdsdev Jan 17, 2025
5df2f0d
ignore inconsistent error when generating coverage
grdsdev Jan 17, 2025
1b1e252
comment out some ci jobs temporarily
grdsdev Jan 20, 2025
308a275
add integration test for invoke with streamed response
grdsdev Jan 20, 2025
c51a1e0
increase coverage of functions
grdsdev Jan 20, 2025
8d9a304
add tests for Storage
grdsdev Jan 20, 2025
dfc533c
remove integration tests form supabase scheme
grdsdev Jan 20, 2025
2803ef4
mock lib version
grdsdev Jan 20, 2025
fba5a15
test non 2xx code
grdsdev Jan 20, 2025
79a8b9f
omit deprecated code from coverage report
grdsdev Jan 21, 2025
9559a98
omit Deprecated.swift files from coverage
grdsdev Jan 21, 2025
35f3248
improve functions tests
grdsdev Jan 21, 2025
d1784a1
add missing import
grdsdev Jan 21, 2025
c08ba1b
add more test cases for URLQueryRepresentable
grdsdev Jan 21, 2025
cc8431e
add tests for postgrest
grdsdev Jan 21, 2025
6617338
add rpc tests
grdsdev Jan 21, 2025
b67aef8
test execute method and remove old snapshots
grdsdev Jan 21, 2025
3a698c6
extract URLRequest snapshot from library
grdsdev Jan 22, 2025
208a0c2
add more tests for postgrest
grdsdev Jan 22, 2025
974964a
disable cache
grdsdev Jan 22, 2025
6413be6
test(auth): add more auth tests
grdsdev Jan 22, 2025
13969c6
remove mocks on teardown
grdsdev Jan 22, 2025
82784a6
migrate Auth tests to use Mocker
grdsdev Jan 22, 2025
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
193 changes: 95 additions & 98 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,19 @@ jobs:
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: List available devices
run: xcrun simctl list devices available
- name: Cache derived data
uses: actions/cache@v3
with:
path: |
~/.derivedData
key: |
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift') }}
restore-keys: |
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-
# - name: Cache derived data
# uses: actions/cache@v3
# with:
# path: |
# ~/.derivedData
# key: |
# deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift') }}
# restore-keys: |
# deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-
- name: Set IgnoreFileSystemDeviceInodeChanges flag
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
- name: Update mtime for incremental builds
uses: chetan/git-restore-mtime-action@v2
- run: make dot-env
- name: Debug
run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Debug PLATFORM="${{ matrix.platform }}" xcodebuild
- name: Release
Expand All @@ -62,79 +61,77 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: lcov.info


xcodebuild:
name: xcodebuild (15)
runs-on: macos-14
strategy:
matrix:
command: [test, ""]
platform: [IOS, MAC_CATALYST, MACOS, TVOS, VISIONOS, WATCHOS]
xcode: [15.2, 15.4]
exclude:
- { 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: WATCHOS }
include:
- { command: test, skip_release: 1 }
steps:
- uses: actions/checkout@v4
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Install visionOS runtime
if: matrix.platform == 'visionOS'
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
sudo xcodebuild -downloadPlatform visionOS
sudo xcodebuild -runFirstLaunch
- name: List available devices
run: xcrun simctl list devices available
- name: Cache derived data
uses: actions/cache@v3
with:
path: |
~/.derivedData
key: |
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift') }}
restore-keys: |
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-
- name: Set IgnoreFileSystemDeviceInodeChanges flag
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
- name: Update mtime for incremental builds
uses: chetan/git-restore-mtime-action@v2
- run: make dot-env
- name: Debug
run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Debug PLATFORM="${{ matrix.platform }}" xcodebuild
- name: Release
if: matrix.skip_release != '1'
run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Release PLATFORM="${{ matrix.platform }}" xcodebuild

# linux:
# name: linux
# xcodebuild:
# name: xcodebuild (15)
# runs-on: macos-14
# strategy:
# matrix:
# swift-version: ["5.10"]
# runs-on: ubuntu-latest
# command: [test, ""]
# platform: [IOS, MAC_CATALYST, MACOS, TVOS, VISIONOS, WATCHOS]
# xcode: [15.2, 15.4]
# exclude:
# - { 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: WATCHOS }
# include:
# - { command: test, skip_release: 1 }
# steps:
# - uses: actions/checkout@v4
# - uses: swift-actions/setup-swift@v2
# with:
# swift-version: ${{ matrix.swift-version }}
# - name: Cache build
# - name: Select Xcode ${{ matrix.xcode }}
# run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
# - name: Install visionOS runtime
# if: matrix.platform == 'visionOS'
# run: |
# sudo xcodebuild -runFirstLaunch
# sudo xcrun simctl list
# sudo xcodebuild -downloadPlatform visionOS
# sudo xcodebuild -runFirstLaunch
# - name: List available devices
# run: xcrun simctl list devices available
# - name: Cache derived data
# uses: actions/cache@v3
# with:
# path: |
# .build
# ~/.derivedData
# key: |
# build-spm-linux-${{ matrix.swift-version }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift', '**/Package.resolved') }}
# deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift') }}
# restore-keys: |
# deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-
# - name: Set IgnoreFileSystemDeviceInodeChanges flag
# run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
# - name: Update mtime for incremental builds
# uses: chetan/git-restore-mtime-action@v2
# - name: Debug
# run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Debug PLATFORM="${{ matrix.platform }}" xcodebuild
# - name: Release
# if: matrix.skip_release != '1'
# run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Release PLATFORM="${{ matrix.platform }}" xcodebuild

# linux:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: supabase/setup-cli@v1
# - uses: actions/cache@v4
# with:
# path: .build
# key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
# restore-keys: |
# build-spm-linux-${{ matrix.swift-version }}-
# - run: make dot-env
# ${{ runner.os }}-spm-
# - run: supabase start
# working-directory: ./Tests/IntegrationTests
# - name: Run tests
# run: swift test --skip IntegrationTests
# run: swift test
# env:
# SUPABASE_URL: http://localhost:54321
# SUPABASE_ANON_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
# SUPABASE_SERVICE_ROLE_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
# - name: Stop infrastructure
# if: always()
# run: supabase stop
# working-directory: ./Tests/IntegrationTests

# library-evolution:
# name: Library (evolution)
Expand All @@ -146,28 +143,28 @@ jobs:
# - name: Build for library evolution
# run: make build-for-library-evolution

examples:
name: Examples
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- name: Cache derived data
uses: actions/cache@v3
with:
path: ~/.derivedData
key: |
deriveddata-examples-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift', '**/Examples/**/*.swift') }}
restore-keys: |
deriveddata-examples-
- name: Select Xcode 16
run: sudo xcode-select -s /Applications/Xcode_16.0.app
- name: Set IgnoreFileSystemDeviceInodeChanges flag
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
- name: Update mtime for incremental builds
uses: chetan/git-restore-mtime-action@v2
- name: Examples
run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="Examples" XCODEBUILD_ARGUMENT=build xcodebuild
- name: SlackClone
run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="SlackClone" XCODEBUILD_ARGUMENT=build xcodebuild
- name: UserManagement
run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="UserManagement" XCODEBUILD_ARGUMENT=build xcodebuild
# examples:
# name: Examples
# runs-on: macos-15
# steps:
# - uses: actions/checkout@v4
# - name: Cache derived data
# uses: actions/cache@v3
# with:
# path: ~/.derivedData
# key: |
# deriveddata-examples-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift', '**/Examples/**/*.swift') }}
# restore-keys: |
# deriveddata-examples-
# - name: Select Xcode 16
# run: sudo xcode-select -s /Applications/Xcode_16.0.app
# - name: Set IgnoreFileSystemDeviceInodeChanges flag
# run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
# - name: Update mtime for incremental builds
# uses: chetan/git-restore-mtime-action@v2
# - name: Examples
# run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="Examples" XCODEBUILD_ARGUMENT=build xcodebuild
# - name: SlackClone
# run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="SlackClone" XCODEBUILD_ARGUMENT=build xcodebuild
# - name: UserManagement
# run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="UserManagement" XCODEBUILD_ARGUMENT=build xcodebuild
29 changes: 0 additions & 29 deletions .github/workflows/integration-tests.yml

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows_disabled/auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,5 @@ jobs:
- uses: swift-actions/setup-swift@v2
with:
swift-version: ${{ matrix.swift-version }}
- run: make dot-env
- name: Run tests
run: swift test --filter AuthTests.
1 change: 0 additions & 1 deletion .github/workflows_disabled/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ jobs:
- uses: swift-actions/setup-swift@v2
with:
swift-version: ${{ matrix.swift-version }}
- run: make dot-env
- name: Run tests
run: swift test --filter FunctionsTests.
32 changes: 32 additions & 0 deletions .github/workflows_disabled/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Integration Tests

on:
push:
branches:
- main
- release/*
workflow_dispatch:

concurrency:
group: integration-tests-${{ github.ref }}
cancel-in-progress: true

jobs:
integration-tests:
runs-on: ubuntu-latest
name: Integration Tests
steps:
- uses: actions/checkout@v4
- uses: supabase/setup-cli@v1
- run: supabase start
working-directory: ./Tests/IntegrationTests
- name: Run tests
run: swift test --filter IntegrationTests
env:
SUPABASE_URL: http://localhost:54321
SUPABASE_ANON_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
SUPABASE_SERVICE_ROLE_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
- name: Stop infrastructure
if: always()
run: supabase stop
working-directory: ./Tests/IntegrationTests
1 change: 0 additions & 1 deletion .github/workflows_disabled/postgrest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ jobs:
- uses: swift-actions/setup-swift@v2
with:
swift-version: ${{ matrix.swift-version }}
- run: make dot-env
- name: Run tests
run: swift test --filter PostgRESTTests.
1 change: 0 additions & 1 deletion .github/workflows_disabled/realtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ jobs:
- uses: swift-actions/setup-swift@v2
with:
swift-version: ${{ matrix.swift-version }}
- run: make dot-env
- name: Run tests
run: swift test --filter RealtimeTests.
1 change: 0 additions & 1 deletion .github/workflows_disabled/storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ jobs:
- uses: swift-actions/setup-swift@v2
with:
swift-version: ${{ matrix.swift-version }}
- run: make dot-env
- name: Run tests
run: swift test --filter StorageTests.
1 change: 0 additions & 1 deletion .github/workflows_disabled/supabase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ jobs:
- uses: swift-actions/setup-swift@v2
with:
swift-version: ${{ matrix.swift-version }}
- run: make dot-env
- name: Run tests
run: swift test --filter SupabaseTests.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,5 @@ iOSInjectionProject/
# Environment
.env
Secrets.swift
DotEnv.swift
lcov.info
temp_coverage
2 changes: 1 addition & 1 deletion .swiftpm/xcode/xcshareddata/xcschemes/Storage.xcscheme
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
version = "1.7">
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand Down
Loading
Loading