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: Build and Run Java Files | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| jobs: | |
| build-and-run: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Set up Java | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Compile and copy resources | |
| run: | | |
| mkdir -p out/src | |
| javac -d out/src src/*.java | |
| cp src/resources/*.txt out/src || echo "No resource files found." | |
| - name: Set up Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '16' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Run Java files & produce summary | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const { execSync } = require('child_process'); | |
| // Just call your local `scripts/run.js` | |
| execSync('node scripts/run.js', { stdio: 'inherit' }); |