Skip to content

Commit

Permalink
ci: install things in a different step
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardosm committed Apr 22, 2024
1 parent 60e77a6 commit 9b4f9ba
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 77 deletions.
32 changes: 20 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,19 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Run job
run: ./ci/lint-aux.sh
- name: Install lint utilities
run: sudo npm install -g markdownlint-cli
- name: Install Rust
run: ./ci/install-rust.sh stable.txt --profile minimal
- run: ./ci/lint-aux.sh

extract-changelog:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Run job
run: ./ci/extract-changelog.sh
- name: Install Rust
run: ./ci/install-rust.sh stable.txt --profile minimal
- run: ./ci/extract-changelog.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -50,15 +54,17 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Run job
run: ./ci/rustfmt.sh
- name: Install Rust
run: ./ci/install-rust.sh stable.txt --profile minimal -c rustfmt
- run: cargo fmt --all -- --check

clippy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Run job
run: ./ci/clippy.sh
- name: Install Rust
run: ./ci/install-rust.sh stable.txt --profile minimal -c clippy
- run: ./ci/clippy.sh

build-and-test:
runs-on: ubuntu-22.04
Expand All @@ -69,15 +75,17 @@ jobs:
- rust-version: stable.txt
steps:
- uses: actions/checkout@v4
- name: Run job
run: ./ci/build-and-test.sh "${{ matrix.rust-version }}"
- name: Install Rust
run: ./ci/install-rust.sh "${{ matrix.rust-version }}" --profile minimal
- run: ./ci/build-and-test.sh

package-crate:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Run job
run: ./ci/package-crate.sh
- name: Install Rust
run: ./ci/install-rust.sh stable.txt --profile minimal
- run: ./ci/package-crate.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: ./ci/install-rust.sh stable.txt --profile minimal
- id: get-version
run: ./ci/get-release-version.sh

Expand Down Expand Up @@ -71,6 +73,8 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: ./ci/install-rust.sh stable.txt --profile minimal
- name: Publish
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
Expand Down
12 changes: 0 additions & 12 deletions ci/build-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@ set -euo pipefail

. ci/utils.sh

if [ "$#" -ne 1 ]; then
echo_stderr "Usage: $0 <rust_version>"
exit 1
fi
rust_version="$1"

begin_group "Install Rust"
./ci/install-rust.sh "$rust_version" --profile minimal
# shellcheck disable=SC1091
. "$HOME/.cargo/env"
end_group

export RUSTDOCFLAGS="-D warnings"

begin_group "Fetch dependencies"
Expand Down
6 changes: 0 additions & 6 deletions ci/clippy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ set -euo pipefail

. ci/utils.sh

begin_group "Install Rust"
./ci/install-rust.sh stable.txt --profile minimal -c clippy
# shellcheck disable=SC1091
. "$HOME/.cargo/env"
end_group

begin_group "Fetch dependencies"
cargo fetch --locked
end_group
Expand Down
9 changes: 0 additions & 9 deletions ci/get-release-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ set -euo pipefail

. ci/utils.sh

begin_group "Install Rust"
./ci/install-rust.sh stable.txt --profile minimal -c clippy
# shellcheck disable=SC1091
. "$HOME/.cargo/env"
end_group

begin_group "Get release version"

if [[ "$GITHUB_REF" != "refs/tags/v"* ]]; then
echo "Invalid ref: $GITHUB_REF"
exit 1
Expand All @@ -29,4 +21,3 @@ if [ "$tag_version" != "$crate_version" ]; then
fi

echo "version=$tag_version" >> "$GITHUB_OUTPUT"
end_group
4 changes: 4 additions & 0 deletions ci/install-rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ fi

echo "Installing Rust $rust_version"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "$rust_version" "$@"

if [ -n "${GITHUB_PATH+x}" ]; then
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
fi
12 changes: 0 additions & 12 deletions ci/lint-aux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@ set -euo pipefail

. ci/utils.sh

begin_group "Install lint utilities"
sudo apt-get update
sudo apt-get install -y --no-install-recommends shellcheck
sudo npm install -g markdownlint-cli
end_group

begin_group "Install Rust"
./ci/install-rust.sh stable.txt --profile minimal
# shellcheck disable=SC1091
. "$HOME/.cargo/env"
end_group

begin_group "Check crate version"

crate="sourceannot"
Expand Down
6 changes: 0 additions & 6 deletions ci/package-crate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ set -euo pipefail

. ci/utils.sh

begin_group "Install Rust"
./ci/install-rust.sh stable.txt --profile minimal
# shellcheck disable=SC1091
. "$HOME/.cargo/env"
end_group

mkdir checkout
find . -mindepth 1 -maxdepth 1 -not -name checkout -print0 | xargs -0 mv -t checkout
cd checkout
Expand Down
6 changes: 0 additions & 6 deletions ci/publish-crate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ set -euo pipefail

. ci/utils.sh

begin_group "Install Rust"
./ci/install-rust.sh stable.txt --profile minimal -c clippy
# shellcheck disable=SC1091
. "$HOME/.cargo/env"
end_group

begin_group "Fetch dependencies"
cargo fetch --locked
end_group
Expand Down
14 changes: 0 additions & 14 deletions ci/rustfmt.sh

This file was deleted.

0 comments on commit 9b4f9ba

Please sign in to comment.