Add take action to auto assign contributors for Hacktoberfest #311
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
permissions: read-all | |
jobs: | |
all: | |
name: Find all examples | |
runs-on: ubuntu-latest | |
outputs: | |
languages: ${{ steps.build-matrix.outputs.languages }} | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: discover all examples | |
id: build-matrix | |
run: node .github/generate-test-steps.js >> "$GITHUB_OUTPUT" | |
javascript: | |
name: JavaScript / ${{ matrix.example.name }} | |
needs: all | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
example: ${{ fromJSON(needs.all.outputs.languages).javascript }} | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
with: | |
node-version: ${{ matrix.example.misc.node-version || '20.4.0' }} | |
- name: test setup | |
run: ${{ matrix.example.tests.pre }} | |
working-directory: ${{ matrix.example.directory }} | |
if: matrix.example.tests.pre != null | |
- name: test | |
run: ${{ matrix.example.tests.command }} | |
working-directory: ${{ matrix.example.directory }} | |
kotlin: | |
name: Kotlin / ${{ matrix.example.name }} | |
needs: all | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
example: ${{ fromJSON(needs.all.outputs.languages).kotlin }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Enable KVM | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Set up JDK 17 | |
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Cache Gradle packages | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@00854ea68c109d98c75d956347303bf7c45b0277 # v3.2.1 | |
- name: test setup | |
run: ${{ matrix.example.tests.pre }} | |
working-directory: ${{ matrix.example.directory }} | |
if: matrix.example.test.pre != null | |
- name: test in android emulator | |
uses: reactivecircus/android-emulator-runner@77986be26589807b8ebab3fde7bbf5c60dabec32 # v2.31.0 | |
with: | |
api-level: 29 | |
script: ${{ matrix.example.tests.command }} | |
working-directory: ${{ matrix.example.directory }} | |
automerge: | |
name: Automerge Dependabot PRs | |
runs-on: ubuntu-latest | |
needs: [javascript, kotlin] | |
if: github.event.pull_request.user.login == 'dependabot[bot]' | |
permissions: | |
pull-requests: write | |
issues: write | |
repository-projects: write | |
steps: | |
- name: Dependabot metadata | |
id: metadata | |
uses: dependabot/fetch-metadata@v2 | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Approve and merge | |
if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' | |
run: | | |
set -ex | |
gh pr review --approve "${{github.event.pull_request.html_url}}" | |
gh pr merge --auto --rebase "${{github.event.pull_request.html_url}}" | |
env: | |
GH_TOKEN: ${{secrets.GITHUB_TOKEN}} |