Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Move to github actions (#1353)
Browse files Browse the repository at this point in the history
* move to github actions

* fix

* fix

* Update js-api-build.yml

* Update js-api-build.yml

* Update js-api-build.yml

* Update js-api-build.yml

* Update js-api-build.yml

* Update js-api-build.yml

* fix

* fix

* Update js-api-build.yml

* Update js-api-build.yml

* Update package.json

* Update js-api-build.yml

* Update js-api-build.yml

* Update js-api-build.yml

* Update js-api-build.yml

* Update js-api-build.yml

* done

* Update .mergify.yml

* Update .mergify.yml

* Update .mergify.yml

* Update .mergify.yml

* Update js-api-build.yml

* Update js-api-build.yml
  • Loading branch information
eromano authored Mar 25, 2022
1 parent 801deae commit 20abc29
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 179 deletions.
116 changes: 116 additions & 0 deletions .github/workflows/js-api-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: "JS-API"
on:
push:
branches:
- master
- develop
- /.*beta.*/
pull_request:
branches:
- develop
schedule:
- cron: '0 3 * * *' # nightly
env:
GITHUB_REPO_SLUG: ${{ github.repository }}
GITHUB_BRANCH: ${{ github.head_ref }}
GITHUB_PULL_REQUEST: ${{ github.event.number }}
GITHUB_BUILD_NUMBER: ${{ github.run_number }}
NPM_REGISTRY_TOKEN: ${{ github.NPM_REGISTRY_TOKEN }}
NPM_REGISTRY_ADDRESS: ${{ github.NPM_REGISTRY_ADDRESS }}

jobs:
build:
name: "build and lint"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 2

- name: node
uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'npm'
- run: npm ci

- name: Lint
run: |
./scripts/lint.sh
- name: Build
run: |
./scripts/build.sh || exit 1
test:
needs: build
name: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 2

- name: node
uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'npm'
- run: npm ci

- name: Unit test
shell: bash
run: |
npm run test || exit 1
npm run coverage
- name: Perfomance
shell: bash
run: ./scripts/test-performance.sh || exit 1

- name: Integration
env:
HOST: ${{ secrets.HOST }}
USERNAME: ${{ secrets.USERNAME }}
PASSWORD: ${{ secrets.PASSWORD }}
shell: bash
run: ./scripts/test-integration.sh || exit 1

release:
needs: test
name: release
runs-on: ubuntu-latest
if: github.head_ref == 'master' || github.event.schedule == '0 3 * * *'
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 2

- name: node
uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'npm'
- run: npm ci

- name: Release
if: github.head_ref == 'master' || github.head_ref == 'develop'
shell: bash
run: |
./scripts/build.sh || exit 1
./scripts/publish.sh
- name: Release Tag
if: github.head_ref == 'master'
shell: bash
run: |
./scripts/git-tag.sh
- name: Trigger ADF alpha
shell: bash
if: github.event.schedule == '0 3 * * *'
run: ./scripts/update-project.sh -p ${{ github.run_number }} -t ${{ secrets.GITHUB_TOKEN }} -v alpha

21 changes: 13 additions & 8 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@ pull_request_rules:
- name: automatic merge for Dependabot pull requests
conditions:
- author=dependabot[bot]
- status-success=bundlesize
- status-success=Travis CI - Pull Request
- "status-success=Code scanning - action / CodeQL-Build (pull_request)"
- "status-success=JS-API / build and lint (pull_request)"
- "status-success=JS-API / test (pull_request)"
- "status-success=JS-API / release"
actions:
merge:
method: merge
merge:
method: squash

- name: merge when all requested reviews are valid
conditions:
- status-success=Travis CI - Pull Request
- "status-success=Code scanning - action / CodeQL-Build (pull_request)"
- "status-success=JS-API / build and lint (pull_request)"
- "status-success=JS-API / test (pull_request)"
- "status-success=JS-API / release"
- status-success=bundlesize
- '#approved-reviews-by>=1'
- '#changes-requested-reviews-by=0'
- '#commented-reviews-by=0'
- label!=do not merge
actions:
merge:
method: squash
strict: true
merge:
method: squash
79 changes: 0 additions & 79 deletions .travis.yml

This file was deleted.

9 changes: 3 additions & 6 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ rm -rf node_modules/@alfresco/js-api/

npm install @alfresco/adf-cli@alpha --no-save

if [[ $TRAVIS_PULL_REQUEST == "false" ]];
if [[ $GITHUB_PULL_REQUEST == "false" ]];
then
if [[ $TRAVIS_BRANCH == "develop" ]];
if [[ $GITHUB_BRANCH == "develop" ]];
then
NEXT_VERSION=-nextalpha
if [[ $TRAVIS_EVENT_TYPE == "cron" ]];
then
NEXT_VERSION=-nextbeta
fi

./scripts/update-version.sh -gnu $NEXT_VERSION || exit 1;
fi

Expand Down
6 changes: 1 addition & 5 deletions scripts/git-tag.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/bin/bash

if [[ $TRAVIS_BRANCH == "master" ]]; then
VERSION=$(cat package.json | grep version | head -1 | awk -F= "{ print $2 }" | sed 's/[version:,\",]//g' | tr -d '[[:space:]]')
else
VERSION=$(npm view @alfresco/js-api@beta version)
fi;
VERSION=$(cat package.json | grep version | head -1 | awk -F= "{ print $2 }" | sed 's/[version:,\",]//g' | tr -d '[[:space:]]')

echo $VERSION

Expand Down
2 changes: 1 addition & 1 deletion scripts/next_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fi

if [[ "${EXEC_ALPHA}" == true ]]
then
NEXT_VERSION=${NEXT_VERSION}-${TRAVIS_BUILD_NUMBER}
NEXT_VERSION=${NEXT_VERSION}-${GITHUB_BUILD_NUMBER}
fi

if [[ "${EXEC_BETA}" == true ]]
Expand Down
39 changes: 14 additions & 25 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,25 @@
#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

cd $DIR/..

if [[ $TRAVIS_PULL_REQUEST == "false" ]];
then
TAG_NPM=latest
if [[ $TRAVIS_BRANCH == "develop" ]];
then
TAG_NPM=alpha
if [[ $TRAVIS_EVENT_TYPE == "cron" ]];
then
TAG_NPM=beta
fi
fi

cd dist/
TAG_NPM=alpha

echo "Publishing on npm with tag $TAG_NPM"

touch .npmrc
echo 'strict-ssl=true' >> .npmrc
echo 'registry=https://${NPM_REGISTRY_ADDRESS}' >> .npmrc
echo '//${NPM_REGISTRY_ADDRESS}/:_authToken="${NPM_REGISTRY_TOKEN}"' >> .npmrc
if [[ $GITHUB_BRANCH == "master" ]]; then
TAG_NPM=latest
fi

cat package.json | grep version
cd dist/

npm publish --tag ${TAG_NPM} --access public || exit 1
rm -rf .npmrc
echo "Publishing on npm with tag $TAG_NPM"

cd ../../
touch .npmrc
echo 'strict-ssl=true' >>.npmrc
echo 'registry=https://${NPM_REGISTRY_ADDRESS}' >>.npmrc
echo '//${NPM_REGISTRY_ADDRESS}/:_authToken="${NPM_REGISTRY_TOKEN}"' >>.npmrc

fi;
cat package.json | grep version

npm publish --tag ${TAG_NPM} --access public || exit 1
rm -rf .npmrc
55 changes: 0 additions & 55 deletions scripts/trigger-travis.sh

This file was deleted.

0 comments on commit 20abc29

Please sign in to comment.