Skip to content

Commit

Permalink
Reduce duplicate CI jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
cytopia committed Feb 11, 2022
1 parent d8ba5fb commit dba1ac0
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ name: build
# When to run
# -------------------------------------------------------------------------------------------------
on:
# Runs on Pull Requests
pull_request:
# Runs on Push
push:

Expand Down
90 changes: 90 additions & 0 deletions .github/workflows/contributor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---

# -------------------------------------------------------------------------------------------------
# Job Name
# -------------------------------------------------------------------------------------------------
name: build


# -------------------------------------------------------------------------------------------------
# When to run
# -------------------------------------------------------------------------------------------------
on:
# Runs on Pull Requests
pull_request:


jobs:

# -----------------------------------------------------------------------------------------------
# Job (1/2): BUILD
# -----------------------------------------------------------------------------------------------
build:
name: "[ PHP-${{ matrix.version }} (${{ matrix.arch }}) ]"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version:
- '8.2'
arch:
- 'linux/amd64'
- 'linux/arm64'
- 'linux/386'
- 'linux/arm/v7'
- 'linux/arm/v6'
# Only run for forks (contributor)
if: ${{ github.event.pull_request.head.repo.fork }}
steps:

# ------------------------------------------------------------
# Setup repository
# ------------------------------------------------------------
- name: "[SETUP] Checkout repository"
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: "[SETUP] Setup QEMU environment"
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all

- name: "[SETUP] Determine Docker tag"
id: tag
uses: cytopia/docker-tag@v0.3

# ------------------------------------------------------------
# Build
# ------------------------------------------------------------
- name: Build
uses: cytopia/shell-command-retry-action@v0.1
with:
command: |
make build ARCH=${ARCH}
env:
ARCH: ${{ matrix.arch }}

# ------------------------------------------------------------
# Test
# ------------------------------------------------------------
- name: "[TEST] Docker Image"
uses: cytopia/shell-command-retry-action@v0.1
with:
command: |
make test ARCH=${ARCH}
env:
ARCH: ${{ matrix.arch }}

- name: "[TEST] Update README"
uses: cytopia/shell-command-retry-action@v0.1
with:
command: |
make update-readme ARCH=${ARCH}
env:
ARCH: ${{ matrix.arch }}

- name: "[TEST] Verify README"
run: |
git diff --quiet || { echo "Build Changes"; git diff; git status; false; }

0 comments on commit dba1ac0

Please sign in to comment.