Skip to content

Fix bug

Fix bug #327

Workflow file for this run

name: Package Agent
'on':
push:
branches:
- master
- release
- fix-agent
permissions:
id-token: write # This is required for requesting the JWT
contents: write # This is required for actions/checkout
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- ubuntu-22.04
- macos-13
- macos-14
- windows-2022
node-version:
- 20.9.0
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# - name: Cache
# id: cache-packages
# uses: actions/cache@v4
# with:
# path: node_modules
# key: new-${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
- name: Install packages
if: steps.cache-packages.outputs.cache-hit != 'true'
run: npm ci
- name: Build with Node.js ${{ matrix.node-version }} on ${{ runner.os }}
env:
CI: true
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
npm run build
node --experimental-sea-config sea-config.json
cp $(command -v node) agent
npx postject agent NODE_SEA_BLOB agent.blob \
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
chmod +x agent
mkdir bin
cp agent bin/cli-linux-x64
npm run afterbuild
ls -al bin
- name: Build with Node.js ${{ matrix.node-version }} on ${{ runner.os }}
env:
CI: true
if: ${{ matrix.os == 'macos-13' }}
run: |
ls -al
npm run build
node --experimental-sea-config sea-config.json
cp $(command -v node) agent
codesign --remove-signature agent
npx postject agent NODE_SEA_BLOB agent.blob \
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
--macho-segment-name NODE_SEA
# codesign --sign - agent
mkdir bin
chmod +x agent
cp agent bin/cli-macos-x64
npm run afterbuild
ls -al bin
- name: Build with Node.js ${{ matrix.node-version }} on ${{ runner.os }}
env:
CI: true
if: ${{ matrix.os == 'macos-14' }}
run: |
npm run build
node --experimental-sea-config sea-config.json
cp $(command -v node) agent
codesign --remove-signature agent
npx postject agent NODE_SEA_BLOB agent.blob \
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
--macho-segment-name NODE_SEA
# codesign --sign - agent
mkdir bin
chmod +x agent
cp agent bin/cli-macos-arm64
npm run afterbuild
ls -al bin
- name: Build with Node.js ${{ matrix.node-version }} on ${{ runner.os }}
env:
CI: true
if: ${{ matrix.os == 'windows-2022' }}
run: |
npm run build
node --experimental-sea-config sea-config.json
node -e "require('fs').copyFileSync(process.execPath, 'agent.exe')"
# $signtool = "C:\Program Files (x86)\Microsoft SDKs\ClickOnce\SignTool\signtool.exe"
# $signtool remove /s agent.exe
npx postject agent.exe NODE_SEA_BLOB agent.blob `
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
# $signtool sign /fd SHA256 agent.exe
# chmod +x agent
md bin -ea 0
cp agent.exe bin/cli-win-x64.exe
cp agent.exe bin/cli-win-x86.exe
npm run afterbuild
# ls -al
- name: Set BUILD_VERSION environment variable
run: echo "BUILD_VERSION=$(node -p "require('./package').version")" >> $GITHUB_ENV
shell: bash
- name: Upload Windows x64 artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'windows-2022' }}
with:
name: katalon-agent-win-x64-${{ env.BUILD_VERSION }}
path: |
bin/cli-win-x64.exe
bin/nssm.exe
bin/*.bat
- name: Upload Windows x86 artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'windows-2022' }}
with:
name: katalon-agent-win-x86-${{ env.BUILD_VERSION }}
path: |
bin/cli-win-x86.exe
bin/nssm.exe
bin/*.bat
- name: Upload Linux x64 artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-22.04' }}
with:
name: katalon-agent-linux-x64-${{ env.BUILD_VERSION }}
path: |
bin/cli-linux-x64
bin/*.sh
- name: Upload MacOS x64 artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'macos-13' }}
with:
name: katalon-agent-macos-x64-${{ env.BUILD_VERSION }}
path: |
bin/cli-macos-x64
bin/start.sh
- name: Upload MacOS ARM64 artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'macos-14' }}
with:
name: katalon-agent-macos-arm64-${{ env.BUILD_VERSION }}
path: |
bin/cli-macos-arm64
bin/start.sh
deploy:
name: Deploy staging cloud agent
environment: staging
needs: build
strategy:
matrix:
node-version:
- 20.9.0
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install packages
run: npm install --only dev
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/katalon-github-oidc-federation
role-session-name: github-actions
aws-region: ${{ vars.AWS_REGION }}
mask-aws-account-id: 'no'
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: .
- name: Add execute permission to downloaded artifacts
run: chmod +x katalon-agent-linux-*/* katalon-agent-macos-*/*
- name: Set BUILD_VERSION environment variable
run: echo "BUILD_VERSION=$(node -p "require('./package').version")" >> $GITHUB_ENV
- name: Package artifacts
env:
GZIP: -9
run: |
set -x
mkdir -p packages
ls -la
cp katalon-agent-linux-x64-$BUILD_VERSION/cli-linux-x64 packages/cli-linux-x64
zip -9 -j packages/katalon-agent-win-x64-$BUILD_VERSION.zip katalon-agent-win-x64-$BUILD_VERSION/*
zip -9 -j packages/katalon-agent-win-x86-$BUILD_VERSION.zip katalon-agent-win-x86-$BUILD_VERSION/*
zip -9 -j packages/katalon-agent-linux-x64-$BUILD_VERSION.zip katalon-agent-linux-x64-$BUILD_VERSION/*
zip -9 -j packages/katalon-agent-macos-x64-$BUILD_VERSION.zip katalon-agent-macos-x64-$BUILD_VERSION/*
zip -9 -j packages/katalon-agent-macos-arm64-$BUILD_VERSION.zip katalon-agent-macos-arm64-$BUILD_VERSION/*
cd katalon-agent-linux-x64-$BUILD_VERSION
tar cvzf ../packages/katalon-agent-linux-x64-$BUILD_VERSION.tar.gz *
cd ..
ls -laR
aws s3 sync packages/ s3://katalon-testops-agent-beta/$BUILD_VERSION --acl public-read