diff options
author | Szczepan Faber <s.faber@airbnb.com> | 2021-01-17 22:11:26 -0600 |
---|---|---|
committer | Szczepan Faber <s.faber@airbnb.com> | 2021-01-17 22:11:26 -0600 |
commit | 8b97f9a6646d82f1377a70945d6c057822ab9184 (patch) | |
tree | e8208ba7bde25d550de180d7bd7b16e0f6fa79f8 | |
parent | b8f480fd5594d037a085da2d857bdd5597a56bdf (diff) | |
download | mockito-kotlin-8b97f9a6646d82f1377a70945d6c057822ab9184.tar.gz |
Initial GH Actions workflow
-rw-r--r-- | .github/workflows/ci.yml | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4094914 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,104 @@ +# +# CI build that assembles artifacts and runs tests. +# If validation is successful this workflow releases from the main dev branch. +# +# - skipping CI: add [skip ci] to the commit message +# - skipping release: add [skip release] to the commit message +# +name: CI + +on: + push: + branches: + - main + tags-ignore: + - v* # release tags are automatically generated after a successful CI build, no need to run CI against them + pull_request: + branches: + - main + +jobs: + + # + # SINGLE-JOB + # + verify: + runs-on: ubuntu-latest + if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" + + steps: + + - name: 1. Check out code + uses: actions/checkout@v2 # https://github.com/actions/checkout + + - name: 2. Set up Java 8 + uses: actions/setup-java@v1 # https://github.com/actions/setup-java + with: + java-version: 8 + + - name: 3. Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1 # https://github.com/gradle/wrapper-validation-action + + # + # Main build job + # + build: + needs: [verify] + runs-on: ubuntu-latest + + # Definition of the build matrix + strategy: + matrix: + mock-maker: ['mock-maker-default', 'mock-maker-inline'] + kotlin: ['1.0.7', '1.1.61', '1.2.50', '1.3.50'] + + steps: + + - name: 1. Check out code + uses: actions/checkout@v2 # https://github.com/actions/checkout + + - name: 2. Set up Java 8 + uses: actions/setup-java@v1 # https://github.com/actions/setup-java + with: + java-version: 8 + + - name: 3. Build with Kotlin ${{ matrix.kotlin }} and mock-maker ${{ matrix.mock-maker }} + run: | + ops/mockMakerInline.sh + ./gradlew build bintrayUpload idea -PbintrayDryRun + env: + KOTLIN_VERSION: ${{ matrix.kotlin }} + MOCK_MAKER: ${{ matrix.mock-maker }} + + # + # Release job, only for pushes to the main development branch + # + release: + runs-on: ubuntu-latest + needs: [build] # build job must pass before we can release + + if: github.event_name == 'push' + && github.ref == 'refs/heads/main' + && github.repository == 'mockito/mockito-kotlin' + && !contains(toJSON(github.event.commits.*.message), '[skip release]') + + steps: + + - name: Check out code + uses: actions/checkout@v2 # https://github.com/actions/checkout + with: + fetch-depth: '0' # https://github.com/shipkit/shipkit-changelog#fetch-depth-on-ci + + - name: Set up Java 8 + uses: actions/setup-java@v1 + with: + java-version: 8 + + - name: Build and publish to Bintray/MavenCentral + run: ./gradlew tasks # TODO, in progress: bintrayUpload githubRelease +# env: +# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} +# BINTRAY_API_KEY: ${{secrets.BINTRAY_API_KEY}} +# NEXUS_TOKEN_USER: ${{secrets.NEXUS_TOKEN_USER}} +# NEXUS_TOKEN_PWD: ${{secrets.NEXUS_TOKEN_PWD}} + |