diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index db0ca92..ae2b964 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -8,4 +8,4 @@ updates: interval: "weekly" target-branch: "development" reviewers: - - "splitio/sdk" \ No newline at end of file + - "splitio/sdk" diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml deleted file mode 100644 index 79446f3..0000000 --- a/.github/workflows/cd.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: cd -on: - push: - branches: - - master - -jobs: - push-docker-image: - name: Build and Push Docker Image - runs-on: ubuntu-latest - steps: - - name: Login to Artifactory - uses: docker/login-action@v3 - with: - registry: splitio-docker-dev.jfrog.io - username: ${{ secrets.ARTIFACTORY_DOCKER_USER }} - password: ${{ secrets.ARTIFACTORY_DOCKER_PASS }} - - - name: Checkout code - uses: actions/checkout@v4 - - - name: Create build version - run: echo "BUILD_VERSION=$(cat package.json | grep version | head -1 | awk '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')" >> $GITHUB_ENV - - - name: Docker Build and Push - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: splitio-docker-dev.jfrog.io/${{ github.event.repository.name }}:latest, splitio-docker-dev.jfrog.io/${{ github.event.repository.name }}:${{ env.BUILD_VERSION}} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 47d0059..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: ci -on: - pull_request: - branches-ignore: - - none - -jobs: - build-and-test: - name: Build and test - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 18.18.0 - - - run: npm ci - - run: npm run lint - - run: npm run test - - build-docker-image: - name: Build Docker Image - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Docker Build - uses: docker/build-push-action@v5 - with: - context: . - push: false - tags: splitio-docker-dev.jfrog.io/${{ github.event.repository.name }}:latest - - - name: Scan container using Lacework - uses: lacework/lw-scanner-action@v1.3.0 - with: - LW_ACCOUNT_NAME: ${{ secrets.LW_ACCOUNT_NAME }} - LW_ACCESS_TOKEN: ${{ secrets.LW_ACCESS_TOKEN }} - IMAGE_NAME: splitio-docker-dev.jfrog.io/${{ github.event.repository.name }} - IMAGE_TAG: latest - SAVE_RESULTS_IN_LACEWORK: true - SAVE_BUILD_REPORT: true - BUILD_REPORT_FILE_NAME: ${{ github.event.repository.name }}.html - - - name: Save vulnerability report - if: always() - uses: actions/upload-artifact@v4 - with: - name: vulnerability_report - path: ${{ github.event.repository.name }}.html - retention-days: 7 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..b2e1735 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,78 @@ +name: docker + +on: + push: + branches: + - master + pull_request: + branches: + - master + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.run_number || github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + docker: + name: Build Docker image + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: amd64,arm64 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Artifactory + if: ${{ github.event_name == 'push' }} + uses: docker/login-action@v3 + with: + registry: splitio-docker-dev.jfrog.io + username: ${{ secrets.ARTIFACTORY_DOCKER_USER }} + password: ${{ secrets.ARTIFACTORY_DOCKER_PASS }} + + - name: Create build version + run: echo "BUILD_VERSION=$(cat package.json | grep version | head -1 | awk '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')" >> $GITHUB_ENV + + - name: Docker build + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name == 'push' }} + platforms: linux/amd64,linux/arm64 + tags: splitio-docker-dev.jfrog.io/${{ github.event.repository.name }}:${{ env.BUILD_VERSION}},splitio-docker-dev.jfrog.io/${{ github.event.repository.name }}:latest + + lacework: + name: Scan Docker image + if: ${{ github.event_name == 'pull_request' }} + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Create build version + run: echo "BUILD_VERSION=$(cat package.json | grep version | head -1 | awk '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')" >> $GITHUB_ENV + + - name: Docker build + uses: docker/build-push-action@v5 + with: + context: . + push: false + tags: splitio-docker-dev.jfrog.io/${{ github.event.repository.name }}:${{ env.BUILD_VERSION}} + build-args: | + ARTIFACTORY_USER=${{ secrets.ARTIFACTORY_USER }} + ARTIFACTORY_TOKEN=${{ secrets.ARTIFACTORY_TOKEN }} + + - name: Scan container using Lacework + uses: lacework/lw-scanner-action@v1.4.1 + with: + LW_ACCOUNT_NAME: ${{ secrets.LW_ACCOUNT_NAME }} + LW_ACCESS_TOKEN: ${{ secrets.LW_ACCESS_TOKEN }} + IMAGE_NAME: splitio-docker-dev.jfrog.io/${{ github.event.repository.name }} + IMAGE_TAG: ${{ env.BUILD_VERSION}} + SAVE_RESULTS_IN_LACEWORK: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7a82083 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: test + +on: + pull_request: + branches-ignore: + - none + +jobs: + build-and-test: + name: Build and test + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 18.18.0 + + - run: npm ci + - run: npm run lint + - run: npm run test diff --git a/.github/workflows/unstable.yml b/.github/workflows/unstable.yml index 1bb6c03..f921f80 100644 --- a/.github/workflows/unstable.yml +++ b/.github/workflows/unstable.yml @@ -1,4 +1,5 @@ name: unstable + on: push: branches-ignore: @@ -19,8 +20,13 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Create build version - run: echo "BUILD_VERSION=$(cat package.json | grep version | head -1 | awk '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')" >> $GITHUB_ENV + - name: Setup QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: amd64,arm64 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Get short hash run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV @@ -30,4 +36,5 @@ jobs: with: context: . push: true + platforms: linux/amd64,linux/arm64 tags: splitio-docker-dev.jfrog.io/${{ github.event.repository.name }}:${{ env.SHORT_SHA}}