Skip to content

Commit

Permalink
feat: simplify action
Browse files Browse the repository at this point in the history
  • Loading branch information
manumbs committed Jul 29, 2024
1 parent 6a4260a commit d31123e
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 102 deletions.
51 changes: 10 additions & 41 deletions .github/actions/actions-setup-sap-rfc/action.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
name: 'Setup SAP RFC environment'
description: 'Setup a SAP RFC environment by installing the SDK.'
name: Setup SAP RFC environment
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)'
default: 'linux'
description: 'GitHub token'
sdk-version:
required: false
description: 'RFC SDK version (only supports for 750)'
Expand All @@ -19,43 +15,16 @@ inputs:
default: '11'

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
- name: Run Action
uses: ./setup-sap-rfc-sdk
with:
patch-level: ${{ inputs.patch-level }}
sdk-version: ${{ inputs.sdk-version }}
56 changes: 25 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,59 @@ 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
uses: ./.github/workflows/reusable-actions-setup-sap-rfc.yml
with:
github-token: ${{ secrets.GH_TOKEN }}
patch-level: '11'

- name: Install dependencies
patch-level: 11
- 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
uses: ./.github/actions/reusable-actions-setup-sap-rfc
with:
github-token: ${{ secrets.GH_TOKEN }}
patch-level: '11'

- run: npm ci
- run: npm run semantic-release
- 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
25 changes: 14 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
name: Publish

on:
release:
types: [created]

jobs:
publish-npm:
runs-on: ubuntu-latest
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
- 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
uses: ./.github/actions/reusable-actions-setup-sap-rfc
with:
github-token: ${{ secrets.GH_TOKEN }}
patch-level: '11'

- run: npm ci
- run: npm run build
- run: npm publish
- 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 }}
33 changes: 15 additions & 18 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,46 @@ on:
- '**/*.md'
- '**/*.yml'
- '**/*.yaml'
- .github/**
- '.github/**'
pull_request:
types: [opened, synchronize, reopened]
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
uses: ./.github/actions/reusable-actions-setup-sap-rfc
with:
github-token: ${{ secrets.GH_TOKEN }}
patch-level: '11'

- 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 d31123e

Please sign in to comment.