Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 643b789

Browse files
chore: updated CI
1 parent b618ee1 commit 643b789

File tree

2 files changed

+50
-27
lines changed

2 files changed

+50
-27
lines changed

‎.github/workflows/general.yml

Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,82 @@
1+
# The name of your workflow. GitHub displays the names of your workflows on your repository's "Actions" tab
12
name: Rust
23

3-
on:
4-
# NB: this differs from the book's project!
5-
# These settings allow us to run this specific CI pipeline for PRs against
6-
# this specific branch (a.k.a. book chapter).
7-
push:
8-
branches:
9-
- main
10-
pull_request:
11-
types: [ opened, synchronize, reopened ]
12-
branches:
13-
- main
4+
on: [push, pull_request]
145

156
env:
167
CARGO_TERM_COLOR: always
178
SQLX_VERSION: 0.6.2
189
SQLX_FEATURES: "rustls,postgres"
1910

11+
# A workflow run is made up of one or more jobs, which run in parallel by default
12+
# Each job runs in a runner environment specified by runs-on
2013
jobs:
14+
# Unique identifier of our job (`job_id`)
2115
test:
16+
# Sets the name `Test` for the job, which is displayed in the GitHub UI
2217
name: Test
18+
# Containers must run in Linux based operating systems
2319
runs-on: ubuntu-latest
20+
# Service containers to run with the `test` container job
2421
services:
22+
# Label used to access the service container
2523
postgres:
26-
image: postgres:14
24+
# Docker Hub image
25+
image: postgres:13.1
26+
# Set environment variables for the service container
2727
env:
2828
POSTGRES_USER: postgres
29-
POSTGRES_PASSWORD: password
29+
POSTGRES_PASSWORD: postgres
3030
POSTGRES_DB: postgres
31+
# Set health checks to wait until the service is ready
32+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
33+
# Map service container ports to the host ports
3134
ports:
3235
- 5432:5432
3336
redis:
3437
image: redis:7
3538
ports:
3639
- 6379:6379
40+
3741
steps:
38-
- uses: actions/checkout@v3
39-
- uses: dtolnay/rust-toolchain@stable
42+
# Downloads a copy of the code in your repository before running CI tests
43+
- name: Check out repository code
44+
# The uses keyword specifies that this step will run v3 of the actions/checkout action.
45+
# This is an action that checks out your repository onto the runner, allowing you to run scripts or other actions against your code (such as build and test tools).
46+
# You should use the checkout action any time your workflow will run against the repository's code.
47+
uses: actions/checkout@v3
48+
49+
# This GitHub Action installs a Rust toolchain using rustup. It is designed for one-line concise usage and good defaults.
50+
- name: Install the Rust toolchain
51+
uses: dtolnay/rust-toolchain@stable
52+
53+
# This GitHub Action caches the Rust toolchain between workflow runs. It is designed for one-line concise usage and good defaults.
4054
- uses: Swatinem/rust-cache@v2
4155
with:
56+
# An additional cache key that is added alongside the automatic `job`-based cache key and can be used to further differentiate jobs. default: empty
4257
key: sqlx-${{ env.SQLX_VERSION }}
58+
4359
- name: Install sqlx-cli
4460
run:
4561
cargo install sqlx-cli
4662
--version=${{ env.SQLX_VERSION }}
4763
--features ${{ env.SQLX_FEATURES }}
4864
--no-default-features
4965
--locked
66+
# The --locked flag can be used to force Cargo to use the packaged Cargo.lock file if it is available.
67+
# This may be useful for ensuring reproducible builds, to use the exact same set of dependencies that were available when the package was published.
68+
# It may also be useful if a newer version of a dependency is published that no longer builds on your system, or has other problems
69+
70+
- name: Install postgresql-client
71+
run: sudo apt-get update && sudo apt-get install postgresql-client -y
72+
5073
- name: Migrate database
51-
run: |
52-
sudo apt-get install libpq-dev -y
53-
SKIP_DOCKER=true ./scripts/init_db.sh
74+
run: SKIP_DOCKER=true ./scripts/init_db.sh
75+
5476
- name: Check sqlx-data.json is up-to-date
5577
run: |
56-
cargo sqlx prepare --check -- --bin zero2prod
78+
cargo sqlx prepare --check -- --bin robust-rust
79+
5780
- name: Run tests
5881
run: cargo test
5982

@@ -68,6 +91,7 @@ jobs:
6891
- name: Enforce formatting
6992
run: cargo fmt --check
7093

94+
# `clippy` container job
7195
clippy:
7296
name: Clippy
7397
runs-on: ubuntu-latest
@@ -95,13 +119,14 @@ jobs:
95119
--features ${{ env.SQLX_FEATURES }}
96120
--no-default-features
97121
--locked
122+
- name: Install postgresql-client
123+
run: sudo apt-get update && sudo apt-get install postgresql-client -y
98124
- name: Migrate database
99-
run: |
100-
sudo apt-get install libpq-dev -y
101-
SKIP_DOCKER=true ./scripts/init_db.sh
125+
run: SKIP_DOCKER=true ./scripts/init_db.sh
102126
- name: Linting
103127
run: cargo clippy -- -D warnings
104128

129+
# `coverage` container job
105130
coverage:
106131
name: Code coverage
107132
runs-on: ubuntu-latest
@@ -122,13 +147,11 @@ jobs:
122147
- name: Checkout repository
123148
uses: actions/checkout@v3
124149
- uses: dtolnay/rust-toolchain@stable
125-
- name: Install libpq
150+
- name: Install postgresql-client
126151
run: sudo apt-get update && sudo apt-get install postgresql-client -y
127152
- uses: Swatinem/rust-cache@v2
128153
with:
129154
key: sqlx-${{ env.SQLX_VERSION }}
130-
- name: Install tarpaulin
131-
run: cargo install cargo-tarpaulin
132155
- name: Install sqlx-cli
133156
run:
134157
cargo install sqlx-cli
@@ -139,4 +162,4 @@ jobs:
139162
- name: Migrate database
140163
run: SKIP_DOCKER=true ./scripts/init_db.sh
141164
- name: Generate code coverage
142-
run: cargo tarpaulin --verbose --workspace
165+
run: cargo install cargo-tarpaulin && cargo tarpaulin --verbose --workspace

‎src/routes/admin/newsletters/post.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn success_message() -> FlashMessage {
7878

7979
#[tracing::instrument(skip_all)]
8080
async fn insert_newsletter_issue(
81-
transaction: &mut Transaction<'_, Postgres>,
81+
transaction: &mut Transaction<'_, Postgres>,
8282
title: &str,
8383
text_content: &str,
8484
html_content: &str,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /