diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4b9a98d..fd58dd0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -3,30 +3,26 @@ on: push: branches: - main_RENAME_THIS_TO_ENABLE_TEST + workflow_dispatch: jobs: run-tests: runs-on: ubuntu-latest - services: - docker: - image: docker:19.03.12 - options: --privileged # container has full access to host - ports: - - 9011:9011 - steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Start FusionAuth + uses: fusionauth/fusionauth-github-action@v1 + with: + FUSIONAUTH_VERSION: "latest" # Optional: provide FusionAuth version number otherwise it defaults to latest + - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '18' - - name: Start FusionAuth in Docker - run: docker-compose up -d # -d in background - - name: Install npm dependencies run: | npm install @@ -41,3 +37,49 @@ jobs: - name: Run Playwright tests run: npx playwright test --project=chromium working-directory: ./app + + +# Optional: Using the fusionauth-github-action is the preferred method to start FusionAuth in the workflow, but if you want to start FusionAuth with docker-compose instead, you can use the configuration below (for example, if you need to use a custom password hashing plugin). +# name: Test FusionAuth login +# on: +# push: +# branches: +# - main_RENAME_THIS_TO_ENABLE_TEST + +# jobs: +# run-tests: +# runs-on: ubuntu-latest + +# services: +# docker: +# image: docker:19.03.12 +# options: --privileged # container has full access to host +# ports: +# - 9011:9011 + +# steps: +# - name: Checkout repository +# uses: actions/checkout@v4 + +# - name: Set up Node.js +# uses: actions/setup-node@v4 +# with: +# node-version: '18' + +# - name: Start FusionAuth in Docker +# run: docker-compose up -d # -d in background + +# - name: Install npm dependencies +# run: | +# npm install +# npx playwright install-deps +# npx playwright install +# working-directory: ./app + +# - name: Start app +# run: npm run start & # & in background +# working-directory: ./app + +# - name: Run Playwright tests +# run: npx playwright test --project=chromium +# working-directory: ./app diff --git a/README.md b/README.md index 7a4fe54..24b9b5b 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ It's part of the article available at: https://fusionauth.io/docs/get-started/ru To run this application you will need Node.js and Docker installed. In a terminal run the code below. ```bash -git clone https://github.com/FusionAuth/fusionauth_github_actions.git +git clone https://github.com/FusionAuth/fusionauth-example-github-actions.git docker compose up ``` @@ -35,4 +35,8 @@ npx playwright test --project=chromium; ## Run the tests in a GitHub action -To run these tests in a GitHub action, fork this repository, change the branch in `.github/workflows/test.yaml` from `main_RENAME_THIS_TO_ENABLE_TEST` to `main`. Commit and push. The action will start running in the Actions tab in the repository site. +> By default, GitHub prevents action workflows from running on forked repositories. To grant permission for the workflow to execute, navigate to the Actions tab on your forked repository in GitHub and click on the **I understand my workflows, go ahead and enable them** button on the repository. + +To run these tests in a GitHub action, fork this repository, change the branch name in `.github/workflows/test.yaml` from `main_RENAME_THIS_TO_ENABLE_TEST` to `main`. Commit and push. The action will start running in the Actions tab in the repository site. + +