Skip to content

Commit

Permalink
Migrated Travis CI to Github Actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
cheqianh authored Nov 4, 2020
1 parent 69e62f6 commit b967c4f
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 98 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/ion-test-driver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: ion-test-driver

on: [pull_request]

jobs:
ion-test-driver:
runs-on: macos-10.15
steps:
- name: Checkout ion-java
uses: actions/checkout@master
with:
repository: amzn/ion-java
ref: master
path: ion-java

- name: Get main branch HEAD sha
run: cd ion-java && echo "sha=`git rev-parse --short HEAD`" >> $GITHUB_ENV

- name: Checkout ion-test-driver
uses: actions/checkout@master
with:
repository: amzn/ion-test-driver
ref: master
path: ion-test-driver

- name: Set up python3 env
run: python3 -m venv ion-test-driver/venv && . ion-test-driver/venv/bin/activate

- name: Pip install
run: pip3 install -r ion-test-driver/requirements.txt && pip3 install -e ion-test-driver

- name: Run ion-test-driver
run: python3 ion-test-driver/amazon/iontest/ion_test_driver.py -o output
-i ion-java,${{ github.event.pull_request.head.repo.html_url }},${{ github.event.pull_request.head.sha }}

- name: Upload result
uses: actions/upload-artifact@v2
with:
name: ion-test-driver-result.ion
path: output/results/ion-test-driver-results.ion

- name: showing result
run: cat output/results/ion-test-driver-results.ion

- name: Analyze two implementations
continue-on-error: true
id: result-diff
run: python3 ion-test-driver/amazon/iontest/ion_test_driver.py -R
ion-java,https://github.com/amzn/ion-java,$sha
ion-java,${{ github.event.pull_request.head.repo.html_url }},${{ github.event.pull_request.head.sha }}
output/results/ion-test-driver-results.ion

- name: Upload analysis report
uses: actions/upload-artifact@v2
with:
name: analysis-report.ion
path: result.ion

- name: showing report
run: cat result.ion

- name: Check if ion-test-driver fails
if: ${{ steps.result-diff.outcome == 'failure' }}
run: echo 'Implementation behavior changed, Refer to the analysis report in the previous step for the reason.' && exit 1

open-issue:
runs-on: ubuntu-latest
needs: ion-test-driver
if: ${{ failure() }}
steps:
- uses: actions/checkout@master
- name: Open an issue
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_WORKFLOW_URL: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
GITHUB_PR_SHA: ${{ github.event.pull_request.head.sha }}
with:
assignees: ${{ github.event.sender.login }}

106 changes: 39 additions & 67 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,80 +1,52 @@
name: ion-test-driver
name: build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

on: [pull_request]

jobs:
ion-test-driver:
runs-on: macos-10.15
test:
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 9, 10, 11]
steps:
- name: Checkout ion-java
uses: actions/checkout@master
- uses: actions/checkout@v2
with:
repository: amzn/ion-java
ref: master
path: ion-java

- name: Get main branch HEAD sha
run: cd ion-java && echo "sha=`git rev-parse --short HEAD`" >> $GITHUB_ENV

- name: Checkout ion-test-driver
uses: actions/checkout@master
submodules: recursive
- name: Use java ${{ matrix.java }}
uses: actions/setup-java@v1
with:
repository: amzn/ion-test-driver
ref: master
path: ion-test-driver

- name: Set up python3 env
run: python3 -m venv ion-test-driver/venv && . ion-test-driver/venv/bin/activate
java-version: ${{ matrix.java }}
- run: mvn test
- run: mvn package -f ion-java-cli/pom.xml
- run: java -jar ion-java-cli/target/ion-java-cli-1.0.jar version

- name: Pip install
run: pip3 install -r ion-test-driver/requirements.txt && pip3 install -e ion-test-driver

- name: Run ion-test-driver
run: python3 ion-test-driver/amazon/iontest/ion_test_driver.py -o output
-i ion-java,${{ github.event.pull_request.head.repo.html_url }},${{ github.event.pull_request.head.sha }}

- name: Upload result
uses: actions/upload-artifact@v2
report-generation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
name: ion-test-driver-result.ion
path: output/results/ion-test-driver-results.ion

- name: showing result
run: cat output/results/ion-test-driver-results.ion

- name: Analyze two implementations
continue-on-error: true
id: result-diff
run: python3 ion-test-driver/amazon/iontest/ion_test_driver.py -R
ion-java,https://github.com/amzn/ion-java,$sha
ion-java,${{ github.event.pull_request.head.repo.html_url }},${{ github.event.pull_request.head.sha }}
output/results/ion-test-driver-results.ion

- name: Upload analysis report
uses: actions/upload-artifact@v2
submodules: recursive
- name: Use java 11
uses: actions/setup-java@v1
with:
java-version: 11
- run: mvn test site
- uses: codecov/codecov-action@v1
with:
name: analysis-report.ion
path: result.ion
file: target/site/jacoco/jacoco.xml
- name: deploy gh-pages
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: "./target/site"

- name: showing report
run: cat result.ion

- name: Check if ion-test-driver fails
if: ${{ steps.result-diff.outcome == 'failure' }}
run: echo 'Implementation behavior changed, Refer to the analysis report in the previous step for the reason.' && exit 1

open-issue:
runs-on: ubuntu-latest
needs: ion-test-driver
if: ${{ failure() }}
steps:
- uses: actions/checkout@master
- name: Open an issue
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_WORKFLOW_URL: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
GITHUB_PR_SHA: ${{ github.event.pull_request.head.sha }}
with:
assignees: ${{ github.event.sender.login }}

31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

0 comments on commit b967c4f

Please sign in to comment.