Skip to content

Commit

Permalink
CI update (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
gwynne authored Feb 19, 2023
1 parent f2e5d5c commit 394d957
Showing 1 changed file with 44 additions and 54 deletions.
98 changes: 44 additions & 54 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,54 @@
name: test
on: { pull_request: {}, push: { branches: [master, main] } }
on:
pull_request: { branches: ['*'] }
push: { branches: ['main'] }

env:
LOG_LEVEL: debug
SWIFT_DETERMINISTIC_HASHING: 1
REDIS_HOSTNAME: redis
REDIS_PORT: 6379
REDIS_HOSTNAME_2: redis-2
REDIS_PORT_2: 6379

jobs:
getcidata:
api-breakage:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
outputs:
environments: ${{ steps.output.outputs.environments }}
container: swift:5.7-jammy
steps:
- id: output
run: |
envblob="$(curl -fsSL https://raw.githubusercontent.com/vapor/ci/main/pr-environments.json | jq -cMj '.')"
echo "::set-output name=environments::${envblob}"
test-redis:
needs: getcidata
- name: Check out package
uses: actions/checkout@v3
with:
fetch-depth: 0
# https://github.com/actions/checkout/issues/766
- name: Mark the workspace as safe
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Check for API breaking changes
run: swift package diagnose-api-breaking-changes origin/main

linux-unit:
strategy:
fail-fast: false
matrix:
env: ${{ fromJSON(needs.getcidata.outputs.environments) }}
runs-on: ${{ matrix.env.os }}
container: ${{ matrix.env.image }}
steps:
- name: Select toolchain
uses: maxim-lobanov/setup-xcode@v1.2.1
with:
xcode-version: ${{ matrix.env.toolchain }}
if: ${{ matrix.env.toolchain != '' }}
- name: Check out source code
uses: actions/checkout@v2

- name: Install Redis via Homebrew (Mac)
if: ${{ startsWith(matrix.env.os, 'macos') }}
run: brew install redis

- name: Install Redis via apt-get (Ubuntu)
if: ${{ startsWith(matrix.env.os, 'ubuntu') }}
run: apt-get update && apt-get install -y redis

- name: Install Redis via ??? (Windows)
if: ${{ startsWith(matrix.env.os, 'windows') }}
run: echo NOT IMPLEMENTED; exit 1

- name: Start Redis 1
run: redis-server .github/redis1.conf
- name: Start Redis 2
run: redis-server .github/redis2.conf

- name: Test Redis 1 connection
run: redis-cli -u redis://localhost:6379/0 INFO
- name: Test Redis 2 connection
run: redis-cli -u redis://localhost:6380/0 INFO

- name: Run 'RedisTests' tests with Thread Sanitizer
timeout-minutes: 20
run: swift test --enable-test-discovery --sanitize=thread --filter RedisTests

- name: Run 'MultipleRedisTests' tests with Thread Sanitizer
timeout-minutes: 20
run: swift test --enable-test-discovery --sanitize=thread --filter MultipleRedisTests
container:
- swift:5.5-bionic
- swift:5.6-focal
- swift:5.7-jammy
container: ${{ matrix.container }}
services:
redis:
image: redis:6
redis-2:
image: redis:6
runs-on: ubuntu-latest
steps:
- name: Check out package
uses: actions/checkout@v3
- name: Run unit tests with Thread Sanitizer
run: swift test --sanitize=thread

# TODO: Use reusable workflow

test-exports:
name: Test exports
Expand All @@ -69,4 +59,4 @@ jobs:
with:
fetch-depth: 0
- name: Build
run: swift build -Xswiftc -DBUILDING_DOCC
run: swift build -Xswiftc -DBUILDING_DOCC

0 comments on commit 394d957

Please sign in to comment.