-
Notifications
You must be signed in to change notification settings - Fork 16
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
add instructions to readme about running locally #6
Comments
I started to get it working with |
|
That's great! By running the following steps, I could run the same tests as CI on my local machine. Could you try this on checkout-single-subscription? (replace XXX with proper values) cp -rp path/to/sample-ci .
export STRIPE_PUBLISHABLE_KEY=XXX
export STRIPE_SECRET_KEY=XXX
export BASIC=XXX # price id for basic plan (you can find the value in ci.yml)
export PREMIUM=XXX # price id for premium plan (ditto)
source sample-ci/helpers.sh
install_docker_compose_settings
export STRIPE_WEBHOOK_SECRET=$(retrieve_webhook_secret)
# NOTE: The required variables here depend on the sample repository.
# STRIPE_PUBLISHABLE_KEY, STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, and STATIC_DIR will be set via docker-compose.yml
# Add additional variables here that .env.sample suggests.
cat <<EOF >> .env
DOMAIN=http://web:4242
BASIC_PRICE_ID=${BASIC}
PRO_PRICE_ID=${PREMIUM}
EOF
configure_docker_compose_for_integration . ruby ../../client
docker-compose up -d && wait_web_server
docker-compose exec -T runner bundle exec rspec spec/server_spec.rb If it works, I believe the other repositories can be tested locally in similar ways. |
Oh, I missed the comments. I'll check it later 🙏 |
I think I could successfully run CI for checkout-one-time-payments with act. As you mentioned, it is necessary to pass the secret variables to act. We can do that by creating
Additionally, I had to setup Docker and Docker Compose for act because the default environment that act provides does not have docker. Also, it was necessary to remove diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 98c087e..307d299 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -17,12 +17,34 @@ jobs:
- name: Install gettext for envsubst
run: |
- sudo apt install gettext-base
+ apt update
+ apt install gettext-base
- name: Install jq
run: |
- sudo curl -o /usr/bin/jq -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
- sudo chmod +x /usr/bin/jq
+ curl -o /usr/bin/jq -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
+ chmod +x /usr/bin/jq
+
+ - name: Setup docker for act
+ run: |
+ # SEE: https://docs.docker.com/compose/install/ and https://docs.docker.com/engine/install/debian/
+ apt-get update
+ apt-get install -y \
+ apt-transport-https \
+ ca-certificates \
+ curl \
+ gnupg-agent \
+ software-properties-common
+ curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
+ add-apt-repository \
+ "deb [arch=amd64] https://download.docker.com/linux/debian \
+ $(lsb_release -cs) \
+ stable"
+ apt-get update
+ apt-get install -y docker-ce docker-ce-cli containerd.io
+
+ curl -L "https://github.com/docker/compose/releases/download/1.28.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
+ chmod +x /usr/local/bin/docker-compose
- name: Run tests
run: | Here are the complete contents of the updated name: CI for stripe-samples/checkout-one-time-payments
on:
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: 'stripe-samples/sample-ci'
path: 'sample-ci'
- name: Install gettext for envsubst
run: |
apt update
apt install gettext-base
- name: Install jq
run: |
curl -o /usr/bin/jq -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod +x /usr/bin/jq
- name: Setup docker for act
run: |
# SEE: https://docs.docker.com/compose/install/ and https://docs.docker.com/engine/install/debian/
apt-get update
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable"
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io
curl -L "https://github.com/docker/compose/releases/download/1.28.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
- name: Run tests
run: |
source sample-ci/helpers.sh
install_docker_compose_settings
export STRIPE_WEBHOOK_SECRET=$(retrieve_webhook_secret)
cat <<EOF >> .env
DOMAIN=http://web:4242
PRICE=${PRICE}
PAYMENT_METHOD_TYPES="card,ideal"
EOF
for lang in $(cat .cli.json | server_langs_for_integration main)
do
[ "$lang" = "php" ] && continue
configure_docker_compose_for_integration . "$lang" ../../client/html
docker-compose up -d && wait_web_server
docker-compose exec -T runner bundle exec rspec spec/client_and_server_spec.rb
done
env:
STRIPE_PUBLISHABLE_KEY: ${{ secrets.TEST_STRIPE_PUBLISHABLE_KEY }}
STRIPE_SECRET_KEY: ${{ secrets.TEST_STRIPE_SECRET_KEY }}
PRICE: price_1ICW8OCWW2eVYDoPXTu7iRvB
- name: Collect debug information
if: ${{ failure() }}
run: |
cat docker-compose.yml
docker-compose ps -a
docker-compose logs web
env:
STRIPE_PUBLISHABLE_KEY: ${{ secrets.TEST_STRIPE_PUBLISHABLE_KEY }}
STRIPE_SECRET_KEY: ${{ secrets.TEST_STRIPE_SECRET_KEY }}
PREMIUM: price_1HXyXwCWW2eVYDoPnnTQ02VO
BASIC: price_1HXyVBCWW2eVYDoPtXcEdXfw It's great if we can make the |
This is still failing for me with both act and the steps above :)
|
Renaming |
If you have the latest version of act, and a For Selecting Medium for the docker image size seems fine. Note the keys in GITHUB_TOKEN=b...
TEST_STRIPE_PUBLISHABLE_KEY=pk_test_...
TEST_STRIPE_SECRET_KEY=sk_test_... |
I noticed that the environment variables As a way to do that, perhaps we can read the variables from |
By this jobs on ci.yml can be run on local machines with `act`. Related to stripe-samples/sample-ci#6 Before applying this change, `TEST_PREMIUM_PRICE` and `TEST_BASIC_PRICE` have to be set as a secret.
By this jobs on ci.yml can be run on local machines with `act`. Related to stripe-samples/sample-ci#6
By this jobs on ci.yml can be run on local machines with `act`. Related to stripe-samples/sample-ci#6
By this jobs on ci.yml can be run on local machines with `act`. Related to stripe-samples/sample-ci#6
Let's add some steps for getting docker running locally in the readme.md
The text was updated successfully, but these errors were encountered: