Skip to content

Commit

Permalink
Use vita-rust-bot to create pull requests (#23)
Browse files Browse the repository at this point in the history
* Use vita-rust-bot to create pull requests

* Update all actions
  • Loading branch information
pheki authored Feb 25, 2024
1 parent defe3aa commit f020804
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 121 deletions.
111 changes: 4 additions & 107 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
branches:
- main
pull_request:
workflow_dispatch:

env:
# If you update LLVM_VERSION, remember to also update `update-bindings.yml`
Expand All @@ -24,15 +23,7 @@ jobs:
needs: install-vitasdk
timeout-minutes: 20
steps:
- name: Set commit status as pending
uses: myrotvorets/set-commit-status-action@v1.1.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
context: Build example
sha: ${{ github.sha }}

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Restore vitasdk cache
uses: actions/cache/restore@v3
Expand Down Expand Up @@ -95,33 +86,16 @@ jobs:
path: target/armv7-sony-vita-newlibeabihf/release/std-hello-world.*
if-no-files-found: error

- name: Set final commit status
uses: myrotvorets/set-commit-status-action@v1.1.7
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
context: Build example
sha: ${{ github.sha }}

clippy:
name: Clippy
runs-on: ubuntu-latest
needs: install-vitasdk
timeout-minutes: 10
steps:
- name: Set commit status as pending
uses: myrotvorets/set-commit-status-action@v1.1.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
context: Clippy
sha: ${{ github.sha }}

- uses: actions/checkout@v3

- name: Restore vitasdk cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: /opt/vitasdk
key: ${{ runner.os }}-vitasdk
Expand All @@ -140,28 +114,11 @@ jobs:
run: |
cargo clippy --tests --workspace -- -Dclippy::all -Dwarnings
- name: Set final commit status
uses: myrotvorets/set-commit-status-action@v1.1.7
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
context: Clippy
sha: ${{ github.sha }}

rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Set commit status as pending
uses: myrotvorets/set-commit-status-action@v1.1.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
context: Rustfmt
sha: ${{ github.sha }}

- uses: actions/checkout@v3

- uses: actions-rs/toolchain@v1
Expand All @@ -175,33 +132,16 @@ jobs:
run: |
cargo fmt --check --all
- name: Set final commit status
uses: myrotvorets/set-commit-status-action@v1.1.7
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
context: Rustfmt
sha: ${{ github.sha }}


missing-libs:
name: Check missing libs
runs-on: ubuntu-latest
needs: install-vitasdk
timeout-minutes: 10
steps:
- name: Set commit status as pending
uses: myrotvorets/set-commit-status-action@v1.1.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
context: Check missing libs
sha: ${{ github.sha }}

- uses: actions/checkout@v3
with:
submodules: true

- name: Restore vitasdk cache
uses: actions/cache/restore@v3
with:
Expand Down Expand Up @@ -236,30 +176,13 @@ jobs:
run: |
cargo run --profile build-util -p vitasdk-sys-build-util -- stub-libs --missing-libs --fail-if-any
- name: Set final commit status
uses: myrotvorets/set-commit-status-action@v1.1.7
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
context: Check missing libs
sha: ${{ github.sha }}

# Checks if there's no diff when regenerating bindings
check-bindings:
name: Check bindings
runs-on: ubuntu-latest
needs: install-vitasdk
timeout-minutes: 10
steps:
- name: Set commit status as pending
uses: myrotvorets/set-commit-status-action@v1.1.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
context: Check bindings
sha: ${{ github.sha }}

- uses: actions/checkout@v3
with:
submodules: true
Expand Down Expand Up @@ -304,31 +227,14 @@ jobs:
run: |
git add . && git diff --quiet && git diff --cached --quiet
- name: Set final commit status
uses: myrotvorets/set-commit-status-action@v1.1.7
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
context: Check bindings
sha: ${{ github.sha }}

doc:
name: Doc
runs-on: ubuntu-latest
timeout-minutes: 30
env:
RUSTDOCFLAGS: -D warnings
steps:
- name: Set commit status as pending
uses: myrotvorets/set-commit-status-action@v1.1.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
context: Doc
sha: ${{ github.sha }}

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
with:
Expand All @@ -339,12 +245,3 @@ jobs:

- name: Run cargo doc
run: DOCS_RS=1 RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --target armv7-sony-vita-newlibeabihf -Z build-std

- name: Set final commit status
uses: myrotvorets/set-commit-status-action@v1.1.7
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
context: Doc
sha: ${{ github.sha }}
4 changes: 2 additions & 2 deletions .github/workflows/setup-vitasdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:
steps:
- name: Cache vitasdk
id: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ inputs.path }}
# Don't really know a good key to use here, but the cache will be
# deleted automatically if it's not used for a week.
key: ${{ runner.os }}-vitasdk

- name: Checkout VPDM
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: vitasdk/vdpm

Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/update-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ jobs:
runs-on: ubuntu-latest
needs: install-vitasdk
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- name: Restore vitasdk cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: /opt/vitasdk
key: ${{ runner.os }}-vitasdk
fail-on-cache-miss: true

- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
${{ runner.temp }}/llvm
Expand All @@ -49,7 +49,7 @@ jobs:
cached: ${{ steps.cache-llvm.outputs.cache-hit }}

- name: Cache build-util dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
Expand Down Expand Up @@ -80,10 +80,18 @@ jobs:
run: |
cargo run --profile build-util -p vitasdk-sys-build-util -- bindgen
- name: Generate GitHub token
uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Commit and create pull request
id: create-pull-request
uses: peter-evans/create-pull-request@v5
uses: peter-evans/create-pull-request@v6
with:
token: ${{ steps.generate-token.outputs.token }}
title: Update vita-headers bindings
body: Created by the action at [.github/workflows/update-bindings.yml](../tree/main/.github/workflows/update-bindings.yml)
branch: ${{ env.PR_BRANCH }}
Expand All @@ -92,10 +100,3 @@ jobs:
assignees: pheki,ZetaNumbers
committer: Aphek <bilkow@tutanota.com>
author: Aphek <bilkow@tutanota.com>

- name: Trigger build
env:
# Required by Github CLI (`gh`)
GH_TOKEN: ${{ github.token }}
run: |
gh workflow run build.yml --ref ${{ env.PR_BRANCH }}

0 comments on commit f020804

Please sign in to comment.