Add compat frontend CLI binary and release workflow #2
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| pull_request: | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_TARGET_DIR: target | |
| PD_BUILD_GIT_TAG: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'untagged' }} | |
| PD_BUILD_GIT_COMMIT: ${{ github.sha }} | |
| PD_BUILD_GIT_DIRTY: "false" | |
| jobs: | |
| rust: | |
| name: Rust lint and tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: rustscript-compat-frontends | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: rustscript-lang/rustscript | |
| path: rustscript | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: rustscript-lang/pd-edge | |
| path: pd-edge | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - name: Format check | |
| working-directory: rustscript-compat-frontends | |
| run: cargo fmt --all -- --check | |
| - name: Clippy | |
| working-directory: rustscript-compat-frontends | |
| run: cargo clippy --all-targets -- -D warnings | |
| - name: Tests | |
| working-directory: rustscript-compat-frontends | |
| run: cargo test --workspace --jobs 4 | |
| - name: CLI smoke | |
| working-directory: rustscript-compat-frontends | |
| run: | | |
| cargo run --bin pd-vm-compat-run -- examples/example.js | |
| cargo run --bin pd-vm-compat-run -- examples/example.lua | |
| cargo run --bin pd-vm-compat-run -- --version | |
| binaries: | |
| name: pd-vm-compat-run (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: rustscript-compat-frontends | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: rustscript-lang/rustscript | |
| path: rustscript | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: rustscript-lang/pd-edge | |
| path: pd-edge | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Build pd-vm-compat-run | |
| working-directory: rustscript-compat-frontends | |
| run: cargo build --bin pd-vm-compat-run --release | |
| - name: Stage pd-vm-compat-run artifact | |
| shell: bash | |
| working-directory: rustscript-compat-frontends | |
| run: | | |
| mkdir -p dist | |
| suffix="" | |
| if [[ "${{ runner.os }}" == "Windows" ]]; then suffix=".exe"; fi | |
| cp "target/release/pd-vm-compat-run${suffix}" "dist/pd-vm-compat-run-${{ runner.os }}-${{ runner.arch }}${suffix}" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: pd-vm-compat-run-${{ runner.os }}-${{ runner.arch }} | |
| path: rustscript-compat-frontends/dist/* | |
| - name: Upload pd-vm-compat-run release asset | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: rustscript-compat-frontends/dist/* |