Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Nov 22, 2022
1 parent 74fea6e commit 0341170
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 57 deletions.
33 changes: 3 additions & 30 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -725,43 +725,16 @@ jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# Cargo-make boilerplate
- name: Get cargo-make version
id: cargo-make-version
run: |
echo "::set-output name=hash::$(cargo search cargo-make | grep '^cargo-make =' | md5sum)"
shell: bash
- name: Attempt to load cached cargo-make
uses: actions/cache@v2
id: cargo-make-cache
with:
path: |
~/.cargo/bin/cargo-make
~/.cargo/bin/cargo-make.exe
key: ${{ runner.os }}-make-${{ steps.cargo-make-version.outputs.hash }}
- name: Install cargo-make
if: steps.cargo-make-cache.outputs.cache-hit != 'true'
uses: actions-rs/install@v0.1.2
with:
crate: cargo-make
version: latest
# We don't expect to keep being clippy-clean on nightly Rust,
# so the "toolchain boilerplate" is deliberately omitted

# Check if we need to force-nightly
- name: Check if we need to force-nightly
id: force_nightly
run: |
force_nightly_status=$(cargo make check-needs-force-nightly-ci)
echo "::set-output name=force_nightly_status::${force_nightly_status}"
# Clippy job > Install and run clippy steps

# We don't expect to keep being clippy-clean on nightly Rust
- name: Install clippy
if: steps.force_nightly.outputs.force_nightly_status != 'true'
run: rustup component add clippy

- uses: actions-rs/clippy-check@v1.0.7
if: steps.force_nightly.outputs.force_nightly_status != 'true'
with:
token: ${{ secrets.GITHUB_TOKEN }}
# keep args in sync with `clippy-all` in .cargo/config.toml
Expand Down
39 changes: 12 additions & 27 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -186,42 +186,20 @@ if not ${env_file}
exit 1
end
needs_run = exec cargo make --loglevel error check-needs-force-nightly-ci
if eq ${needs_run} "yes"
echo "Setting up CI environment for forced-nightly Rust build"
appendfile ${env_file} "ICU4X_NIGHTLY_TOOLCHAIN=nightly\n"
appendfile ${env_file} "INSTALLED_NIGHTLY_VERSION=nightly\n"
appendfile ${env_file} "ICU4X_BUILDING_WITH_FORCED_NIGHTLY=1\n"
appendfile ${env_file} "RUSTDOCFLAGS=--cfg ICU4X_BUILDING_WITH_FORCED_NIGHTLY\n"
exec rustup override set nightly
else
echo "forced-nightly environment not required"
end
'''

[tasks.check-needs-force-nightly-ci]
description = "Check if CI has requested a forced nightly"
category = "CI"
script_runner = "@duckscript"
script = '''
exit_on_error true
event_name = get_env GITHUB_EVENT_NAME
if not ${event_name}
echo "GITHUB_EVENT_NAME not set!"
exit 1
end
is_schedule = eq ${event_name} "schedule"
is_pr = eq ${event_name} "pull_request"
is_dispatch = eq ${event_name} "workflow_dispatch"
is_schedule = eq "${event_name}" "schedule"
is_pr = eq "${event_name}" "pull_request"
is_dispatch = eq "${event_name}" "workflow_dispatch"
dispatch_needs_nightly = set false
if is_dispatch
event_path = get_env GITHUB_EVENT_PATH
echo ${event_path}
event_file = readfile ${event_path}
event_json = json_parse ${event_file}
if ${event_json.inputs.nightly}
Expand All @@ -230,6 +208,13 @@ if is_dispatch
end
if ${is_schedule} or ${is_pr} or ${dispatch_needs_nightly}
echo "yes"
echo "Setting up CI environment for forced-nightly Rust build"
appendfile ${env_file} "ICU4X_NIGHTLY_TOOLCHAIN=nightly\n"
appendfile ${env_file} "INSTALLED_NIGHTLY_VERSION=nightly\n"
appendfile ${env_file} "ICU4X_BUILDING_WITH_FORCED_NIGHTLY=1\n"
appendfile ${env_file} "RUSTDOCFLAGS=--cfg ICU4X_BUILDING_WITH_FORCED_NIGHTLY\n"
exec rustup override set nightly
else
echo "forced-nightly environment not required"
end
'''
'''

0 comments on commit 0341170

Please sign in to comment.