Create README.md #65
Workflow file for this run
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: Integration Tests | |
on: | |
pull_request: | |
branches: [ "master" ] | |
env: | |
CARGO_TERM_COLOR: always | |
SQLX_VERSION: 0.7.4 | |
SQLX_FEATURES: "rustls,postgres" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
POSTGRES_DB: ${{ secrets.POSTGRES_DB }} | |
ports: | |
- 6500:5432 | |
redis: | |
image: redis:alpine | |
ports: | |
- 6379:6379 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up .env file | |
run: | | |
echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> .env | |
echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> .env | |
echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> .env | |
echo "POSTGRES_PORT=${{ secrets.POSTGRES_PORT }}" >> .env | |
echo "POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}" >> .env | |
echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> .env | |
echo "REDIS_HOST=${{ secrets.REDIS_HOST }}" >> .env | |
echo "REDIS_PORT=${{ secrets.REDIS_PORT }}" >> .env | |
echo "ACCESS_TOKEN_PRIVATE_KEY=${{ secrets.ACCESS_TOKEN_PRIVATE_KEY }}" >> .env | |
echo "ACCESS_TOKEN_PUBLIC_KEY=${{ secrets.ACCESS_TOKEN_PUBLIC_KEY }}" >> .env | |
echo "ACCESS_TOKEN_EXPIRES_IN=${{ secrets.ACCESS_TOKEN_EXPIRES_IN }}" >> .env | |
echo "ACCESS_TOKEN_MAXAGE=${{ secrets.ACCESS_TOKEN_MAXAGE }}" >> .env | |
echo "REFRESH_TOKEN_PRIVATE_KEY=${{ secrets.REFRESH_TOKEN_PRIVATE_KEY }}" >> .env | |
echo "REFRESH_TOKEN_PUBLIC_KEY=${{ secrets.REFRESH_TOKEN_PUBLIC_KEY }}" >> .env | |
echo "REFRESH_TOKEN_EXPIRES_IN=${{ secrets.REFRESH_TOKEN_EXPIRES_IN }}" >> .env | |
echo "REFRESH_TOKEN_MAXAGE=${{ secrets.REFRESH_TOKEN_MAXAGE }}" >> .env | |
- name: Install the Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Rust Cache Action | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: sqlx-${{ env.SQLX_VERSION }} | |
- name: Install sqlx-cli | |
run: | |
cargo install sqlx-cli | |
--version=${{ env.SQLX_VERSION }} | |
--features ${{ env.SQLX_FEATURES }} | |
--no-default-features | |
--locked | |
- name: Install postgresql-client | |
run: sudo apt-get update && sudo apt-get install postgresql-client -y | |
- name: Migrate database | |
run: SKIP_DOCKER=true ./scripts/init_db.sh | |
- name: Run tests | |
run: cargo test | |