Request limiting for logging in #158
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: Web API CI | |
on: | |
push: | |
paths: | |
# Run if workflow changes | |
- '.github/workflows/web-api-ci.yml' | |
# Run on changed dependencies | |
- '**/Cargo.toml' | |
- '**/Cargo.lock' | |
- '**/rust-toolchain.toml' | |
# Run on changed source files | |
- 'backend/rvoc-backend/src/**' | |
- 'backend/api_commands/src/**' | |
- 'backend/integration-tests/src/**' | |
# Run on changed flake | |
- 'flake.nix' | |
- 'flake.lock' | |
branches: | |
- main | |
pull_request: | |
branches: main | |
# Run manually | |
workflow_dispatch: | |
jobs: | |
run_integration_tests: | |
name: Backend integration tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# adapted from https://github.com/diesel-rs/diesel/blob/1d66cdfb8323fc09612a08dca10752b47238181a/.github/workflows/ci.yml | |
- name: Install postgres (Linux) | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libpq-dev postgresql | |
echo "host all all 127.0.0.1/32 md5" > sudo tee -a /etc/postgresql/10/main/pg_hba.conf | |
sudo service postgresql restart && sleep 3 | |
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';" | |
sudo -u postgres createdb rvoc | |
sudo service postgresql restart && sleep 3 | |
echo "PG_DATABASE_URL=postgres://postgres:postgres@localhost/" >> $GITHUB_ENV | |
echo "PG_EXAMPLE_DATABASE_URL=postgres://postgres:postgres@localhost/diesel_example" >> $GITHUB_ENV | |
echo "POSTGRES_RVOC_URL=postgres://postgres:postgres@localhost/rvoc" >> $GITHUB_ENV | |
- name: Install nix | |
uses: DeterminateSystems/nix-installer-action@v8 | |
- name: Cache nix | |
uses: DeterminateSystems/magic-nix-cache-action@v2 | |
- name: Build debug binary | |
run: nix build --out-link debugBinary .#debugBinary | |
- name: Build integration-tests binary | |
run: nix build --out-link integrationTestsBinary .#integrationTestsBinary | |
- name: Set up environment variables | |
run: | | |
echo "PASSWORD_PEPPER=test-test-test-test" >> $GITHUB_ENV | |
echo "RVOC_INTEGRATION_TEST_MODE=true" >> $GITHUB_ENV | |
- name: Run database migrations | |
run: debugBinary/bin/rvoc-backend apply-migrations | |
- name: Run internal integration tests | |
run: debugBinary/bin/rvoc-backend run-internal-integration-tests | |
- name: Run integration tests | |
uses: BerniWittmann/background-server-action@v1 | |
with: | |
command: RUST_BACKTRACE=1 integrationTestsBinary/bin/integration-tests | |
start: debugBinary/bin/rvoc-backend web |