Skip to content

Commit

Permalink
feat: simplify action (#1172)
Browse files Browse the repository at this point in the history
  • Loading branch information
manumbs authored Aug 5, 2024
1 parent 6a4260a commit 6921dcb
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 110 deletions.
68 changes: 21 additions & 47 deletions .github/actions/actions-setup-sap-rfc/action.yaml
Original file line number Diff line number Diff line change
@@ -1,61 +1,35 @@
name: 'Setup SAP RFC environment'
description: 'Setup a SAP RFC environment by installing the SDK.'
name: Setup SAP RFC
description: Setup a SAP RFC environment by installing the SDK

inputs:
github-token:
required: true
description: 'The Github PAT (personal access token)'
os:
required: false
description: 'System Operation (only supports for linux)'
description: 'Operating System (only supports linux)'
default: 'linux'
sdk-version:
required: false
description: 'RFC SDK version (only supports for 750)'
default: '750'
patch-level:
required: false
description: 'RFC SDK patch level (only supports for 10)'
description: 'RFC SDK patch level (only supports 11)'
default: '11'
required: false
sdk-version:
description: 'RFC SDK version (only supports 750)'
default: '750'
required: false
token:
description: 'GitHub PAT'
required: true

runs:
using: 'composite'
using: composite
steps:
- name: Checkout Setup SAP RFC SDK
- name: Checkout
uses: actions/checkout@v4
with:
repository: grupoboticario/actions-setup-sap-rfc
path: setup-sap-rfc-sdk
token: ${{ inputs.github-token }}

- name: Setup SAP RFC SDK
shell: bash
if: ${{ inputs.os == 'linux' }}
run: |
echo "Listing contents..."
ls -l
echo "Listing SAP RFC SDK contents..."
ls -l $SETUP_SAP_RFC_SDK_DIR
echo "Copying nwrfcsdk.conf..."
sudo cp $SETUP_SAP_RFC_SDK_DIR/assets/nwrfcsdk.conf /etc/ld.so.conf.d/
ls -l /etc/ld.so.conf.d/
echo "Unziping nwrfc${{ inputs.sdk-version }}P_${{ inputs.patch-level }}_${{ inputs.os }}.zip..."
sudo unzip -o $SETUP_SAP_RFC_SDK_DIR/assets/nwrfc${{ inputs.sdk-version }}P_${{ inputs.patch-level }}_${{ inputs.os }}.zip -d /usr/local/sap
ls -l /usr/local/sap
echo "Exporting SAPNWRFC_HOME..."
export SAPNWRFC_HOME=/usr/local/sap/nwrfcsdk
echo $SAPNWRFC_HOME
echo "Running ldconfig..."
sudo ldconfig
echo "Removing SAP RFC SDK contents..."
rm -rf $SETUP_SAP_RFC_SDK_DIR
echo "SAP RFC SDK ${{ inputs.sdk-version }}P_${{ inputs.patch-level }}_${{ inputs.os }} has been successfully configured!!!"
env:
SETUP_SAP_RFC_SDK_DIR: setup-sap-rfc-sdk
token: ${{ inputs.token }}
- name: Run Action
uses: ./setup-sap-rfc-sdk
with:
os: ${{ inputs.os }}
patch-level: ${{ inputs.patch-level }}
sdk-version: ${{ inputs.sdk-version }}
55 changes: 24 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: CI

on:
Expand All @@ -10,62 +7,58 @@ on:
- '**/*.md'
- '**/*.yml'
- '**/*.yaml'
- .github/**
- '.github/**'
pull_request:
branches: [main]
paths-ignore:
- '**/*.md'
- '**/*.yml'
- '**/*.yaml'
- .github/**
- '.github/**'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

cache: npm
node-version-file: .nvmrc
- name: Setup SAP RFC SDK
uses: ./.github/actions/actions-setup-sap-rfc
with:
github-token: ${{ secrets.GH_TOKEN }}
patch-level: '11'

- name: Install dependencies
token: ${{ secrets.GH_TOKEN }}
- name: Install Dependencies
run: npm ci

- name: Build
run: npm run build

- name: Test
run: npm run test
env:
CI: true

release:
needs: build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

cache: npm
node-version-file: .nvmrc
- name: Setup SAP RFC SDK
uses: ./.github/actions/actions-setup-sap-rfc
with:
github-token: ${{ secrets.GH_TOKEN }}
patch-level: '11'

- run: npm ci
- run: npm run semantic-release
token: ${{ secrets.GH_TOKEN }}
- name: Install Dependencies
run: npm ci
- name: Semantic Release
run: npm run semantic-release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
- '**/*.md'
- '**/*.yml'
- '**/*.yaml'
- .github/**
- '.github/**'
schedule:
- cron: '30 10 * * 0'

Expand Down
28 changes: 16 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
name: Publish

on:
release:
types: [created]

jobs:
publish-npm:
runs-on: ubuntu-latest
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache: npm
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org/

- name: Setup SAP RFC SDK
uses: ./.github/actions/actions-setup-sap-rfc
with:
github-token: ${{ secrets.GH_TOKEN }}
patch-level: '11'

- run: npm ci
- run: npm run build
- run: npm publish
token: ${{ secrets.GH_TOKEN }}
- name: Install Dependencies
run: npm ci
- name: Build
run: npm run build
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_AUTH_TOKEN }}
36 changes: 17 additions & 19 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,47 @@ on:
- '**/*.md'
- '**/*.yml'
- '**/*.yaml'
- .github/**
- '.github/**'
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
paths-ignore:
- '**/*.md'
- '**/*.yml'
- '**/*.yaml'
- .github/**
- '.github/**'
workflow_dispatch:

jobs:
sonarCloudTrigger:
name: SonarCloud Trigger
runs-on: ubuntu-latest
sonarAnalysis:
name: Sonar Analysis
runs-on: [ubuntu-latest]
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
- uses: actions/setup-node@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

cache: npm
node-version-file: .nvmrc
- name: Setup SAP RFC SDK
uses: ./.github/actions/actions-setup-sap-rfc
with:
github-token: ${{ secrets.GH_TOKEN }}
patch-level: '11'

token: ${{ secrets.GH_TOKEN }}
- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Test
run: npm run test:cov
env:
CI: true

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
uses: grupoboticario/actions-ci-sonarcloud@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}

0 comments on commit 6921dcb

Please sign in to comment.