Skip to content

Commit

Permalink
Stop using the deprecated set-output in our CI configs (#1059)
Browse files Browse the repository at this point in the history
This closes #927. This PR also
includes a few changes to make style check pass for the stable Rust
1.75.
  • Loading branch information
qinsoon authored Jan 3, 2024
1 parent 0fb1acf commit e7143b9
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 45 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/auto-merge-inner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ jobs:
run: |
if [[ "${{ inputs.repo }}" == ${{ inputs.base_repo }} ]] && [[ "${{ inputs.ref }}" == "master" ]]; then
echo "Conditions not met"
echo "::set-output name=skip::true"
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "::set-output name=skip::false"
echo "skip=false" >> $GITHUB_OUTPUT
fi
shell: bash

Expand All @@ -63,7 +63,7 @@ jobs:
id: get-pr
run: |
PR_NUMBER=$(gh pr list --head ${{ inputs.ref }} --repo ${{ inputs.base_repo }} --json number --jq '.[0].number')
echo "::set-output name=pr_number::$PR_NUMBER"
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/perf-compare-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ jobs:
return res.data.head.sha
- id: print
run: |
echo "::set-output name=mmtk_repo::${{ steps.core-repo.outputs.result }}"
echo "::set-output name=mmtk_ref::${{ steps.core-ref.outputs.result }}"
echo "mmtk_repo=${{ steps.core-repo.outputs.result }}" >> $GITHUB_OUTPUT
echo "mmtk_ref=${{ steps.core-ref.outputs.result }}" >> $GITHUB_OUTPUT
# Run perf compare for JikesRVM
jikesrvm-perf-compare:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/perf-regression-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
sed -i 's/^#[[:space:]]mmtk/mmtk/g' mmtk-jikesrvm/mmtk/Cargo.toml
- id: branch
# we cannot use env vars in action input (the deploy step). So put the env var to this step's outputs.
run: echo "::set-output name=branch_name::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')"
run: echo "branch_name=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_OUTPUT
# run
- name: Performance Run
run: |
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:
sed -i 's/^#[[:space:]]mmtk/mmtk/g' mmtk-openjdk/mmtk/Cargo.toml
- id: branch
# we cannot use env vars in action input (the deploy step). So put the env var to this step's outputs.
run: echo "::set-output name=branch_name::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')"
run: echo "branch_name=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_OUTPUT
# run
- name: Performance Run
run: |
Expand Down Expand Up @@ -207,7 +207,7 @@ jobs:
rm -rf mmtk-openjdk/repos/openjdk/build
- id: branch
# we cannot use env vars in action input (the deploy step). So put the env var to this step's outputs.
run: echo "::set-output name=branch_name::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')"
run: echo "branch_name=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_OUTPUT
- name: Setup
run: |
./ci-perf-kit/scripts/history-run-setup.sh
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/pr-binding-refs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ jobs:
default_env: 'OPENJDK_BINDING_REPO=mmtk/mmtk-openjdk,OPENJDK_BINDING_REF=master,JIKESRVM_BINDING_REPO=mmtk/mmtk-jikesrvm,JIKESRVM_BINDING_REF=master,V8_BINDING_REPO=mmtk/mmtk-v8,V8_BINDING_REF=master,JULIA_BINDING_REPO=mmtk/mmtk-julia,JULIA_BINDING_REF=master,RUBY_BINDING_REPO=mmtk/mmtk-ruby,RUBY_BINDING_REF=master'
- id: print
run: |
echo "::set-output name=openjdk_binding_repo::${{ env.OPENJDK_BINDING_REPO }}"
echo "::set-output name=openjdk_binding_ref::${{ env.OPENJDK_BINDING_REF }}"
echo "::set-output name=jikesrvm_binding_repo::${{ env.JIKESRVM_BINDING_REPO }}"
echo "::set-output name=jikesrvm_binding_ref::${{ env.JIKESRVM_BINDING_REF }}"
echo "::set-output name=v8_binding_repo::${{ env.V8_BINDING_REPO }}"
echo "::set-output name=v8_binding_ref::${{ env.V8_BINDING_REF }}"
echo "::set-output name=julia_binding_repo::${{ env.JULIA_BINDING_REPO }}"
echo "::set-output name=julia_binding_ref::${{ env.JULIA_BINDING_REF }}"
echo "::set-output name=ruby_binding_repo::${{ env.RUBY_BINDING_REPO }}"
echo "::set-output name=ruby_binding_ref::${{ env.RUBY_BINDING_REF }}"
echo "openjdk_binding_repo=${{ env.OPENJDK_BINDING_REPO }}" >> $GITHUB_OUTPUT
echo "openjdk_binding_ref=${{ env.OPENJDK_BINDING_REF }}" >> $GITHUB_OUTPUT
echo "jikesrvm_binding_repo=${{ env.JIKESRVM_BINDING_REPO }}" >> $GITHUB_OUTPUT
echo "jikesrvm_binding_ref=${{ env.JIKESRVM_BINDING_REF }}" >> $GITHUB_OUTPUT
echo "v8_binding_repo=${{ env.V8_BINDING_REPO }}" >> $GITHUB_OUTPUT
echo "v8_binding_ref=${{ env.V8_BINDING_REF }}" >> $GITHUB_OUTPUT
echo "julia_binding_repo=${{ env.JULIA_BINDING_REPO }}" >> $GITHUB_OUTPUT
echo "julia_binding_ref=${{ env.JULIA_BINDING_REF }}" >> $GITHUB_OUTPUT
echo "ruby_binding_repo=${{ env.RUBY_BINDING_REPO }}" >> $GITHUB_OUTPUT
echo "ruby_binding_ref=${{ env.RUBY_BINDING_REF }}" >> $GITHUB_OUTPUT
2 changes: 1 addition & 1 deletion .github/workflows/pre-review-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
export MSRV=`cargo read-manifest | python -c 'import json,sys; print(json.load(sys.stdin)["rust_version"])'`
export TEST=`cat rust-toolchain`
echo "::set-output name=array::[\"$MSRV\", \"$TEST\", \"stable\"]"
echo "array=[\"$MSRV\", \"$TEST\", \"stable\"]" >> $GITHUB_OUTPUT
pre-code-review-checks:
needs: setup-test-matrix
Expand Down
2 changes: 1 addition & 1 deletion macros/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn get_field_attribute<'f>(field: &'f Field, attr_name: &str) -> Option<&'f
abort! { second_attr.path().span(), "Duplicated attribute: #[{}]", attr_name }
};

attrs.get(0).cloned()
attrs.first().cloned()
}

pub fn get_fields_with_attribute<'f>(fields: &'f FieldsNamed, attr_name: &str) -> Vec<&'f Field> {
Expand Down
1 change: 0 additions & 1 deletion src/policy/marksweepspace/malloc_ms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ mod global;
mod metadata;

pub use global::*;
pub use metadata::*;
46 changes: 23 additions & 23 deletions src/util/rust_util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,29 @@ impl<T> std::ops::Deref for InitializeOnce<T> {

unsafe impl<T> Sync for InitializeOnce<T> {}

/// This implements `std::array::from_fn` introduced in Rust 1.63.
/// We should replace this with the standard counterpart after bumping MSRV,
/// but we also need to evaluate whether it would use too much stack space (see code comments).
pub(crate) fn array_from_fn<T, const N: usize, F>(mut cb: F) -> [T; N]
where
F: FnMut(usize) -> T,
{
// Note on unsafety: An alternative to the unsafe implementation below is creating a fixed
// array of `[0, 1, 2, ..., N-1]` and using the `.map(cb)` method to create the result.
// However, the `array::map` method implemented in the standard library consumes a surprisingly
// large amount of stack space. For VMs that run on confined stacks, such as JikesRVM, that
// would cause stack overflow. Therefore we implement it manually using unsafe primitives.
let mut result_array: MaybeUninit<[T; N]> = MaybeUninit::zeroed();
let array_ptr = result_array.as_mut_ptr();
for index in 0..N {
let item = cb(index);
unsafe {
std::ptr::addr_of_mut!((*array_ptr)[index]).write(item);
}
}
unsafe { result_array.assume_init() }
}

#[cfg(test)]
mod initialize_once_tests {
use super::*;
Expand Down Expand Up @@ -138,26 +161,3 @@ mod initialize_once_tests {
assert_eq!(INITIALIZE_COUNT.load(Ordering::SeqCst), 1);
}
}

/// This implements `std::array::from_fn` introduced in Rust 1.63.
/// We should replace this with the standard counterpart after bumping MSRV,
/// but we also need to evaluate whether it would use too much stack space (see code comments).
pub(crate) fn array_from_fn<T, const N: usize, F>(mut cb: F) -> [T; N]
where
F: FnMut(usize) -> T,
{
// Note on unsafety: An alternative to the unsafe implementation below is creating a fixed
// array of `[0, 1, 2, ..., N-1]` and using the `.map(cb)` method to create the result.
// However, the `array::map` method implemented in the standard library consumes a surprisingly
// large amount of stack space. For VMs that run on confined stacks, such as JikesRVM, that
// would cause stack overflow. Therefore we implement it manually using unsafe primitives.
let mut result_array: MaybeUninit<[T; N]> = MaybeUninit::zeroed();
let array_ptr = result_array.as_mut_ptr();
for index in 0..N {
let item = cb(index);
unsafe {
std::ptr::addr_of_mut!((*array_ptr)[index]).write(item);
}
}
unsafe { result_array.assume_init() }
}
1 change: 0 additions & 1 deletion src/util/statistics/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub use self::counter::Counter;
pub use self::counter::Timer;

pub mod counter;
Expand Down

0 comments on commit e7143b9

Please sign in to comment.