Skip to content

Commit

Permalink
(chore) Minimal Github Actions workflow refactors (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskigen authored Dec 11, 2023
1 parent c2b419a commit cf5bc3e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
47 changes: 26 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
types:
- created

env:
TURBO_API: 'http://127.0.0.1:9080'
TURBO_TOKEN: ${{ secrets.TURBO_SERVER_TOKEN }}
TURBO_TEAM: ${{ github.repository_owner }}

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -21,7 +26,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: "18"

- name: Cache dependencies
id: cache
uses: actions/cache@v3
Expand All @@ -30,7 +35,7 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Set yarn version
run: yarn set version berry

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install
Expand All @@ -40,16 +45,16 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
server-token: ${{ secrets.TURBO_SERVER_TOKEN }}

- name: Run tests
run: yarn run test

- name: Run lint and typechecking
run: yarn run verify
run: yarn run verify

- name: Run build
run: yarn turbo run build --color --api="http://127.0.0.1:9080" --token="${{ secrets.TURBO_SERVER_TOKEN }}" --team="${{ github.repository_owner }}"
run: yarn turbo run build --color"

- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
Expand All @@ -73,10 +78,10 @@ jobs:
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2

- name: Compute Timestamp
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Prepare Directory
shell: bash
run: |
Expand All @@ -99,10 +104,10 @@ jobs:
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2

- name: Compute Timestamp
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Prepare Directory
shell: bash
run: |
Expand All @@ -124,14 +129,14 @@ jobs:
with:
node-version: 18
registry-url: "https://registry.npmjs.org"

- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npx lerna bootstrap
Expand All @@ -141,10 +146,10 @@ jobs:

- name: Patch
run: yarn lerna version patch --no-git-tag-version --no-push --yes

- name: Version
run: npx lerna version "$(node -e "console.log(require('./lerna.json').version)")-pre.${{ github.run_number }}" --no-git-tag-version --yes

- run: git config user.email "[email protected]" && git config user.name "KenyaEMR CI"
- run: git add . && git commit -m "Prerelease version" --no-verify

Expand All @@ -156,7 +161,7 @@ jobs:
shell: bash
run: |
ls -alh
release:
runs-on: ubuntu-latest
Expand All @@ -172,21 +177,21 @@ jobs:
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"

- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npx lerna bootstrap

- name: Build
run: yarn turbo run build --color

- name: Publish
run: yarn run ci:publish
env:
Expand Down
18 changes: 10 additions & 8 deletions e2e/README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,45 @@
# E2E Tests

This directory contains an E2E test suite using the [Playwright](https://playwright.dev)
framework.
framework.

## Getting Started

Please ensure that you have followed the basic installation guide in the
[root README](../README.md).
Once everything is set up, make sure the dev server is running by using:
Please ensure that you have followed the basic installation guide in the [root README](../README.md). Once everything is set up, make sure the dev server is running by using:

```sh
yarn start
```

Then, in a separate terminal, run:

```sh
yarn test-e2e --headed
```

By default, the test suite will run against the http://localhost:8080.
You can override this by exporting `E2E_BASE_URL` environment variables beforehand:
By default, the test suite will run against the http://localhost:8080. You can override this by exporting `E2E_BASE_URL` environment variables beforehand:

```sh
# Ex: Set the server URL to dev3:
export E2E_BASE_URL=https://dev3.openmrs.org/openmrs

# Run all e2e tests:

```sh
yarn test-e2e --headed
```

To run a specific test by title:

```sh
yarn test-e2e --headed -g "title of the test"
```

Check [this documentation](https://playwright.dev/docs/running-tests#command-line) for more running options.

It is also highly recommended to install the companion VS Code extension:
https://playwright.dev/docs/getting-started-vscode


## Writing New Tests

In general, it is recommended to read through the official [Playwright docs](https://playwright.dev/docs/intro)
Expand Down Expand Up @@ -92,8 +94,8 @@ This is very much underdeveloped/WIP. At the moment, there exists a (git-shared)
file which can be used for configuring certain test attributes. This is most likely
about to change in the future. Stay tuned for updates!
## Github Actions integration
## Github Action integration
The e2e.yml workflow is made up of two jobs: one for running on pull requests (PRs) and
one for running on commits.
Expand Down

0 comments on commit cf5bc3e

Please sign in to comment.