Create CodeQL demo with reusable workflow supporting query pack suggestions and flexible build modes #5
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: 'Continuous Integration' | |
| # Simple CI workflow to build and test the Java application | |
| # This runs independently of CodeQL analysis | |
| on: | |
| push: | |
| branches: [ "main", "develop" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| build-and-test: | |
| name: 'Build and Test' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 'Checkout code' | |
| uses: actions/checkout@v4 | |
| - name: 'Set up Java 11' | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: 'Build application' | |
| run: | | |
| mvn clean compile | |
| echo "✅ Application built successfully" | |
| - name: 'Run basic validation' | |
| run: | | |
| # Check that main classes were compiled | |
| if [ -f "target/classes/com/example/demo/DemoApplication.class" ]; then | |
| echo "✅ Main application class compiled" | |
| else | |
| echo "❌ Main application class not found" | |
| exit 1 | |
| fi | |
| if [ -f "target/classes/com/example/demo/VulnerableController.class" ]; then | |
| echo "✅ Vulnerable controller compiled (contains security issues for demo)" | |
| else | |
| echo "❌ Vulnerable controller not found" | |
| exit 1 | |
| fi | |
| - name: 'Run tests' | |
| run: | | |
| mvn test | |
| echo "✅ Tests completed successfully" | |
| - name: 'Package application' | |
| run: | | |
| mvn package -DskipTests | |
| echo "✅ Application packaged successfully" |