-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: fix test failures on Windows #175
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,97 @@ | ||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
name: Bot | ||
|
||
jobs: | ||
pr_pre_comment: | ||
# This job only runs for pull request comments | ||
name: Comment before taking snapshots | ||
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/snapshot' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: "Start taking snapshots for this pull request.\n" + | ||
`https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` | ||
}); | ||
pr_snapshot: | ||
# This job only runs for pull request comments | ||
name: Generate a snapshot | ||
needs: [pr_pre_comment] | ||
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/snapshot' }} | ||
strategy: | ||
# Do not run in parallel because we may create a new commit | ||
max-parallel: 1 | ||
matrix: | ||
name: [windows, linux] | ||
include: | ||
- name: windows | ||
os: windows-2022 | ||
- name: linux | ||
os: ubuntu-latest | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
# Set TRYCMD=overwrite to update snapshot | ||
TRYCMD: overwrite | ||
steps: | ||
- uses: actions/github-script@v6 | ||
id: target-branch | ||
with: | ||
result-encoding: string | ||
script: | | ||
const pull_request = await github.rest.pulls.get({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: context.issue.number | ||
}); | ||
return pull_request.data.head.ref; | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ steps.target-branch.outputs.result }} | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
components: rustfmt, clippy | ||
# Pinned to the commit hash of v2.2.1 | ||
- uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f | ||
with: | ||
shared-key: pr-snapshot-commented-${{ matrix.name }} | ||
- uses: actions-rs/cargo@v1 | ||
# Generate new snapshots | ||
with: | ||
command: test | ||
args: cli_tests | ||
- if: matrix.name == 'linux' | ||
run: | | ||
git config user.name "github-actions[bot]" | ||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git commit -am "test: update snapshot for ${{ matrix.name }}" || true | ||
git push || true | ||
- if: matrix.name == 'windows' | ||
run: | | ||
git config user.name "github-actions[bot]" | ||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git commit -am "test: update snapshot for ${{ matrix.name }}" | ||
git push | ||
pr_post_comment: | ||
# This job only runs for pull request comments | ||
name: Comment after taking snapshots | ||
needs: [pr_snapshot] | ||
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/snapshot' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'Taking snapshots has been completed.' | ||
}); |
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we use windows-2022 rather than windows-latest? As I can see,
.github/workflows/bot.yml
use windows-latest also other platform use-latest
as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for mentioning it. Because I believe that a stable binary generation is preferable, I specify
windows-2022
instead ofwindows-latest
. However, I did not notice that other platforms use the latest version. It seems that changing tolatest
is preferable for unification. Thus, I modified it aswindow-latest
. I have created an issue to discuss the preferable version to support at #186.On the other hand, I do not have a good reason for using
windows-latest
inbot.yml
. Do you have any opinion regardingbot.yml
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my opinion, we need to unify image on all of workflow. Because, the snapshot is actually not to relate building binary itself but if the image is different we are hard to identify the cause when any issue occur.
So would you mind if we use
windows-2022
instead ofwindows-latest
on other workflow for now and will discuss it on the issue?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I think your opinion makes sense. Due to the scope of this PR, I changed
os
towindows-2022
for both CI and bots for the Windows platform. Let's discuss this within #186 about other platforms.