You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# The name of your workflow. GitHub displays the names of your workflows on your repository's "Actions" tab
2
1
name: Rust
3
2
4
-
# To automatically trigger the workflow
5
-
on: [push, pull_request]
3
+
on: [ push, pull_request ]
6
4
7
5
env:
8
6
CARGO_TERM_COLOR: always
9
7
SQLX_VERSION: 0.7.1
10
8
SQLX_FEATURES: "rustls,postgres"
11
9
12
-
# A workflow run is made up of one or more jobs, which run in parallel by default
13
-
# Each job runs in a runner environment specified by runs-on
14
10
jobs:
15
-
# Unique identifier of our job (`job_id`)
16
11
test:
17
-
# Sets the name `Test` for the job, which is displayed in the GitHub UI
18
12
name: Test
19
-
# Containers must run in Linux based operating systems
20
13
runs-on: ubuntu-latest
21
-
# Service containers to run with the `test` container job
22
14
services:
23
-
# Label used to access the service container
24
15
postgres:
25
-
# Docker Hub image
26
16
image: postgres:14
27
-
# Environment variables scoped only for the `postgres` element
28
17
env:
29
18
POSTGRES_USER: postgres
30
19
POSTGRES_PASSWORD: password
31
20
POSTGRES_DB: postgres
32
-
# When you map ports using the ports keyword, GitHub uses the --publish command to publish the container’s ports to the Docker host
33
-
# Opens tcp port 5432 on the host and service container
34
21
ports:
35
22
- 5432:5432
36
23
steps:
37
-
# Downloads a copy of the code in your repository before running CI tests
38
24
- name: Check out repository code
39
-
# The uses keyword specifies that this step will run v3 of the actions/checkout action.
40
-
# 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).
41
-
# You should use the checkout action any time your workflow will run against the repository's code.
42
25
uses: actions/checkout@v3
43
-
44
-
# This GitHub Action installs a Rust toolchain using rustup. It is designed for one-line concise usage and good defaults.
45
26
- name: Install the Rust toolchain
46
27
uses: dtolnay/rust-toolchain@stable
47
-
48
-
# A GitHub Action that implements smart caching for rust/cargo projects with sensible defaults.
49
28
- name: Rust Cache Action
50
29
uses: Swatinem/rust-cache@v2
51
30
with:
52
-
# An additional cache key that is added alongside the automatic `job`-based cache key and can be used to further differentiate jobs. default: empty
53
31
key: sqlx-${{ env.SQLX_VERSION }}
54
-
55
32
- name: Install sqlx-cli
56
33
run:
57
34
cargo install sqlx-cli
58
35
--version=${{ env.SQLX_VERSION }}
59
36
--features ${{ env.SQLX_FEATURES }}
60
37
--no-default-features
61
38
--locked
62
-
# The --locked flag can be used to force Cargo to use the packaged Cargo.lock file if it is available.
63
-
# This may be useful for ensuring reproducible builds, to use the exact same set of dependencies that were available when the package was published.
64
-
# 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
0 commit comments