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

Try imposter to avoid conflicts with already installed packages #236

Merged
merged 9 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .docker/wordpress/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ARG VERSION=php7.4@sha256:6003ce1cc14ed9d83c3df5593b3359cc8e4236fb80238e9530a0beeb6c60f688
ARG VERSION=php8.0@sha256:1e7fee0c6fec2eebe4d54c7719fb055a6b9834f7430e26f3e83c1a141cdcb8c4
FROM wordpress:${VERSION}
RUN \
a2enmod ssl && \
a2ensite default-ssl.conf && \
curl -L https://github.com/FiloSottile/mkcert/releases/download/v1.4.3/mkcert-v1.4.3-linux-amd64 -o /usr/local/bin/mkcert && \
curl -L https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-linux-amd64 -o /usr/local/bin/mkcert && \
chmod +x /usr/local/bin/mkcert && \
/usr/local/bin/mkcert -cert-file /etc/ssl/certs/ssl-cert-snakeoil.pem -key-file /etc/ssl/private/ssl-cert-snakeoil.key localhost && \
mkdir -p /var/www/mu-plugins
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,44 @@ jobs:
name: playwright-test-results
path: test-results/
retention-days: 3

e2e-bundle:
name: Run E2E tests on the generated plugin
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0

- name: Generate self-contained package
run: |
git archive --format=tar --prefix=two-factor-provider-webauthn/ HEAD | (cd /var/tmp/ && tar xf -)
(cd /var/tmp/two-factor-provider-webauthn && composer install --no-dev --no-interaction && composer remove --update-no-dev --no-interaction composer/installers cweagans/composer-patches && rm -rf composer.lock composer.json patches vendor/madwizard/webauthn/.github vendor/madwizard/webauthn/conformance vendor/madwizard/webauthn/tests vendor/psr/log/Psr/Log/Test vendor/typisttech)

- name: Patch docker-compose.yml
run: |
sed -i 's!- .:!- /var/tmp/two-factor-provider-webauthn:!' docker-compose.yml

- name: Set up Node.js environment
uses: actions/setup-node@969bd2663942d722d85b6a8626225850c2f7be4b # tag=v3.5.0
with:
node-version: lts/*
cache: npm

- name: Install dependencies
run: npm ci

- name: Install Playwright
run: npx playwright install chromium

- name: Run Playwright E2E tests
run: npm run test:e2e
env:
WP_VERSION: php8.0

- name: Upload test results
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3
if: failure()
with:
name: playwright-test-results
path: test-results/
retention-days: 3
7 changes: 3 additions & 4 deletions .github/workflows/push-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ jobs:
- name: Generate self-contained package
run: |
git archive --format=tar --prefix=two-factor-provider-webauthn/ HEAD | (cd /var/tmp/ && tar xf -)
cp composer.lock /var/tmp/two-factor-provider-webauthn/
(cd /var/tmp/two-factor-provider-webauthn && composer install --no-dev --no-interaction && composer remove --update-no-dev --no-interaction composer/installers && rm -f composer.lock)
(cd /var/tmp/two-factor-provider-webauthn && composer install --no-dev --no-interaction && composer remove --update-no-dev --no-interaction composer/installers cweagans/composer-patches && rm -rf composer.lock composer.json patches vendor/madwizard/webauthn/.github vendor/madwizard/webauthn/conformance vendor/madwizard/webauthn/tests vendor/psr/log/Psr/Log/Test vendor/typisttech) && \
(cd /var/tmp && zip -r -9 two-factor-provider-webauthn.zip two-factor-provider-webauthn)

- name: Release
Expand All @@ -42,8 +41,8 @@ jobs:
- name: Install dependencies to bundle
run: |
composer install --no-dev --no-interaction
composer remove --update-no-dev --no-interaction composer/installers
rm -f composer.lock composer.json
composer remove --update-no-dev --no-interaction composer/installers cweagans/composer-patches
rm -rf composer.lock composer.json patches vendor/madwizard/webauthn/{.github,conformance,tests} vendor/psr/log/Psr/Log/Test vendor/typisttech

- name: Deploy to wordpress.org
uses: 10up/action-wordpress-plugin-deploy@stable
Expand Down
5 changes: 2 additions & 3 deletions bin/build-archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

(
cd .. && \
git archive --format=tar --prefix=two-factor-provider-webauthn/ HEAD | (cd /var/tmp/ && tar xf -) && \
cp composer.lock /var/tmp/two-factor-provider-webauthn/ && \
(cd /var/tmp/two-factor-provider-webauthn && composer install --no-dev --no-interaction && composer remove --update-no-dev --no-interaction composer/installers && rm -f composer.lock) && \
git archive --format=tar --prefix=two-factor-provider-webauthn/ HEAD | (cd /var/tmp/ && tar xf -)
(cd /var/tmp/two-factor-provider-webauthn && composer install --no-dev --no-interaction && composer remove --update-no-dev --no-interaction composer/installers cweagans/composer-patches && rm -rf composer.lock composer.json patches vendor/madwizard/webauthn/.github vendor/madwizard/webauthn/conformance vendor/madwizard/webauthn/tests vendor/psr/log/Psr/Log/Test vendor/typisttech) && \
(cd /var/tmp && zip -r -9 two-factor-provider-webauthn.zip two-factor-provider-webauthn) && \
mv /var/tmp/two-factor-provider-webauthn.zip two-factor-provider-webauthn.zip
)
22 changes: 21 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"require": {
"php": "^7.4.0 || ^8.0.0",
"composer/installers": "^2.0",
"cweagans/composer-patches": "^1.7",
"madwizard/webauthn": "^0.8.0",
"typisttech/imposter-plugin": "^0.6.2",
"wildwolf/singleton-trait": "^1.0"
},
"require-dev": {
Expand All @@ -31,10 +33,28 @@
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"composer/package-versions-deprecated": true,
"composer/installers": true
"composer/installers": true,
"typisttech/imposter-plugin": true,
"cweagans/composer-patches": true
},
"platform": {
"php": "7.4"
},
"optimize-autoloader": true,
"classmap-authoritative": true
},
"extra": {
"imposter": {
"namespace": "WildWolf\\WordPress\\TwoFactorWebAuthn\\Vendor",
"excludes": [
"cweagans/composer-patches",
"wildwolf/singleton-trait"
]
},
"patches": {
"madwizard/webauthn": {
"Fix interoperability with imposter": "patches/webauthn.patch"
}
}
},
"scripts": {
Expand Down
224 changes: 223 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
context: .docker/wordpress
dockerfile: Dockerfile
args:
VERSION: ${WP_VERSION:-php7.4}
VERSION: ${WP_VERSION:-php8.0}
depends_on:
- mariadb
ports:
Expand All @@ -26,12 +26,12 @@ services:
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_HOST: mariadb
volumes: &ref_0
- 'wordpress:/var/www/html'
- wordpress:/var/www/html
- .:/var/www/html/wp-content/plugins/two-factor-provider-webauthn
networks:
- tfpwa
cli:
image: 'wordpress:cli-php7.4@sha256:c253f3b5043a6414e2d93a2ee5ddb1021d82e67c84c7d050d11c08accd627859'
image: wordpress:cli-php7.4@sha256:06513d92834e401c96d213b71914f645914e8ce7fde5a5b4f97375ee0d3313c3
volumes: *ref_0
user: '33:33'
environment:
Expand Down
Loading