Skip to content

Commit

Permalink
Only run checks on PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
handstandsam committed Jun 7, 2024
1 parent e37bcd2 commit 3f2c21c
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages
name: CI

on:
# Runs on pushes targeting the default branch
Expand All @@ -21,12 +20,36 @@ concurrency:
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
# Run Tests
test-ubuntu:
runs-on: ubuntu-latest
timeout-minutes: 25

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
check-latest: true

- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v3

- name: Test on Ubuntu
run: ./gradlew assemble check --no-build-cache --no-daemon --stacktrace

# Deploy to Github Pages
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs:
- test-ubuntu
if: github.repository == 'square/invert' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
steps:
- name: Checkout
Expand Down Expand Up @@ -56,32 +79,9 @@ jobs:
id: deployment
uses: actions/deploy-pages@v2

test-ubuntu:
runs-on: ubuntu-latest
timeout-minutes: 25

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
check-latest: true

- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v3

- name: Test on Ubuntu
run: ./gradlew assemble check --no-build-cache --no-daemon --stacktrace

all-checks:
if: always()
runs-on: ubuntu-latest
needs:
- test-ubuntu

steps:
- name: require that all other jobs have passed
Expand All @@ -91,7 +91,8 @@ jobs:
jobs: ${{ toJSON(needs) }}

publish-snapshot:
needs: [ all-checks ]
needs:
- test-ubuntu
runs-on: ubuntu-latest
if: github.repository == 'square/invert' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
timeout-minutes: 25
Expand Down

0 comments on commit 3f2c21c

Please sign in to comment.