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

Do not use docker for running tests #4

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
280 changes: 118 additions & 162 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,133 +22,133 @@ jobs:
# with:
# msg: "Demo: <https://codesandbox.io/embed/github/${{ github.repository }}/tree/${{ github.head_ref }}?view=preview>"

build-docker:
name: build/docker
runs-on: ${{ matrix.os }}
# build-docker:
# name: build/docker
# runs-on: ${{ matrix.os }}

if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
# if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- run: docker build -t docker.pkg.github.com/maputnik/editor/editor:master .
# steps:
# - uses: actions/checkout@v2
# - run: docker build -t docker.pkg.github.com/maputnik/editor/editor:master .

# build the editor
build-node:
name: "build/node@${{ matrix.node-version }} (${{ matrix.os }})"
runs-on: ${{ matrix.os }}
# build-node:
# name: "build/node@${{ matrix.node-version }} (${{ matrix.os }})"
# runs-on: ${{ matrix.os }}

if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
# if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10.x, 12.x, 14.x]
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-latest, windows-latest, macos-latest]
# node-version: [12.x, 14.x, 16.x]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install
- run: npm run build
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v1
# with:
# node-version: ${{ matrix.node-version }}
# - uses: actions/cache@v1
# with:
# path: ~/.npm
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-node-
# - run: npm install
# - run: npm run build


build-artifacts:
name: "build/artifacts (${{ matrix.os }})"
runs-on: ${{ matrix.os }}
env:
GOPATH: ${{ github.workspace }}
GO111MODULE: off
# build-artifacts:
# name: "build/artifacts (${{ matrix.os }})"
# runs-on: ${{ matrix.os }}
# env:
# GOPATH: ${{ github.workspace }}
# GO111MODULE: off

if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
# if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: [10.x]
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-latest]
# node-version: [10.x]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install
- run: npm run build
- run: npm run build-storybook
- name: artifacts/editor
uses: actions/upload-artifact@v1
with:
name: editor
path: build/build
- run: npm run profiling-build
- name: artifacts/editor-profiling
uses: actions/upload-artifact@v1
with:
name: editor-profiling
path: build/profiling
- name: artifacts/storybook
uses: actions/upload-artifact@v1
with:
name: storybook
path: build/storybook
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v1
# with:
# node-version: ${{ matrix.node-version }}
# - uses: actions/cache@v1
# with:
# path: ~/.npm
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-node-
# - run: npm install
# - run: npm run build
# - run: npm run build-storybook
# - name: artifacts/editor
# uses: actions/upload-artifact@v1
# with:
# name: editor
# path: build/build
# - run: npm run profiling-build
# - name: artifacts/editor-profiling
# uses: actions/upload-artifact@v1
# with:
# name: editor-profiling
# path: build/profiling
# - name: artifacts/storybook
# uses: actions/upload-artifact@v1
# with:
# name: storybook
# path: build/storybook

# Build and upload desktop CLI artifacts
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.14.x
id: go
# # Build and upload desktop CLI artifacts
# - name: Set up Go
# uses: actions/setup-go@v2
# with:
# go-version: ^1.14.x
# id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
repository: maputnik/desktop
ref: v1.0.7
path: ./src/github.com/maputnik/desktop/
# - name: Check out code into the Go module directory
# uses: actions/checkout@v2
# with:
# repository: maputnik/desktop
# ref: v1.0.7
# path: ./src/github.com/maputnik/desktop/

- name: Make
run: cd src/github.com/maputnik/desktop/ && make
# - name: Make
# run: cd src/github.com/maputnik/desktop/ && make

- name: Artifacts/linux
uses: actions/upload-artifact@v1
with:
name: maputnik-linux
path: ./src/github.com/maputnik/desktop/bin/linux/
# - name: Artifacts/linux
# uses: actions/upload-artifact@v1
# with:
# name: maputnik-linux
# path: ./src/github.com/maputnik/desktop/bin/linux/

- name: Artifacts/darwin
uses: actions/upload-artifact@v1
with:
name: maputnik-darwin
path: ./src/github.com/maputnik/desktop/bin/darwin/
# - name: Artifacts/darwin
# uses: actions/upload-artifact@v1
# with:
# name: maputnik-darwin
# path: ./src/github.com/maputnik/desktop/bin/darwin/

- name: Artifacts/windows
uses: actions/upload-artifact@v1
with:
name: maputnik-windows
path: ./src/github.com/maputnik/desktop/bin/windows/
# - name: Artifacts/windows
# uses: actions/upload-artifact@v1
# with:
# name: maputnik-windows
# path: ./src/github.com/maputnik/desktop/bin/windows/

# build and test the editor in standalone-chrome
test_selenium_standalone_chrome:
name: "test/standalone-chrome (${{ matrix.os }})"
# build and test the editor
test_selenium_standalone:
name: "test/standalone-${{ matrix.browser }} (${{ matrix.os }})"
runs-on: ${{ matrix.os }}

if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
Expand All @@ -157,76 +157,32 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: [10]

container:
image: node:${{ matrix.node-version }}
options: --network-alias testhost

services:
selenium:
image: selenium/standalone-chrome:3.141.59
ports:
- 4444:4444
node-version: [16.x]
browser: [chrome, firefox]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install
- run: TEST_NETWORK=testhost DOCKER_HOST=selenium npm test
- run: ./node_modules/.bin/istanbul report --include build/coverage/coverage.json --dir build/coverage html lcov
- name: artifacts/coverage
- run: BROWSER=${{ matrix.browser }} npm run test
- if: ${{ matrix.browser == 'chrome' }}
run: ./node_modules/.bin/istanbul report --include build/coverage/coverage.json --dir build/coverage html lcov
- if: ${{ matrix.browser == 'chrome' }}
name: artifacts/coverage
uses: actions/upload-artifact@v1
with:
name: coverage
path: build/coverage
- name: artifacts/screenshots
uses: actions/upload-artifact@v1
with:
name: screenshots-chrome
name: screenshots-${{ matrix.browser }}
path: build/screenshots

# build and test the editor in standalone-firefox
test_selenium_standalone_firefox:
name: "test/standalone-firefox (${{ matrix.os }})"
runs-on: ${{ matrix.os }}

if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: [10]

container:
image: node:${{ matrix.node-version }}
options: --network-alias testhost

services:
selenium:
image: selenium/standalone-firefox:3.141.59
ports:
- 4444:4444

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install
- run: BROWSER=firefox TEST_NETWORK=testhost DOCKER_HOST=selenium npm test
- name: artifacts/screenshots
uses: actions/upload-artifact@v1
with:
name: screenshots-firefox
path: build/screenshots

16 changes: 2 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,10 @@ For testing we use [webdriverio](http://webdriver.io) and [selenium-standalone](

[selenium-standalone](https://github.com/vvo/selenium-standalone) starts a server that will launch browsers on your local machine. We use chrome so you **must** have chrome installed on your machine.

Now open a terminal and run the following. This will install the drivers on your local machine
Now open a terminal and run the following.

```
./node_modules/.bin/selenium-standalone install
```

Now start the standalone server

```
./node_modules/.bin/selenium-standalone start
```

Then open another terminal and run

```
npm test
npm run test
```

After some time you should see a browser launch which will be automated by the test runner.
Expand Down
Loading