Skip to content

Commit

Permalink
ci: actions-rust-lang/setup-rust-toolchain is better
Browse files Browse the repository at this point in the history
- It uses `rust-toolchain.toml` by default
- Has built-in support for `Swatinem/rust-cache`
  • Loading branch information
azzamsa committed Oct 11, 2023
1 parent dc2df95 commit f602568
Showing 1 changed file with 24 additions and 33 deletions.
57 changes: 24 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,12 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v3

- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy, rustfmt

- uses: Swatinem/rust-cache@v2

- name: Install latest just release
uses: taiki-e/install-action@just

- name: Install latest dprint release
uses: taiki-e/install-action@dprint
- uses: taiki-e/install-action@just
- uses: taiki-e/install-action@dprint

- name: Check MSRV
run: |
Expand All @@ -35,6 +29,13 @@ jobs:
echo "MSRV match"
fi
- name: Show version information
shell: bash
run: |
rustc --version
cargo --version
cargo fmt --version
- name: Ensure `fmt` has been run
run: just fmt-check

Expand All @@ -50,18 +51,10 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v3

- name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }})
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }}

- uses: Swatinem/rust-cache@v2
- uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Install latest nextest release
uses: taiki-e/install-action@nextest

- name: Install latest just release
uses: taiki-e/install-action@just
- uses: taiki-e/install-action@nextest
- uses: taiki-e/install-action@just

- name: Prepare the environment variables
run: |
Expand All @@ -77,6 +70,12 @@ jobs:
# Check DB version
docker exec postgres_db psql -h localhost -p 5432 -U durin --version
- name: Show version information
shell: bash
run: |
rustc --version
cargo --version
- name: Run tests
env:
DATABASE_URL: postgres://durin:SpeakFriendAndEnter@localhost:5432/tin
Expand All @@ -101,20 +100,17 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v3

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}

- name: Show version information
shell: bash
run: |
gcc --version || true
rustup -V
rustup toolchain list
rustup default
cargo -V
rustc -V
rustc --version
cargo --version
rustywind --version
trunk --version
- name: Install musl-tools
if: matrix.target == 'x86_64-unknown-linux-musl'
Expand All @@ -123,10 +119,5 @@ jobs:
sudo apt-get install -y --no-install-recommends \
--allow-unauthenticated musl-tools
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.target }}

- name: Build
run: cargo build --release --locked --target ${{ matrix.target }}

0 comments on commit f602568

Please sign in to comment.