modern-sjtu-thesis:0.1.0 #112
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
name: Test PR | |
on: | |
pull_request: {} | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Extract package names and versions from changed files | |
id: extract_package | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const { data: files } = await github.rest.pulls.listFiles({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.payload.pull_request.number, | |
}); | |
const packages = new Set(); | |
files.forEach(file => { | |
const match = file.filename.match(/^packages\/preview\/([^\/]+)\/([^\/]+)\//); | |
if (match) { | |
packages.add(`${match[1]}/${match[2]}`); | |
} | |
}); | |
let sparseCheckoutPaths; | |
if (packages.size === 0) { | |
sparseCheckoutPaths = "packages/"; | |
} else { | |
sparseCheckoutPaths = Array.from(packages).map(pkg => `packages/preview/${pkg}/`).join('\n'); | |
} | |
core.setOutput('sparse_checkout_paths', sparseCheckoutPaths); | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
${{ steps.extract_package.outputs.sparse_checkout_paths }} | |
bundler/ | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: bundler | |
- name: Build bundler | |
run: cargo build --release --manifest-path bundler/Cargo.toml | |
- name: Test packaging | |
run: bundler/target/release/bundler |