From a4f7c46ade35c78ad28c7eddd9608c2bb1fb9976 Mon Sep 17 00:00:00 2001 From: elchananarb Date: Tue, 16 Jul 2024 13:42:01 +0300 Subject: [PATCH] update yml files for Integrate Git LFS --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 1 + .github/workflows/update-cli.yml | 26 ++++++++++++++++++++++++ 3 files changed, 61 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1712aa02..fcde3636 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,21 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + lfs: true + + - name: Install Git LFS + run: | + sudo apt-get update + sudo apt-get install git-lfs + git lfs install + + # GIT CONFIGURATION + - name: Configure Git user + run: | + git config --global user.email "you@example.com" + git config --global user.name "Your Name" + - name: Use Node.js 14 uses: actions/setup-node@v4.0.2 with: @@ -15,6 +30,25 @@ jobs: - name: Code Linting run: npm run lint - run: npm run build --if-present + + - name: Check existence of cx-linux binary + run: | + if [ ! -f "src/main/wrapper/resources/cx-linux" ]; then + echo "cx-linux binary does not exist"; exit 1; + fi + + - name: Check existence of cx.exe binary + run: | + if [ ! -f "src/main/wrapper/resources/cx.exe" ]; then + echo "cx.exe binary does not exist"; exit 1; + fi + + - name: Check existence of cx-mac binary + run: | + if [ ! -f "src/main/wrapper/resources/cx-mac" ]; then + echo "cx-mac binary does not exist"; exit 1; + fi + - name: Run tests env: CX_CLIENT_ID: ${{ secrets.CX_CLIENT_ID}} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1f425401..f599b583 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,6 +57,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + lfs: true # Ensure LFS files are checked out # GIT CONFIGURATION - run: | diff --git a/.github/workflows/update-cli.yml b/.github/workflows/update-cli.yml index 276604e5..7ba2792f 100644 --- a/.github/workflows/update-cli.yml +++ b/.github/workflows/update-cli.yml @@ -9,11 +9,26 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + lfs: true + + - name: Install Git LFS + run: | + sudo apt-get update + sudo apt-get install git-lfs + git lfs install + + - name: Configure Git user + run: | + git config --global user.name github-actions + git config --global user.email github-actions@github.com + - name: Get Latest Checkmarx API version id: checkmarx-ast-cli run: | echo ::set-output name=release_tag::$(curl -sL https://api.github.com/repos/Checkmarx/ast-cli/releases/latest | jq -r ".tag_name") echo ::set-output name=current_tag::$( checkmarx-ast-cli.version + + - name: Track large files with Git LFS + run: | + git lfs track "src/main/wrapper/resources/cx-linux" + git lfs track "src/main/wrapper/resources/cx.exe" + git lfs track "src/main/wrapper/resources/cx-mac" + git add .gitattributes + git add src/main/wrapper/resources/cx-linux src/main/wrapper/resources/cx.exe src/main/wrapper/resources/cx-mac + git commit -m "Track Checkmarx CLI binaries with Git LFS" + - name: Download latest cli and update branch if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag run: | # Update binaries chmod +x ./.github/scripts/update_cli.sh ./.github/scripts/update_cli.sh ${{ steps.checkmarx-ast-cli.outputs.release_tag }} + - name: Create Pull Request if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c #v6