Skip to content
This repository was archived by the owner on Apr 15, 2022. It is now read-only.
Open
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
10 changes: 9 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
name: CI
on: [pull_request, push, workflow_dispatch]
on:
pull_request:

push:
branches-ignore:
- 'ci/test_ci'

workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

set -e

function log {
type=${1}
message=${2}

template="==> [$(date '+%Y-%m-%d %H:%M:%S')]"

case ${type^^} in
DEBUG|D)
echo -e "\n${template} \e[1;30m;[DEBUG]\e[0m ${message}" >&2
;;
INFO|I)
echo -e "\n${template} \e[1;36m[INFO]\e[0m ${message}" >&2
;;
WARN|W)
echo -e "\n${template} \e[1;33m;[WARN]\e[0m ${message}" >&2
;;
ERROR|E)
echo -e "\n${template} \e[1;31m;[ERROR]\e[0m ${message}" >&2
;;
* )
echo -e "\n${template} \e[1;32m;[LOG]\e[0m Incorrect log type: ${type}" >&2
;;
esac
}

pushd /github/ > /dev/null

log "info" "Running example/scripts/provision-linux.sh"
bash example/scripts/provision-linux.sh

log "info" "npm version $(npm --version)"

log "info" "install yarn"
npm install --global yarn

log "info" "yarn version $(yarn --version)"

log "info" "Running yarn"
yarn

log "info" "Running yarn test"
yarn test

popd
22 changes: 22 additions & 0 deletions .github/workflows/test_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test_CI
on:
workflow_dispatch:
push:
branches:
- 'ci/test_ci'

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Make script executable
run: chmod -v +x .github/workflows/*.sh
- name: Pull docker image
run: docker pull semenovoleksii/internet_identity:latest_runnable
- name: Show docker images
run: docker images | grep internet_identity
- name: Run docker image
run: docker run -d --rm --name dfx -v $(pwd):/github/ semenovoleksii/internet_identity:latest_runnable
- name: Run command inside dfx
run: docker exec -t dfx /github/.github/workflows/run_tests.sh
37 changes: 1 addition & 36 deletions example/makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,3 @@
.PHONY: all
all: deploy

.PHONY: dfx_start
.SILENT: dfx_start
dfx_start:
dfx start --clean --background

.PHONY: identity
.SILENT: identity
identity: dfx_start
dfx identity use gin_admin

.PHONY: deploy-local
.SILENT: deploy-local
deploy-local: dfx_start
dfx identity new gh_action_admin
dfx identity use gh_action_admin
test:
dfx deploy

.PHONY: deploy
.SILENT: deploy
deploy:
dfx identity use gh_action_admin
dfx deploy --network ic --no-wallet

.PHONY: stop
.SILENT: stop
clean:
dfx identity use default
dfx identity remove gh_action_admin
dfx stop

.PHONY: test
.SILENT: test
test: deploy-local
dfx canister call profile whoami | egrep "principal" && echo 'PASS'
make clean