|
1 |
| -name: test |
2 |
| -on: |
3 |
| -- pull_request |
| 1 | +name: Test Matrix |
| 2 | +on: ['pull_request'] |
| 3 | +defaults: |
| 4 | + run: |
| 5 | + shell: bash |
4 | 6 | jobs:
|
5 |
| - fluent-postgres-driver_macos: |
| 7 | + PR-tests-linux: |
6 | 8 | strategy:
|
7 | 9 | fail-fast: false
|
8 | 10 | matrix:
|
9 |
| - psql: ['postgresql@11', 'postgresql@12'] |
| 11 | + dbimage: ['postgres:11', 'postgres:12'] |
| 12 | + runner: [ |
| 13 | + 'swift:5.2-xenial', 'swift:5.2-bionic', |
| 14 | + 'swiftlang/swift:nightly-5.2-xenial', 'swiftlang/swift:nightly-5.2-bionic', |
| 15 | + 'swiftlang/swift:nightly-5.3-xenial', 'swiftlang/swift:nightly-5.3-bionic', |
| 16 | + 'swiftlang/swift:nightly-master-xenial', 'swiftlang/swift:nightly-master-bionic', |
| 17 | + 'swiftlang/swift:nightly-master-focal', |
| 18 | + 'swiftlang/swift:nightly-master-centos8', |
| 19 | + 'swiftlang/swift:nightly-master-amazonlinux2' |
| 20 | + ] |
10 | 21 | include:
|
11 |
| - # The PostgreSQL formulas don't use a consistent data dir |
12 |
| - - psql: 'postgresql@11' |
13 |
| - dbroot: '/usr/local/var/postgresql@11' |
14 |
| - - psql: 'postgresql@12' |
15 |
| - dbroot: '/usr/local/var/postgres' |
16 |
| - runs-on: macos-latest |
| 22 | + - installcmd: 'apt-get -q update && apt-get -q install -y postgresql-client' |
| 23 | + - { 'runner': 'swiftlang/swift:nightly-master-centos8', 'installcmd': 'dnf install -y zlib-devel postgresql' } |
| 24 | + - { 'runner': 'swiftlang/swift:nightly-master-amazonlinux2', 'installcmd': 'yum install -y zlib-devel postgresql' } |
| 25 | + container: ${{ matrix.runner }} |
| 26 | + runs-on: ubuntu-latest |
| 27 | + services: |
| 28 | + postgres: |
| 29 | + image: ${{ matrix.dbimage }} |
| 30 | + env: { POSTGRES_USER: vapor_username, POSTGRES_PASSWORD: vapor_password, POSTGRES_DB: vapor_database } |
| 31 | + env: { 'PGPASSWORD': 'vapor_password' } |
17 | 32 | steps:
|
18 |
| - - run: sudo xcode-select -s /Applications/Xcode_11.4.app/Contents/Developer |
19 |
| - - run: brew uninstall --force libpq postgresql@11 postgresql@12 php |
20 |
| - - run: brew install ${{ matrix.psql }} |
21 |
| - - run: brew link --force ${{ matrix.psql }} |
22 |
| - - run: bash -c '[[ -d "${{ matrix.dbroot }}" ]] && mv "${{ matrix.dbroot }}" /usr/local/var/.outta-the-way || true' |
23 |
| - - run: mkdir -p /usr/local/var/log "${{ matrix.dbroot }}" |
24 |
| - - run: initdb --locale=C -E UTF-8 "${{ matrix.dbroot }}" |
25 |
| - - run: brew services start ${{ matrix.psql }} |
26 |
| - - run: sleep 4 # give the server a chance to settle |
27 |
| - - run: createuser -d -l -s vapor_username |
28 |
| - - run: createdb -O vapor_username vapor_database |
29 |
| - - uses: actions/checkout@v2 |
30 |
| - - run: swift test --enable-test-discovery --sanitize=thread |
31 |
| - - run: brew services stop ${{ matrix.psql }} |
32 |
| - fluent-postgres-driver_ubuntu: |
| 33 | + - name: Install dependencies |
| 34 | + run: ${{ matrix.installcmd }} |
| 35 | + - name: Wait for Postgres server to be ready |
| 36 | + run: until echo | psql -hpostgres -Uvapor_username vapor_database; do sleep 1; done |
| 37 | + timeout-minutes: 5 |
| 38 | + - name: Set up Postgres databases and privileges |
| 39 | + run: | |
| 40 | + for db in vapor_migration_extra; do createdb -hpostgres -Uvapor_username -Ovapor_username $db; done |
| 41 | + - name: Check out code |
| 42 | + uses: actions/checkout@v2 |
| 43 | + - name: Run tests with Thread Sanitizer |
| 44 | + run: swift test --enable-test-discovery --sanitize=thread |
| 45 | + env: { 'POSTGRES_HOSTNAME': 'postgres' } |
| 46 | + PR-tests-macos: |
33 | 47 | strategy:
|
34 | 48 | fail-fast: false
|
35 | 49 | matrix:
|
36 |
| - psql: ['11', '11-alpine', '12', '12-alpine'] |
37 |
| - base: ['xenial', 'bionic'] |
38 |
| - container: |
39 |
| - image: vapor/swift:5.2-${{ matrix.base }}-ci |
40 |
| - services: |
41 |
| - psql: |
42 |
| - image: postgres:${{ matrix.psql }} |
43 |
| - ports: |
44 |
| - - 5432:5432 |
45 |
| - env: |
46 |
| - POSTGRES_USER: vapor_username |
47 |
| - POSTGRES_DB: vapor_database |
48 |
| - POSTGRES_PASSWORD: vapor_password |
49 |
| - runs-on: ubuntu-latest |
| 50 | + include: |
| 51 | + - {'formula': 'postgresql@11', 'datadir': 'postgresql@11'} |
| 52 | + - {'formula': 'postgresql@12', 'datadir': 'postgres'} |
| 53 | + runs-on: macos-latest |
| 54 | + env: { 'PGPASSWORD': 'vapor_password' } |
50 | 55 | steps:
|
51 |
| - - uses: actions/checkout@v2 |
52 |
| - - run: swift test --enable-test-discovery --sanitize=thread |
53 |
| - env: |
54 |
| - POSTGRES_HOSTNAME: psql |
| 56 | + - name: Select latest available Xcode |
| 57 | + uses: maxim-lobanov/[email protected] |
| 58 | + with: { 'xcode-version': 'latest' } |
| 59 | + - name: Blow away the default Postgres installation |
| 60 | + run: brew uninstall --force postgresql php && rm -rf /usr/local/{etc,var}/{postgres,pg}* |
| 61 | + - name: Install Postgres server from Homebrew |
| 62 | + run: brew install ${{ matrix.formula }} && brew link --force ${{ matrix.formula }} |
| 63 | + - name: Make sure Postgres has a database, Homebrew fails REALLY bad at this |
| 64 | + run: initdb --locale=C -E UTF-8 $(brew --prefix)/var/${{ matrix.datadir }} |
| 65 | + - name: Start Postgres server |
| 66 | + run: brew services start ${{ matrix.formula }} |
| 67 | + - name: Wait for Postgres server to be ready |
| 68 | + run: until echo | psql postgres; do sleep 1; done |
| 69 | + timeout-minutes: 5 |
| 70 | + - name: Set up Postgres databases and privileges |
| 71 | + run: | |
| 72 | + createuser --createdb --login vapor_username |
| 73 | + for db in vapor_{database,migration_extra}; do |
| 74 | + createdb -Ovapor_username $db && psql $db <<<"ALTER SCHEMA public OWNER TO vapor_username;" |
| 75 | + done |
| 76 | + - name: Check out code |
| 77 | + uses: actions/checkout@v2 |
| 78 | + - name: Run tests with Thread Sanitizer |
| 79 | + run: swift test --enable-test-discovery --sanitize=thread |
0 commit comments