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

Move to Github Actions #90

Merged
merged 38 commits into from
Jan 7, 2021
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b24c69c
wip new-ci
rolljee Dec 4, 2020
807e2cf
wip new ci
rolljee Dec 4, 2020
18b5d3c
use actions/checkout
rolljee Dec 7, 2020
8fb6ac0
wip CI
rolljee Dec 7, 2020
85bc298
Add deploy job only in master branch
rolljee Dec 7, 2020
78f2d77
Add jobs to CI
rolljee Dec 7, 2020
adf70a1
remove unused if check
rolljee Dec 7, 2020
eda6205
Nitpicking
rolljee Dec 7, 2020
95416d7
apply changes
rolljee Dec 7, 2020
e6c512f
Improve new ci
rolljee Dec 9, 2020
08f3686
rename folder in actions
rolljee Dec 9, 2020
8bcb227
wip kourou ci
rolljee Dec 10, 2020
01d24e7
Merge branch 'develop' of github.com:kuzzleio/kourou into feat/move-t…
rolljee Dec 10, 2020
541420a
merge develop
rolljee Dec 10, 2020
96f1e7c
remove option in tsconfig.json
rolljee Dec 10, 2020
adcf181
express need between build and tests
rolljee Dec 10, 2020
2030852
add missing env variable
rolljee Dec 10, 2020
05afd29
ci
rolljee Dec 10, 2020
41acbcf
add env var
rolljee Dec 10, 2020
9b287d7
Update ci
rolljee Dec 11, 2020
d4f944a
requested changes
rolljee Dec 14, 2020
be8977e
Name action steps
rolljee Dec 17, 2020
3249c5d
Put env in dedicated action file
rolljee Dec 21, 2020
de86ab8
Update .github/workflows/pull_request.workflow.yml
rolljee Dec 22, 2020
158a90c
Update .github/workflows/pull_request.workflow.yml
rolljee Dec 22, 2020
5a6409a
Update .github/workflows/pull_request.workflow.yml
rolljee Dec 22, 2020
b2becc7
Use Artifacts and better file organisation
alexandrebouthinon Jan 4, 2021
49038c8
Fix typo
alexandrebouthinon Jan 4, 2021
7731810
Fix typo in artifact path
alexandrebouthinon Jan 4, 2021
c6c92d6
Debug artifact download
alexandrebouthinon Jan 4, 2021
b7087ad
Fix artifact download and setup
alexandrebouthinon Jan 4, 2021
9a6ed61
Install only devDependencies to perform tests
alexandrebouthinon Jan 4, 2021
7ef3af4
Install all needed dependencies for tests
alexandrebouthinon Jan 4, 2021
63776ef
Try to copy features and test directory in uncompressed artifact
alexandrebouthinon Jan 4, 2021
0442d28
Copy MochaRC and NYCRC into artifact directory
alexandrebouthinon Jan 4, 2021
83ca8ea
Try to only install dev deps
alexandrebouthinon Jan 4, 2021
f24abdb
Perform last optimisations
alexandrebouthinon Jan 5, 2021
42348c8
Fix functional tests
alexandrebouthinon Jan 5, 2021
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
9 changes: 9 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Build
description: Run Build
runs:
using: "composite"
steps:
- run: npm install --silent --unsafe-perm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you use --unsafe-perm? It seems to me that runners are not containers

Suggested change
- run: npm install --silent --unsafe-perm
- run: npm install --silent

shell: bash
- run: npm run prepack
shell: bash
9 changes: 9 additions & 0 deletions .github/actions/es-lint/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: ESLint
description: Run ESLint
runs:
using: "composite"
steps:
- run: npm ci --silent
shell: bash
- run: npm run --silent test:lint
shell: bash
19 changes: 19 additions & 0 deletions .github/actions/functional-test-cucumber/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Functional Tests
description: Run Functional Tests
runs:
using: "composite"
steps:
- run: npm install --silent --unsafe-perm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you use --unsafe-perm? It seems to me that runners are not containers

Suggested change
- run: npm install --silent --unsafe-perm
- run: npm install --silent

shell: bash
- run: npm pack
shell: bash
- run: tar xf kourou-$(node -e 'console.log(require("./package.json").version)').tgz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a dedicated action to get package.json version https://github.com/marketplace/actions/get-current-package-version

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is unnecessary, see my comment below

shell: bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just run typescript compile instead of packing and unpacking?

Suggested change
- run: npm pack
shell: bash
- run: tar xf kourou-$(node -e 'console.log(require("./package.json").version)').tgz
shell: bash
- run: tsc
shell: bash

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we want to test the generated NPM package and not the source code

- run: npm install --prefix package --silent --unsafe-perm --only production
shell: bash
- run: rm -rf ./bin
shell: bash
- run: features/run-kuzzle-stack.sh
shell: bash
- run: npm run test:functional:cucumber
shell: bash
17 changes: 17 additions & 0 deletions .github/actions/functional-test-stdout/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Functional Tests
description: Run Functional Tests
runs:
using: "composite"
steps:
- run: npm install --silent --unsafe-perm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you use --unsafe-perm? It seems to me that runners are not containers

Suggested change
- run: npm install --silent --unsafe-perm
- run: npm install --silent

shell: bash
- run: npm pack
shell: bash
- run: tar xf kourou-$(node -e 'console.log(require("./package.json").version)').tgz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a dedicated action to get package.json version https://github.com/marketplace/actions/get-current-package-version

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we want to replace a very straightforward line by another dependency just to extract the version number from a package 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specially when I see the code the use for that 😅

#!/bin/sh -l
PACKAGE_JSON_PATH="${1-.}"
echo "Reading package.json from ${PACKAGE_JSON_PATH}/package.json"
PACKAGE_VERSION=$(cat ${PACKAGE_JSON_PATH}/package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')

echo ::set-output name=current-version::$PACKAGE_VERS

It looks like Github Action is the new NPM and we should be aware of including too much useless dependencies (like isPromise etc)

shell: bash
- run: npm install --prefix package --silent --unsafe-perm --only production
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you use --unsafe-perm? It seems to me that runners are not containers

Suggested change
- run: npm install --prefix package --silent --unsafe-perm --only production
- run: npm install --prefix package --silent --only production

shell: bash
- run: rm -rf ./bin
shell: bash
- run: npm run test:functional:stdout
shell: bash
96 changes: 96 additions & 0 deletions .github/workflows/pull_request.workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Run tests

on: [pull_request]

jobs:
build:
name: Build
runs-on: ubuntu-latest
rolljee marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/setup-node@v1.4.4
with:
node-version: "12"
- uses: ./.github/actions/build

lint:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, Linting job should be executed before build. No need to build the app if the code doesn't pass linters successfully

name: Lint
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/setup-node@v1.4.4
with:
node-version: "12"
- uses: ./.github/actions/es-lint

functional-test-stdout:
name: Functional Test Stdout
runs-on: ubuntu-latest
rolljee marked this conversation as resolved.
Show resolved Hide resolved
needs: lint
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/setup-node@v1.4.4
with:
node-version: "12"
- uses: ./.github/actions/functional-test-stdout
env:
KOUROU_RUNTIME: "./package/bin/run"

functional-test-cucumber:
name: Functional Test Cucumber
runs-on: ubuntu-latest
rolljee marked this conversation as resolved.
Show resolved Hide resolved
needs: lint
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
NODE_ENV: "test"
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/setup-node@v1.4.4
with:
node-version: "12"
- uses: ./.github/actions/functional-test-cucumber
env:
KOUROU_RUNTIME: "./package/bin/run"
17 changes: 17 additions & 0 deletions .github/workflows/release.workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Publish to npm

on: [release]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "12"
registry-url: "https://registry.npmjs.org"
- run: npm install
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are stored the secrets?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are stored per repository in Settings -> Secrets but I'll update the Github billing plan. So we could store them directly in the organization secrets and use them on all the repositories

112 changes: 0 additions & 112 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"noUncheckedIndexedAccess": true,
"declaration": true,
"importHelpers": true,
"module": "commonjs",
Expand Down