Skip to content

Commit

Permalink
Adding a docker-based dev env (#40934)
Browse files Browse the repository at this point in the history
Co-authored-by: Brad Jorsch <[email protected]>
  • Loading branch information
kraftbj and anomiex authored Jan 14, 2025
1 parent dd7f917 commit 07716f9
Show file tree
Hide file tree
Showing 22 changed files with 757 additions and 3 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/build-docker-monorepo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Build Monorepo Docker
on:
push:
branches: [ 'trunk' ]
paths:
- 'tools/docker/Dockerfile.monorepo'
- 'tools/docker/bin/monorepo'
- '.github/versions.sh'
- '.github/workflows/build-docker-monorepo.yml'
pull_request:
paths:
- 'tools/docker/Dockerfile.monorepo'
- 'tools/docker/bin/monorepo'
- '.github/versions.sh'
- '.github/workflows/build-docker-monorepo.yml'
concurrency:
group: build-docker-monorepo-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build and publish Jetpack Monorepo Environment
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
timeout-minutes: 60

steps:
- uses: actions/checkout@v4

- name: Set up qemu
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: matticbot
password: ${{ secrets.DOCKER_HUB_MATTICBOT_TOKEN }}

- name: Log in to GitHub Packages
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Fetch build args
id: buildargs
run: |
source .github/versions.sh
source .github/files/gh-funcs.sh
gh_set_output php-version "$PHP_VERSION"
gh_set_output composer-version "$COMPOSER_VERSION"
gh_set_output node-version "$NODE_VERSION"
gh_set_output pnpm-version "$PNPM_VERSION"
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
gh_set_output tags "type=raw,latest"
gh_set_output images $'automattic/jetpack-monorepo\nghcr.io/automattic/jetpack-monorepo'
elif [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
gh_set_output tags "type=ref,event=pr"
gh_set_output images "ghcr.io/automattic/jetpack-monorepo"
else
echo "Unknown GITHUB_EVENT_NAME $GITHUB_EVENT_NAME"
exit 1
fi
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
flavor: latest=false
tags: ${{ steps.buildargs.outputs.tags }}
images: ${{ steps.buildargs.outputs.images }}
labels: |
org.opencontainers.image.title=Jetpack Monorepo Environment
org.opencontainers.image.description=Environment for building and testing the Jetpack Monorepo.
org.opencontainers.image.documentation=${{ github.server_url }}/${{ github.repository }}/blob/trunk/tools/docker/README.md
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: tools/docker
file: tools/docker/Dockerfile.monorepo
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/arm64,linux/amd64
build-args: |
PHP_VERSION=${{ steps.buildargs.outputs.php-version }}
COMPOSER_VERSION=${{ steps.buildargs.outputs.composer-version }}
NODE_VERSION=${{ steps.buildargs.outputs.node-version }}
PNPM_VERSION=${{ steps.buildargs.outputs.pnpm-version }}
1 change: 1 addition & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ jobs:
CONFIG_KEY: ${{ secrets.E2E_CONFIG_KEY }}
SUITE: ${{ matrix.suite }}
PROJECT_NAME: ${{ matrix.project }}
HOST_CWD: ${{ github.workspace }}
run: |
echo "::group::Decrypt config"
pnpm run config:decrypt
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ phpcs.xml
# VS Code setting files
*.code-workspace
/.vscode/settings.json

.pnpm-debug.log
.pnpm-error.log
1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
packages:
- 'projects/*/*'
- '!projects/js-packages/jetpack-cli'
- 'projects/plugins/*/tests/e2e'
- 'tools/cli'
- 'tools/e2e-commons'
Expand Down
6 changes: 6 additions & 0 deletions projects/js-packages/jetpack-cli/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Files not needed to be distributed in the package.
.gitattributes export-ignore
node_modules export-ignore

# Files to exclude from the mirror repo
/changelog/** production-exclude
3 changes: 3 additions & 0 deletions projects/js-packages/jetpack-cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vendor/
node_modules/
package-lock.json
7 changes: 7 additions & 0 deletions projects/js-packages/jetpack-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

18 changes: 18 additions & 0 deletions projects/js-packages/jetpack-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Jetpack


## How to install Jetpack plugin on your site
### Installation From Git Repo

## Contribute

## Get Help

## Security

Need to report a security vulnerability? Go to [https://automattic.com/security/](https://automattic.com/security/) or directly to our security bug bounty site [https://hackerone.com/automattic](https://hackerone.com/automattic).

## License

Licensed under [GNU General Public License v2 (or later)](./LICENSE.txt).

Loading

0 comments on commit 07716f9

Please sign in to comment.