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 2b76fe8 commit 27f6fa8
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 76 deletions.
45 changes: 27 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,20 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install lint utilities
run: sudo npm install -g markdownlint-cli
- name: Install Rust
run: ./ci/install-rust.sh stable.txt --profile minimal
- name: Run job
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 @@ -52,15 +57,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
- 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
- run: ./ci/clippy.sh

build-and-test:
runs-on: ubuntu-22.04
Expand All @@ -71,15 +78,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-crates:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Run job
run: ./ci/package-crates.sh
- name: Install Rust
run: ./ci/install-rust.sh stable.txt --profile minimal
- run: ./ci/package-crates.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -90,17 +99,17 @@ jobs:
build-dist-linux:
runs-on: ubuntu-22.04
env:
IMAGE_NAME: quay.io/pypa/manylinux2014_x86_64
DOCKER_IMAGE: quay.io/pypa/manylinux2014_x86_64
steps:
- uses: actions/checkout@v4
- name: Pull image
run: docker pull "$IMAGE_NAME"
- name: Pull Docker image
run: docker pull "$DOCKER_IMAGE"
- name: Build
run: |
docker run \
-v "$(pwd):/workdir" \
-w /workdir \
"$IMAGE_NAME" \
"$DOCKER_IMAGE" \
bash ./ci/build-dist-linux.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
Expand All @@ -114,17 +123,17 @@ jobs:
build-dist-windows:
runs-on: ubuntu-22.04
env:
IMAGE_NAME: debian:12-slim
DOCKER_IMAGE: debian:12-slim
steps:
- uses: actions/checkout@v4
- name: Pull image
run: docker pull "$IMAGE_NAME"
- name: Pull Docker image
run: docker pull "$DOCKER_IMAGE"
- name: Build
run: |
docker run \
-v "$(pwd):/workdir" \
-w /workdir \
"$IMAGE_NAME" \
"$DOCKER_IMAGE" \
bash ./ci/build-dist-windows.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
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 @@ -97,6 +99,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
11 changes: 0 additions & 11 deletions ci/build-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +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
. ci/cargo-env.sh
end_group

export RUSTDOCFLAGS="-D warnings"

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

. ci/utils.sh

begin_group "Install Rust"
./ci/install-rust.sh stable.txt --profile minimal -c clippy
. ci/cargo-env.sh
end_group

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

. ci/utils.sh

begin_group "Install Rust"
./ci/install-rust.sh stable.txt --profile minimal -c clippy
. ci/cargo-env.sh
end_group

begin_group "Get release version"

if [[ "$GITHUB_REF" != "refs/tags/v"* ]]; then
echo "Invalid ref: $GITHUB_REF"
exit 1
Expand All @@ -28,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 [ -z "${GITHUB_PATH+x}" ]
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
fi
11 changes: 0 additions & 11 deletions ci/lint-aux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +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
. ci/cargo-env.sh
end_group

crates=(
rsjsonnet-lang
rsjsonnet-front
Expand Down
5 changes: 0 additions & 5 deletions ci/package-crates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ set -euo pipefail

. ci/utils.sh

begin_group "Install Rust"
./ci/install-rust.sh stable.txt --profile minimal
. ci/cargo-env.sh
end_group

pkgs_dir="packages"
if [ -e "$pkgs_dir" ]; then
echo "$pkgs_dir already exists"
Expand Down
5 changes: 0 additions & 5 deletions ci/publish-crates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ set -euo pipefail

. ci/utils.sh

begin_group "Install Rust"
./ci/install-rust.sh stable.txt --profile minimal -c clippy
. ci/cargo-env.sh
end_group

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

This file was deleted.

0 comments on commit 27f6fa8

Please sign in to comment.