Skip to content

Update build with last travis build plus github build #25

Update build with last travis build plus github build

Update build with last travis build plus github build #25

Workflow file for this run

name: vertx-parent
on:
push:
pull_request:
workflow_dispatch:
jobs:
test:
name: Test
runs-on: ubuntu-20.04
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
project_id: ${{ secrets.WORKLOAD_IDENTITY_PROJECT }}
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
create_credentials_file: true
export_environment_variables: true
cleanup_credentials: true
- name: Set up OAuth2 access token for Maven
run: |
echo "ACCESS_TOKEN=$(gcloud auth print-access-token)" >> $GITHUB_ENV
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Copy Maven settings
run: |
mkdir -p ~/.m2
cp ./travis/actions-maven-settings.xml $HOME/.m2/settings.xml
- name: Calculate and Echo Build Number
id: calc-build-number
run: |
BASE_BUILD_NUMBER=21 # Set this to the last Traivs build number
NEW_BUILD_NUMBER=$((BASE_BUILD_NUMBER + ${{ github.run_number }}))
echo "NEW_BUILD_NUMBER=$NEW_BUILD_NUMBER" >> $GITHUB_ENV
echo "The new build number is: $NEW_BUILD_NUMBER"
- name: Update versions for non-SNAPSHOT builds
run: |
sed -i "s/-SNAPSHOT/-build-${{ env.NEW_BUILD_NUMBER }}/" pom.xml
sed -i "s/-SNAPSHOT/-build-${{ env.NEW_BUILD_NUMBER }}/" vertx-parent-files/pom.xml
- name: Run Tests
run: |
echo "Running Tests"
mvn -Dmaven.wagon.http.retryHandler.count=3 -e test --settings $HOME/.m2/settings.xml
mvn --batch-mode install -DskipTests=true -Dmaven.javadoc.skip=true -Dcheck1 --settings $HOME/.m2/settings.xml
mvn --batch-mode install -DskipTests=true -Dmaven.javadoc.skip=true -Dcheck2 --settings $HOME/.m2/settings.xml
mvn -Dmaven.wagon.http.retryHandler.count=3 -e verify --settings $HOME/.m2/settings.xml
- name: Show Surefire Reports after failure
if: failure()
run: |
echo "\n=== SUREFIRE REPORTS ===\n"
for F in target/surefire-reports/*.txt; do echo $F; cat $F; echo; done
deploy_snapshots:
name: Deploy Snapshots
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
project_id: ${{ secrets.WORKLOAD_IDENTITY_PROJECT }}
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
create_credentials_file: true
export_environment_variables: true
cleanup_credentials: true
- name: Set up OAuth2 access token for Maven
run: |
echo "ACCESS_TOKEN=$(gcloud auth print-access-token)" >> $GITHUB_ENV
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Copy Maven settings
run: |
mkdir -p ~/.m2
cp ./travis/actions-maven-settings.xml $HOME/.m2/settings.xml
- name: Calculate and Echo Build Number
id: calc-build-number
run: |
BASE_BUILD_NUMBER=21 # Set this to the last Traivs build number
NEW_BUILD_NUMBER=$((BASE_BUILD_NUMBER + ${{ github.run_number }}))
echo "NEW_BUILD_NUMBER=$NEW_BUILD_NUMBER" >> $GITHUB_ENV
echo "The new build number is: $NEW_BUILD_NUMBER"
- name: Update versions for non-SNAPSHOT builds
run: |
sed -i "s/-SNAPSHOT/-build-${{ env.NEW_BUILD_NUMBER }}/" pom.xml
sed -i "s/-SNAPSHOT/-build-${{ env.NEW_BUILD_NUMBER }}/" vertx-parent-files/pom.xml
- name: Deploy Snapshots
run: |
echo "Deploying snapshots"
mvn -s $HOME/.m2/settings.xml -Dmaven.wagon.http.retryHandler.count=3 --batch-mode -e -DskipTests=true deploy