| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| name: build-branch |
| on: |
| - push |
| - pull_request |
| jobs: |
| build: |
| name: compile |
| runs-on: ubuntu-18.04 |
| strategy: |
| matrix: |
| java: [ 8, 11 ] |
| fail-fast: false |
| steps: |
| - name: Checkout project |
| uses: actions/checkout@v2 |
| - name: Cache for maven dependencies |
| uses: actions/cache@v2 |
| with: |
| path: ~/.m2/repository |
| key: maven-repo-${{ hashFiles('**/pom.xml') }}-${{ github.job }} |
| restore-keys: | |
| maven-repo-${{ hashFiles('**/pom.xml') }} |
| maven-repo- |
| - name: Setup java |
| uses: actions/setup-java@v1 |
| with: |
| java-version: ${{ matrix.java }} |
| - name: Run a full build |
| run: ./dev-support/checks/build.sh |
| - name: Delete temporary build artifacts |
| run: rm -rf ~/.m2/repository/org/apache/ratis |
| if: always() |
| rat: |
| name: rat |
| runs-on: ubuntu-18.04 |
| steps: |
| - uses: actions/checkout@master |
| - name: Cache for maven dependencies |
| uses: actions/cache@v2 |
| with: |
| path: ~/.m2/repository |
| key: maven-repo-${{ hashFiles('**/pom.xml') }}-${{ github.job }} |
| restore-keys: | |
| maven-repo-${{ hashFiles('**/pom.xml') }} |
| maven-repo- |
| - run: ./dev-support/checks/rat.sh |
| - uses: actions/upload-artifact@master |
| if: always() |
| with: |
| name: rat |
| path: target/rat |
| - name: Delete temporary build artifacts |
| run: rm -rf ~/.m2/repository/org/apache/ratis |
| if: always() |
| author: |
| name: author |
| runs-on: ubuntu-18.04 |
| steps: |
| - uses: actions/checkout@master |
| - run: ./dev-support/checks/author.sh |
| - uses: actions/upload-artifact@master |
| if: always() |
| with: |
| name: author |
| path: target/author |
| unit: |
| name: unit |
| runs-on: ubuntu-18.04 |
| strategy: |
| matrix: |
| profile: |
| - grpc |
| - server |
| - misc |
| fail-fast: ${{ github.event_name == 'pull_request' }} |
| steps: |
| # TEMPORARY WHILE GITHUB FIXES https://github.com/actions/virtual-environments/issues/3185 |
| - name: Add the current IP address, long hostname and short hostname record to /etc/hosts file |
| run: | |
| echo -e "$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)\t$(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts |
| # REMOVE CODE ABOVE WHEN ISSUE IS ADDRESSED! |
| - uses: actions/checkout@master |
| - name: Cache for maven dependencies |
| uses: actions/cache@v2 |
| with: |
| path: ~/.m2/repository |
| key: maven-repo-${{ hashFiles('**/pom.xml') }}-${{ github.job }} |
| restore-keys: | |
| maven-repo-${{ hashFiles('**/pom.xml') }} |
| maven-repo- |
| - run: ./dev-support/checks/unit.sh -P${{ matrix.profile }}-tests |
| - name: Summary of failures |
| run: cat target/${{ github.job }}/summary.txt |
| if: ${{ !cancelled() }} |
| - uses: actions/upload-artifact@master |
| if: ${{ !cancelled() }} |
| with: |
| name: unit-${{ matrix.profile }} |
| path: target/unit |
| - name: Delete temporary build artifacts |
| run: rm -rf ~/.m2/repository/org/apache/ratis |
| if: always() |
| checkstyle: |
| name: checkstyle |
| runs-on: ubuntu-18.04 |
| steps: |
| - uses: actions/checkout@master |
| - name: Cache for maven dependencies |
| uses: actions/cache@v2 |
| with: |
| path: ~/.m2/repository |
| key: maven-repo-${{ hashFiles('**/pom.xml') }}-${{ github.job }} |
| restore-keys: | |
| maven-repo-${{ hashFiles('**/pom.xml') }} |
| maven-repo- |
| - run: ./dev-support/checks/checkstyle.sh |
| - uses: actions/upload-artifact@master |
| if: always() |
| with: |
| name: checkstyle |
| path: target/checkstyle |
| - name: Delete temporary build artifacts |
| run: rm -rf ~/.m2/repository/org/apache/ratis |
| if: always() |
| findbugs: |
| name: findbugs |
| runs-on: ubuntu-18.04 |
| steps: |
| - uses: actions/checkout@master |
| - name: Cache for maven dependencies |
| uses: actions/cache@v2 |
| with: |
| path: ~/.m2/repository |
| key: maven-repo-${{ hashFiles('**/pom.xml') }}-${{ github.job }} |
| restore-keys: | |
| maven-repo-${{ hashFiles('**/pom.xml') }} |
| maven-repo- |
| - run: ./dev-support/checks/findbugs.sh |
| - uses: actions/upload-artifact@master |
| if: always() |
| with: |
| name: findbugs |
| path: target/findbugs |
| - name: Delete temporary build artifacts |
| run: rm -rf ~/.m2/repository/org/apache/ratis |
| if: always() |
| sonar: |
| name: sonar |
| runs-on: ubuntu-18.04 |
| if: (github.repository == 'apache/ratis' || github.repository == 'apache/incubator-ratis') && github.event_name != 'pull_request' |
| steps: |
| - uses: actions/checkout@master |
| - name: Cache for maven dependencies |
| uses: actions/cache@v2 |
| with: |
| path: ~/.m2/repository |
| key: maven-repo-${{ hashFiles('**/pom.xml') }}-${{ github.job }} |
| restore-keys: | |
| maven-repo-${{ hashFiles('**/pom.xml') }} |
| maven-repo- |
| - name: Setup java 11 |
| uses: actions/setup-java@v1 |
| with: |
| java-version: 11 |
| - run: ./dev-support/checks/sonar.sh |
| env: |
| SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| - name: Delete temporary build artifacts |
| run: rm -rf ~/.m2/repository/org/apache/ratis |
| if: always() |