Pass secrets to the unit test workflow #1009
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: { types: [opened, reopened, synchronize, ready_for_review] } | |
push: { branches: [ main ] } | |
env: | |
LOG_LEVEL: info | |
SWIFT_DETERMINISTIC_HASHING: 1 | |
POSTGRES_HOSTNAME: 'psql-a' | |
POSTGRES_HOSTNAME_A: 'psql-a' | |
POSTGRES_HOSTNAME_B: 'psql-b' | |
POSTGRES_DB: 'test_database' | |
POSTGRES_DB_A: 'test_database' | |
POSTGRES_DB_B: 'test_database' | |
POSTGRES_USER: 'test_username' | |
POSTGRES_USER_A: 'test_username' | |
POSTGRES_USER_B: 'test_username' | |
POSTGRES_PASSWORD: 'test_password' | |
POSTGRES_PASSWORD_A: 'test_password' | |
POSTGRES_PASSWORD_B: 'test_password' | |
MYSQL_HOSTNAME: 'mysql-a' | |
MYSQL_HOSTNAME_A: 'mysql-a' | |
MYSQL_HOSTNAME_B: 'mysql-b' | |
MYSQL_DATABASE: 'test_database' | |
MYSQL_DATABASE_A: 'test_database' | |
MYSQL_DATABASE_B: 'test_database' | |
MYSQL_USERNAME: 'test_username' | |
MYSQL_USERNAME_A: 'test_username' | |
MYSQL_USERNAME_B: 'test_username' | |
MYSQL_PASSWORD: 'test_password' | |
MYSQL_PASSWORD_A: 'test_password' | |
MYSQL_PASSWORD_B: 'test_password' | |
MONGO_HOSTNAME: 'mongo-a' | |
MONGO_HOSTNAME_A: 'mongo-a' | |
MONGO_HOSTNAME_B: 'mongo-b' | |
jobs: | |
linux-integration-sqlite: | |
if: ${{ !(github.event.pull_request.draft || false) }} | |
runs-on: ubuntu-latest | |
container: swift:5.10-jammy | |
steps: | |
- name: Check out package | |
uses: actions/checkout@v4 | |
with: { path: fluent-kit } | |
- name: Check out dependent | |
uses: actions/checkout@v4 | |
with: { repository: vapor/fluent-sqlite-driver, path: fluent-sqlite-driver } | |
- name: Use local package and run tests | |
run: | | |
swift package --package-path fluent-sqlite-driver edit fluent-kit --path fluent-kit | |
swift test --package-path fluent-sqlite-driver --sanitize=thread | |
linux-integration-mysql: | |
if: ${{ !(github.event.pull_request.draft || false) }} | |
runs-on: ubuntu-latest | |
container: swift:5.10-jammy | |
services: | |
mysql-a: { image: 'mysql:8', env: { MYSQL_ALLOW_EMPTY_PASSWORD: true, MYSQL_USER: test_username, MYSQL_PASSWORD: test_password, MYSQL_DATABASE: test_database } } | |
mysql-b: { image: 'mysql:8', env: { MYSQL_ALLOW_EMPTY_PASSWORD: true, MYSQL_USER: test_username, MYSQL_PASSWORD: test_password, MYSQL_DATABASE: test_database } } | |
steps: | |
- name: Check out package | |
uses: actions/checkout@v4 | |
with: { path: fluent-kit } | |
- name: Check out dependent | |
uses: actions/checkout@v4 | |
with: { repository: vapor/fluent-mysql-driver, path: fluent-mysql-driver } | |
- name: Use local package and run tests | |
run: | | |
swift package --package-path fluent-mysql-driver edit fluent-kit --path fluent-kit | |
swift test --package-path fluent-mysql-driver --sanitize=thread | |
linux-integration-psql: | |
if: ${{ !(github.event.pull_request.draft || false) }} | |
runs-on: ubuntu-latest | |
container: swift:5.10-jammy | |
services: | |
psql-a: { image: 'postgres:16', env: { POSTGRES_USER: test_username, POSTGRES_PASSWORD: test_password, POSTGRES_DB: test_database, POSTGRES_HOST_AUTH_METHOD: scram-sha-256, POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256 } } | |
psql-b: { image: 'postgres:16', env: { POSTGRES_USER: test_username, POSTGRES_PASSWORD: test_password, POSTGRES_DB: test_database, POSTGRES_HOST_AUTH_METHOD: scram-sha-256, POSTGRES_INITDB_ARGS: --auth-host=scram-sha-256 } } | |
steps: | |
- name: Check out package | |
uses: actions/checkout@v4 | |
with: { path: fluent-kit } | |
- name: Check out dependent | |
uses: actions/checkout@v4 | |
with: { repository: vapor/fluent-postgres-driver, path: fluent-postgres-driver } | |
- name: Use local package and run tests | |
run: | | |
swift package --package-path fluent-postgres-driver edit fluent-kit --path fluent-kit | |
swift test --package-path fluent-postgres-driver --sanitize=thread | |
linux-integration-mongo: | |
if: ${{ !(github.event.pull_request.draft || false) }} | |
runs-on: ubuntu-latest | |
container: swift:5.10-jammy | |
services: | |
mongo-a: { image: 'mongo:6' } | |
mongo-b: { image: 'mongo:6' } | |
steps: | |
- name: Check out package | |
uses: actions/checkout@v4 | |
with: { path: fluent-kit } | |
- name: Check out dependent | |
uses: actions/checkout@v4 | |
with: { repository: vapor/fluent-mongo-driver, path: fluent-mongo-driver } | |
- name: Use local package and run tests | |
run: | | |
swift package --package-path fluent-mongo-driver edit fluent-kit --path fluent-kit | |
swift test --package-path fluent-mongo-driver --sanitize=thread | |
unit-tests: | |
uses: vapor/ci/.github/workflows/run-unit-tests.yml@main | |
secrets: inherit |