created avro data contracts for alert, common and trade #1
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: Maven CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'temurin' | |
| - name: Install Maven | |
| run: sudo apt-get update && sudo apt-get install -y maven | |
| - name: Configure Maven settings | |
| run: | | |
| mkdir -p ~/.m2 | |
| echo "<settings> | |
| <servers> | |
| <server> | |
| <id>github</id> | |
| <username>${{ github.actor }}</username> | |
| <password>${{ secrets.GITHUB_TOKEN }}</password> | |
| </server> | |
| </servers> | |
| </settings>" > ~/.m2/settings.xml | |
| - name: Build with Maven (skip tests) | |
| run: mvn -B clean package -DskipTests -Dmaven.test.skip=true --file pom.xml | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: target/*.jar | |
| generate-docs: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'temurin' | |
| - name: Install Maven | |
| run: sudo apt-get update && sudo apt-get install -y maven | |
| - name: Generate sources from Avro schema | |
| run: mvn clean install -DskipTests | |
| - name: Generate Javadocs | |
| run: mvn javadoc:javadoc | |
| - name: Upload Javadocs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: javadocs | |
| path: target/site/apidocs/ | |
| deploy-docs: | |
| runs-on: ubuntu-latest | |
| needs: generate-docs | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "actions@github.com" | |
| - name: Setup gh-pages branch | |
| run: | | |
| # Check if the gh-pages branch exists | |
| if git ls-remote --exit-code --heads origin gh-pages; then | |
| # If the branch exists, create a new orphan branch temporarily | |
| git checkout --orphan temp-gh-pages | |
| git rm -rf . | |
| else | |
| # If the branch does not exist, create it as an orphan branch | |
| git checkout --orphan gh-pages | |
| git rm -rf . | |
| fi | |
| - name: Download Javadocs | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: javadocs | |
| path: . | |
| - name: Commit and push to gh-pages | |
| run: | | |
| git add . | |
| git commit -m "Deploy Javadocs for ${{ github.sha }}" || echo "No changes to commit" | |
| if git ls-remote --exit-code --heads origin gh-pages; then | |
| git push --force origin HEAD:gh-pages | |
| else | |
| git push origin HEAD:gh-pages | |
| fi | |
| deploy-package: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| permissions: | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'temurin' | |
| - name: Install Maven | |
| run: sudo apt-get update && sudo apt-get install -y maven | |
| - name: Clear local Maven repository | |
| run: rm -rf ~/.m2/repository/com/codedstreams/ | |
| - name: Publish to GitHub Packages | |
| run: mvn deploy | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |