-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
776: Automatically creates PR when no_atomic.rs needs to be updated r=taiki-e a=taiki-e follow-up #698 Co-authored-by: Taiki Endo <[email protected]>
- Loading branch information
Showing
17 changed files
with
160 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,17 +100,40 @@ jobs: | |
run: ./ci/dependencies.sh | ||
|
||
# When this job failed, run ci/no_atomic.sh and commit result changes. | ||
# TODO(taiki-e): Ideally, this should be automated using a bot that creates | ||
# PR when failed, but there is no bandwidth to implement it | ||
# right now... | ||
codegen: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Rust | ||
run: rustup update nightly && rustup default nightly | ||
- run: ci/no_atomic.sh | ||
- run: git diff --exit-code | ||
- run: git add -N . && git diff --exit-code | ||
if: github.event_name != 'schedule' && !(github.event_name == 'push' && github.ref == 'refs/heads/main') | ||
- id: diff | ||
run: | | ||
git config user.name "Taiki Endo" | ||
git config user.email "[email protected]" | ||
git add -N . | ||
if ! git diff --exit-code; then | ||
git add . | ||
git commit -m "Update no_atomic.rs" | ||
echo "::set-output name=success::false" | ||
fi | ||
if: github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
- uses: taiki-e/create-pull-request@v3 | ||
with: | ||
title: Update no_atomic.rs | ||
body: | | ||
Auto-generated by [create-pull-request][1] | ||
[Please close and immediately reopen this pull request to run CI.][2] | ||
[1]: https://github.com/peter-evans/create-pull-request | ||
[2]: https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#workarounds-to-trigger-further-workflow-runs | ||
branch: update-no-atomic-sh | ||
if: (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' | ||
|
||
# Check formatting. | ||
rustfmt: | ||
|
@@ -172,6 +195,14 @@ jobs: | |
- name: docs | ||
run: ./ci/docs.sh | ||
|
||
shellcheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install shellcheck | ||
uses: taiki-e/install-action@shellcheck | ||
- run: shellcheck $(git ls-files '*.sh') | ||
|
||
# This job doesn't actually test anything, but they're used to tell bors the | ||
# build completed, as there is no practical way to detect when a workflow is | ||
# successful listening to webhooks only. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
IFS=$'\n\t' | ||
cd "$(dirname "$0")"/.. | ||
set -ex | ||
|
||
rustup component add clippy | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
IFS=$'\n\t' | ||
cd "$(dirname "$0")"/.. | ||
set -ex | ||
|
||
export RUSTDOCFLAGS="-D warnings" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,69 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
cd "$(dirname "$0")"/.. | ||
|
||
# Update the list of targets that do not support atomic/CAS operations. | ||
# | ||
# Usage: | ||
# ./ci/no_atomic.sh | ||
|
||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
cd "$(cd "$(dirname "$0")" && pwd)"/.. | ||
|
||
file="no_atomic.rs" | ||
|
||
{ | ||
echo "// This file is @generated by $(basename "$0")." | ||
echo "// It is not intended for manual editing." | ||
echo "" | ||
} >"$file" | ||
|
||
echo "const NO_ATOMIC_CAS: &[&str] = &[" >>"$file" | ||
no_atomic_cas=() | ||
no_atomic_64=() | ||
no_atomic=() | ||
for target in $(rustc --print target-list); do | ||
res=$(rustc --print target-spec-json -Z unstable-options --target "$target" \ | ||
| jq -r "select(.\"atomic-cas\" == false)") | ||
[[ -z "$res" ]] || echo " \"$target\"," >>"$file" | ||
target_spec=$(rustc --print target-spec-json -Z unstable-options --target "${target}") | ||
res=$(jq <<<"${target_spec}" -r 'select(."atomic-cas" == false)') | ||
[[ -z "${res}" ]] || no_atomic_cas+=("${target}") | ||
max_atomic_width=$(jq <<<"${target_spec}" -r '."max-atomic-width"') | ||
case "${max_atomic_width}" in | ||
# It is not clear exactly what `"max-atomic-width" == null` means, but they | ||
# actually seem to have the same max-atomic-width as the target-pointer-width. | ||
# The targets currently included in this group are "mipsel-sony-psp", | ||
# "thumbv4t-none-eabi", "thumbv6m-none-eabi", all of which are | ||
# `"target-pointer-width" == "32"`, so assuming them `"max-atomic-width" == 32` | ||
# for now. | ||
32 | null) no_atomic_64+=("${target}") ;; | ||
# `"max-atomic-width" == 0` means that atomic is not supported at all. | ||
0) | ||
no_atomic_64+=("${target}") | ||
no_atomic+=("${target}") | ||
;; | ||
64 | 128) ;; | ||
# There is no `"max-atomic-width" == 16` or `"max-atomic-width" == 8` targets. | ||
*) exit 1 ;; | ||
esac | ||
done | ||
echo "];" >>"$file" | ||
|
||
{ | ||
# Only crossbeam-utils actually uses this const. | ||
echo "#[allow(dead_code)]" | ||
echo "const NO_ATOMIC_64: &[&str] = &[" | ||
} >>"$file" | ||
for target in $(rustc --print target-list); do | ||
res=$(rustc --print target-spec-json -Z unstable-options --target "$target" \ | ||
| jq -r "select(.\"max-atomic-width\" == 32)") | ||
[[ -z "$res" ]] || echo " \"$target\"," >>"$file" | ||
done | ||
# It is not clear exactly what `"max-atomic-width" == null` means, but they | ||
# actually seem to have the same max-atomic-width as the target-pointer-width. | ||
# The targets currently included in this group are "mipsel-sony-psp", | ||
# "thumbv4t-none-eabi", "thumbv6m-none-eabi", all of which are | ||
# `"target-pointer-width" == "32"`, so assuming them `"max-atomic-width" == 32` | ||
# for now. | ||
for target in $(rustc --print target-list); do | ||
res=$(rustc --print target-spec-json -Z unstable-options --target "$target" \ | ||
| jq -r "select(.\"max-atomic-width\" == null)") | ||
[[ -z "$res" ]] || echo " \"$target\"," >>"$file" | ||
cat >"${file}" <<EOF | ||
// This file is @generated by $(basename "$0"). | ||
// It is not intended for manual editing. | ||
const NO_ATOMIC_CAS: &[&str] = &[ | ||
EOF | ||
for target in "${no_atomic_cas[@]}"; do | ||
echo " \"${target}\"," >>"${file}" | ||
done | ||
echo "];" >>"$file" | ||
cat >>"${file}" <<EOF | ||
]; | ||
# There is no `"max-atomic-width" == 16` or `"max-atomic-width" == 8` targets. | ||
#[allow(dead_code)] // Only crossbeam-utils uses this. | ||
const NO_ATOMIC_64: &[&str] = &[ | ||
EOF | ||
for target in "${no_atomic_64[@]}"; do | ||
echo " \"${target}\"," >>"${file}" | ||
done | ||
cat >>"${file}" <<EOF | ||
]; | ||
# `"max-atomic-width" == 0` means that atomic is not supported at all. | ||
{ | ||
# Only crossbeam-utils actually uses this const. | ||
echo "#[allow(dead_code)]" | ||
echo "const NO_ATOMIC: &[&str] = &[" | ||
} >>"$file" | ||
for target in $(rustc --print target-list); do | ||
res=$(rustc --print target-spec-json -Z unstable-options --target "$target" \ | ||
| jq -r "select(.\"max-atomic-width\" == 0)") | ||
[[ -z "$res" ]] || echo " \"$target\"," >>"$file" | ||
#[allow(dead_code)] // Only crossbeam-utils uses this. | ||
const NO_ATOMIC: &[&str] = &[ | ||
EOF | ||
for target in "${no_atomic[@]}"; do | ||
echo " \"${target}\"," >>"${file}" | ||
done | ||
echo "];" >>"$file" | ||
cat >>"${file}" <<EOF | ||
]; | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
IFS=$'\n\t' | ||
cd "$(dirname "$0")"/.. | ||
set -ex | ||
|
||
rustup component add rustfmt | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
IFS=$'\n\t' | ||
cd "$(dirname "$0")" | ||
set -ex | ||
|
||
cargo run --release --bin chan | tee chan.txt | ||
cargo run --release --bin crossbeam-channel | tee crossbeam-channel.txt | ||
cargo run --release --bin futures-channel | tee futures-channel.txt | ||
cargo run --release --bin mpsc | tee mpsc.txt | ||
go run go.go | tee go.txt | ||
|
||
./plot.py *.txt | ||
./plot.py ./*.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.