Update syntax, simplify job names #7
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: Aardwolf-Social/build | |
on: | |
push: | |
branches: | |
- "**/*" | |
pull_request: | |
concurrency: | |
group: "${{ github.ref }}" | |
cancel-in-progress: true | |
jobs: | |
Build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
# Installs the most recent stable rust toolchain as of the specified time | |
# offset, which may be written in years, months, weeks, or days. | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
- name: Start PostgreSQL | |
run: | | |
sudo systemctl enable postgresql.service | |
sudo systemctl start postgresql.service | |
# Create the aardwolf database | |
- name: Create database | |
run: | | |
cd ~postgres/ | |
sudo -u postgres psql -c 'CREATE DATABASE aardwolf_testing;' | |
# Create the aardwolf database user | |
- name: Create database user | |
run: | | |
cd ~postgres/ | |
sudo sudo netstat -plunt |grep postgres | |
sudo -u postgres psql -c "CREATE USER aardwolf_user WITH PASSWORD 'changeme';" | |
sudo -u postgres psql -c "grant all privileges on database aardwolf_testing to aardwolf_user;" | |
# Set up environment variables for database URLs | |
- name: Set up environment variables | |
run: | | |
echo "DATABASE_URL=postgresql://aardwolf_user:[email protected]:5432/aardwolf_testing" > "$GITHUB_ENV" | |
echo "TEST_DATABASE_URL=postgresql://aardwolf_user:[email protected]:5432/aardwolf_testing" >> "$GITHUB_ENV" | |
# Install diesel CLI if not already installed | |
- name: Check diesel installation | |
run: if which diesel; then echo "diesel already installed"; else cargo install diesel_cli --no-default-features --features=postgres; fi | |
# Push the aardwolf-models directory, and run migrations | |
- run: | | |
pushd aardwolf-models | |
diesel migration run | |
popd | |
# Run cargo build | |
- name: Cargo build aardwolf | |
run: cargo build --all --verbose |