Skip to content

Commit

Permalink
Merge branch 'main' into fix-winit-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-blackbird committed Feb 5, 2023
2 parents 1e7c335 + e1b0bbf commit 1a2657e
Show file tree
Hide file tree
Showing 150 changed files with 4,726 additions and 1,391 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/action-on-PR-labeled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Action on PR labeled

# This workflow has write permissions on the repo
# It must not checkout a PR and run untrusted code

on:
pull_request_target:
types:
- labeled

permissions:
pull-requests: 'write'

jobs:
comment-on-breaking-change-label:
runs-on: ubuntu-latest
if: github.event.label.name == 'C-Breaking-Change' && !contains(github.event.pull_request.body, '## Migration Guide')
steps:
- uses: actions/github-script@v6
with:
script: |
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `It looks like your PR is a breaking change, but you didn't provide a migration guide.
Could you add some context on what users should update when this change get released in a new version of Bevy?
It will be used to help writing the migration guide for the version. Putting it after a \`## Migration Guide\` will help it get automatically picked up by our tooling.`
})
170 changes: 170 additions & 0 deletions .github/workflows/ci-comment-failures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
name: CI - PR Comments

# This workflow has write permissions on the repo
# It must not checkout a PR and run untrusted code

# Also requesting write permissions on PR to be able to comment
permissions:
pull-requests: 'write'

on:
workflow_run:
workflows: ["CI"]
types:
- completed

jobs:
example-run:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'failure'
steps:
- name: 'Download artifact'
id: find-artifact
uses: actions/github-script@v6
with:
result-encoding: string
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifacts = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "example-run"
});
if (matchArtifacts.length == 0) { return "false" }
var matchArtifact = matchArtifacts[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/example-run.zip', Buffer.from(download.data));
return "true"
- run: unzip example-run.zip
if: ${{ steps.find-artifact.outputs.result == 'true' }}
- name: 'Comment on PR'
if: ${{ steps.find-artifact.outputs.result == 'true' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
var issue_number = Number(fs.readFileSync('./NR'));
var last_example_run = fs.readFileSync('./last_example_run');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: 'Example `' + last_example_run + '` failed to run, please try running it locally and check the result.'
});
missing-examples:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'failure'
steps:
- name: 'Download artifact'
id: find-artifact
uses: actions/github-script@v6
with:
result-encoding: string
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifacts = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "missing-examples"
});
if (matchArtifacts.length == 0) { return "false" }
var matchArtifact = matchArtifacts[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/missing-examples.zip', Buffer.from(download.data));
return "true"
- run: unzip missing-examples.zip
if: ${{ steps.find-artifact.outputs.result == 'true' }}
- name: 'Comment on PR'
if: ${{ steps.find-artifact.outputs.result == 'true' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
var issue_number = Number(fs.readFileSync('./NR'));
if (fs.existsSync('./missing-metadata')) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: 'You added a new example but didn\'t add metadata for it. Please update the root Cargo.toml file.'
});
}
if (fs.existsSync('./missing-update')) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: 'You added a new example but didn\'t update the readme. Please run `cargo run -p build-example-pages -- update` to update it, and commit the file change.'
});
}
msrv:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'failure'
steps:
- name: 'Download artifact'
id: find-artifact
uses: actions/github-script@v6
with:
result-encoding: string
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifacts = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "msrv"
});
if (matchArtifacts.length == 0) { return "false" }
var matchArtifact = matchArtifacts[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/msrv.zip', Buffer.from(download.data));
return "true"
- run: unzip msrv.zip
if: ${{ steps.find-artifact.outputs.result == 'true' }}
- name: 'Comment on PR'
if: ${{ steps.find-artifact.outputs.result == 'true' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
var issue_number = Number(fs.readFileSync('./NR'));
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: 'Your PR increases Bevy Minimum Supported Rust Version. Please update the `rust-version` field in the root Cargo.toml file.'
});
68 changes: 55 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
Expand All @@ -41,6 +42,7 @@ jobs:

ci:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
Expand Down Expand Up @@ -96,6 +98,7 @@ jobs:

check-compiles:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: ci
steps:
- uses: actions/checkout@v3
Expand All @@ -113,7 +116,6 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Check Compile
Expand All @@ -122,6 +124,7 @@ jobs:

build-wasm:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: build
steps:
- uses: actions/checkout@v3
Expand All @@ -142,7 +145,8 @@ jobs:

markdownlint:
runs-on: ubuntu-latest
needs: check-examples-readme-update-needed
timeout-minutes: 30
needs: check-missing-examples-in-docs
if: always()
steps:
- uses: actions/checkout@v3
Expand All @@ -156,8 +160,6 @@ jobs:
VALIDATE_ALL_CODEBASE: false
VALIDATE_MARKDOWN: true
DEFAULT_BRANCH: main
# Not needed here as only one Linter is used.
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

run-examples:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -193,6 +195,7 @@ jobs:
run: |
for example in .github/example-run/*.ron; do
example_name=`basename $example .ron`
echo -n $example_name > last_example_run
echo "running $example_name - "`date`
time TRACE_CHROME=trace-$example_name.json CI_TESTING_CONFIG=$example xvfb-run cargo run --example $example_name --features "bevy_ci_testing,trace,trace_chrome"
sleep 10
Expand All @@ -203,12 +206,24 @@ jobs:
with:
name: example-traces.zip
path: traces.zip
- name: Save PR number
if: ${{ failure() && github.event_name == 'pull_request' }}
run: |
mkdir -p ./example-run
echo ${{ github.event.number }} > ./example-run/NR
mv last_example_run ./example-run/
- uses: actions/upload-artifact@v2
if: ${{ failure() && github.event_name == 'pull_request' }}
with:
name: example-run
path: example-run/

check-doc:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
Expand Down Expand Up @@ -237,24 +252,40 @@ jobs:

check-missing-examples-in-docs:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- run: cargo run -p build-example-pages -- check-missing

check-examples-readme-update-needed:
needs: check-missing-examples-in-docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: cargo run -p build-example-pages -- update
- name: check for missing metadata
id: missing-metadata
run: cargo run -p build-example-pages -- check-missing
- name: check for missing update
id: missing-update
run: cargo run -p build-example-pages -- update
- name: Check for modified files
run: |
echo "if this step fails, run the following command and commit the changed file on your PR."
echo " > cargo run -p build-example-pages -- update"
git diff --quiet HEAD --
- name: Save PR number
if: ${{ failure() && github.event_name == 'pull_request' }}
run: |
mkdir -p ./missing-examples
echo ${{ github.event.number }} > ./missing-examples/NR
- name: log failed task - missing metadata
if: ${{ failure() && github.event_name == 'pull_request' && steps.missing-metadata.conclusion == 'failure' }}
run: touch ./missing-examples/missing-metadata
- name: log failed task - missing update
if: ${{ failure() && github.event_name == 'pull_request' && steps.missing-update.conclusion == 'failure' }}
run: touch ./missing-examples/missing-update
- uses: actions/upload-artifact@v2
if: ${{ failure() && github.event_name == 'pull_request' }}
with:
name: missing-examples
path: missing-examples/

check-unused-dependencies:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
Expand All @@ -278,6 +309,7 @@ jobs:

msrv:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: build
steps:
- uses: actions/checkout@v3
Expand All @@ -301,3 +333,13 @@ jobs:
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Run cargo check
run: cargo check
- name: Save PR number
if: ${{ failure() && github.event_name == 'pull_request' }}
run: |
mkdir -p ./msrv
echo ${{ github.event.number }} > ./msrv/NR
- uses: actions/upload-artifact@v2
if: ${{ failure() && github.event_name == 'pull_request' }}
with:
name: msrv
path: msrv/
1 change: 0 additions & 1 deletion .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ jobs:
--exclude ci \
--exclude errors \
--exclude bevy-ios-example \
--exclude spancmp \
--exclude build-wasm-example
- name: Create PR
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ jobs:
--exclude ci \
--exclude errors \
--exclude bevy-ios-example \
--exclude spancmp \
--exclude build-wasm-example
- name: Create PR
Expand Down
Loading

0 comments on commit 1a2657e

Please sign in to comment.