Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Migrate CI to GitHub #688

Merged
merged 37 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
efaea9b
test: Migrate CI to GitHub
evansims Sep 21, 2023
c5aeef5
Update action.yml
evansims Sep 21, 2023
67cd7f0
Update test.yml
evansims Sep 21, 2023
caae760
Update publish.yml
evansims Sep 21, 2023
41d8d35
Update test.yml
evansims Sep 21, 2023
52f9ff1
Use larger runner
evansims Sep 21, 2023
d4d2cb2
Update test.yml
evansims Sep 21, 2023
7f956ab
Update test.yml
evansims Sep 21, 2023
a29c755
Update action.yml
evansims Sep 21, 2023
91bad20
Update action.yml
evansims Sep 21, 2023
bf2f265
Update publish.yml
evansims Sep 21, 2023
4cda1c3
Update action.yml
evansims Sep 21, 2023
816a8b4
Update action.yml
evansims Sep 21, 2023
a171ff5
Update action.yml
evansims Sep 21, 2023
1fb6b99
Update test.yml
evansims Sep 21, 2023
e15082d
Update action.yml
evansims Sep 21, 2023
20033c9
Update action.yml
evansims Sep 21, 2023
763b638
Update test.yml
evansims Sep 21, 2023
04c2c55
Update action.yml
evansims Sep 21, 2023
18797b7
Update test.yml
evansims Sep 21, 2023
ecea1e5
Update test.yml
evansims Sep 21, 2023
ed92724
Update action.yml
evansims Sep 21, 2023
c3e30e3
Update action.yml
evansims Sep 21, 2023
5810a59
Update action.yml
evansims Sep 21, 2023
870bada
Update action.yml
evansims Sep 21, 2023
a753a3f
Update action.yml
evansims Sep 21, 2023
7c7c0a2
Update publish.yml
evansims Sep 21, 2023
8ab8c84
Update test.yml
evansims Sep 21, 2023
8060fc1
Update publish.yml
evansims Sep 21, 2023
c2dac58
Update action.yml
evansims Sep 21, 2023
cc22b63
Delete matrix.json
evansims Sep 21, 2023
008a821
Update action.yml
evansims Sep 21, 2023
2f00e34
Update action.yml
evansims Sep 21, 2023
f58d945
Update action.yml
evansims Sep 21, 2023
efcd00d
Run failing test in isolation
poovamraj Sep 21, 2023
cb19aa9
Revert "Run failing test in isolation"
poovamraj Sep 22, 2023
ee73f00
Merge branch 'main' into test/github-ci-migration
poovamraj Sep 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Configure CI
description: Performs the initial configuration of the CI environment

inputs:
java:
description: The Java version to use
required: false
default: 8.0.382-tem
gradle:
description: The Gradle version to use
required: false
default: 6.7.1
kotlin:
description: The Kotlin version to use
required: false
default: 1.6.21

runs:
using: composite

steps:
- run: |
curl -s "https://get.sdkman.io" | bash
source "/home/runner/.sdkman/bin/sdkman-init.sh"
sdk list java
sdk install java ${{ inputs.java }} && sdk default java ${{ inputs.java }}
sdk install gradle ${{ inputs.gradle }} && sdk default gradle ${{ inputs.gradle }}
sdk install kotlin ${{ inputs.kotlin }} && sdk default kotlin ${{ inputs.kotlin }}
shell: bash
- run: ./gradlew androidDependencies
shell: bash

- uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 # pin@1.1.0
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
53 changes: 53 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CodeQL

on:
merge_group:
pull_request:
types:
- opened
- synchronize
push:
branches:
- main
schedule:
- cron: "37 10 * * 2"

permissions:
actions: read
contents: read
security-events: write

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
analyze:
name: Check for Vulnerabilities
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [java]

steps:
- if: github.actor == 'dependabot[bot]' || github.event_name == 'merge_group'
run: exit 0 # Skip unnecessary test runs for dependabot and merge queues. Artifically flag as successful, as this is a required check for branch protection.

- name: Checkout
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"
10 changes: 0 additions & 10 deletions .github/workflows/gradle-wrapper-validation.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish Release

on:
workflow_dispatch:
inputs:
branch:
description: The branch to release from.
required: true
default: main

permissions:
contents: read

jobs:
publish:
name: Publish to Maven Central
runs-on: ubuntu-latest
environment: release

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch }}

- uses: ./.github/actions/setup

- run: ./gradlew clean assemble -PisSnapshot=false

- run: ./gradlew exportVersion -PisSnapshot=false

- run: ./gradlew publishAndroidLibraryPublicationToMavenRepository -PossrhUsername="${{ secrets.OSSR_USERNAME }}" -PossrhPassword="${{ secrets.OSSR_PASSWORD }}" -PsigningKey="${{ secrets.SIGNING_KEY }}" -PsigningPassword="${{ secrets.SIGNING_PASSWORD }}" -PisSnapshot=false"
44 changes: 34 additions & 10 deletions .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,48 @@

name: Semgrep

on:
pull_request: {}

merge_group:
pull_request_target:
types:
- opened
- synchronize
push:
branches: ["master", "main"]

branches:
- main
schedule:
- cron: '30 0 1,15 * *'
- cron: "30 0 1,15 * *"

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
semgrep:
name: Scan
authorize:
name: Authorize
environment: ${{ github.actor != 'dependabot[bot]' && github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository && 'external' || 'internal' }}
runs-on: ubuntu-latest
steps:
- run: true

run:
needs: authorize # Require approval before running on forked pull requests

name: Check for Vulnerabilities
runs-on: ubuntu-latest

container:
image: returntocorp/semgrep
if: (github.actor != 'dependabot[bot]')

steps:
- uses: actions/checkout@v3
- if: github.actor == 'dependabot[bot]' || github.event_name == 'merge_group'
run: exit 0 # Skip unnecessary test runs for dependabot and merge queues. Artifically flag as successful, as this is a required check for branch protection.

- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}

- run: semgrep ci
env:
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Snyk

on:
merge_group:
workflow_dispatch:
pull_request_target:
types:
- opened
- synchronize
push:
branches:
- main
schedule:
- cron: "30 0 1,15 * *"

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
authorize:
name: Authorize
environment: ${{ github.actor != 'dependabot[bot]' && github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository && 'external' || 'internal' }}
runs-on: ubuntu-latest
steps:
- run: true

check:
needs: authorize

name: Check for Vulnerabilities
runs-on: ubuntu-latest

steps:
- if: github.actor == 'dependabot[bot]' || github.event_name == 'merge_group'
run: exit 0 # Skip unnecessary test runs for dependabot and merge queues. Artifically flag as successful, as this is a required check for branch protection.

- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}

- uses: snyk/actions/php@b98d498629f1c368650224d6d212bf7dfa89e4bf # pin@0.4.0
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Test

on:
merge_group:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
unit:
name: Run Unit Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/setup

- run: ./gradlew clean test jacocoTestReport lint --continue --console=plain --max-workers=1 --no-daemon

- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # pin@3.1.4