diff --git a/.github/workflows/PullRequest.yml b/.github/workflows/PullRequest.yml new file mode 100644 index 0000000..1086ea2 --- /dev/null +++ b/.github/workflows/PullRequest.yml @@ -0,0 +1,80 @@ +name: Docker And Node Test +on: + pull_request: + branches: + - main + +jobs: + CodeQL: + name: Analyze + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: "javascript" + + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 + + Node: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: + - 14.x + - 15.x + - 16.x + + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2.4.0 + with: + node-version: ${{ matrix.node-version }} + + - name: Edit Version + env: + RunID: ${{ github.run_id }} + run: node .github/ChangeVersion.js + + - name: Install node depedencies + run: npm install -d --no-save + + - name: Run test + run: npm test + + Docker-Multiarch: + runs-on: ubuntu-latest + strategy: + matrix: + arch: + - amd64 + - arm64 + - arm/v7 + + name: "Build And Test Docker Image, Arch: ${{ matrix.arch }}" + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: checkout + uses: actions/checkout@master + + - name: Build Docker Image (Multiarch) + id: DockerArch + uses: docker/build-push-action@v2 + with: + target: bdscore + tags: coretestarch:latest + platforms: linux/${{ matrix.arch }} \ No newline at end of file diff --git a/.github/workflows/codeql and ossar analysis.yml b/.github/workflows/codeql and ossar analysis.yml deleted file mode 100644 index a830bca..0000000 --- a/.github/workflows/codeql and ossar analysis.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: "CodeQL and OSSAR" -on: - push: - branches: - - main - pull_request: - branches: - - main - schedule: - - cron: "38 17 * * */3" - - cron: '36 21 * * 2' - -jobs: - OSSAR-Scan: - runs-on: windows-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Run OSSAR - uses: github/ossar-action@v1 - id: ossar - - name: Upload OSSAR results - uses: github/codeql-action/upload-sarif@v1 - with: - sarif_file: ${{ steps.ossar.outputs.sarifFile }} - - analyze: - name: Analyze - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - language: [ "javascript" ] - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8fc847d..6cd97fe 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,6 +8,24 @@ env: DOCKER_ARCH: linux/amd64,linux/arm64,linux/arm/v7 jobs: + CodeQL: + name: Analyze + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: "javascript" + + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 + npm: runs-on: ubuntu-latest steps: @@ -21,7 +39,7 @@ jobs: - name: Edit Version env: - RunID: ${{ github.run_id }} + RunID: ${{ github.run_id }} run: node .github/ChangeVersion.js - name: Install Packages @@ -30,7 +48,7 @@ jobs: - name: NPM Publish run: npm publish --tag dev env: - NODE_AUTH_TOKEN: "${{ secrets.NPM_ORG_TOKEN }}" + NODE_AUTH_TOKEN: '${{ secrets.NPM_ORG_TOKEN }}' docker_core: needs: [npm] @@ -45,8 +63,9 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v1 with: - username: ${{ secrets.DOCKER_ORG_USER }} - password: ${{ secrets.DOCKER_ORG_PASS }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: checkout uses: actions/checkout@master @@ -57,7 +76,7 @@ jobs: with: push: true target: bdscore - tags: bdsmaneger/core:main + tags: ghcr.io/the-bds-maneger/core:main platforms: ${{ env.DOCKER_ARCH }} docker_base: @@ -73,8 +92,9 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v1 with: - username: ${{ secrets.DOCKER_ORG_USER }} - password: ${{ secrets.DOCKER_ORG_PASS }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: checkout uses: actions/checkout@master @@ -85,7 +105,5 @@ jobs: with: push: true target: bdsbase - tags: | - bdsmaneger/base:main - bdsmaneger/node_image:main + tags: ghcr.io/the-bds-maneger/base:main platforms: ${{ env.DOCKER_ARCH }} diff --git a/.github/workflows/package_test.yml b/.github/workflows/package_test.yml deleted file mode 100644 index f0c049e..0000000 --- a/.github/workflows/package_test.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Test - The Bds Maneger Core -on: [pull_request] - -jobs: - Test: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [14.x, 15.x, 16.x] - steps: - - uses: actions/checkout@v2 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2.4.0 - with: - node-version: ${{ matrix.node-version }} - - - name: Edit Version - env: - RunID: ${{ github.run_id }} - run: node .github/ChangeVersion.js - - - name: Install node depedencies - run: npm install -d --no-save - - - name: Run test - run: npm run ci - - Test_Docker: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: checkout - uses: actions/checkout@master - - - name: Build Docker Image - uses: docker/build-push-action@v2 - with: - target: bdscore - tags: coretest:latest - platforms: linux/amd64,linux/arm64,linux/arm/v7 diff --git a/.github/workflows/tag_version.yml b/.github/workflows/relelases.yml similarity index 80% rename from .github/workflows/tag_version.yml rename to .github/workflows/relelases.yml index 7dea2e7..223a691 100644 --- a/.github/workflows/tag_version.yml +++ b/.github/workflows/relelases.yml @@ -1,4 +1,4 @@ -name: Npm Packages Stable and Docker Image +name: Publish Releases on: release: types: @@ -44,8 +44,9 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v1 with: - username: ${{ secrets.DOCKER_ORG_USER }} - password: ${{ secrets.DOCKER_ORG_PASS }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: checkout uses: actions/checkout@master @@ -56,7 +57,7 @@ jobs: with: push: true target: bdscore - tags: bdsmaneger/core:latest + tags: ghcr.io/the-bds-maneger/core:latest platforms: ${{ env.DOCKER_ARCH }} docker_base: @@ -72,8 +73,9 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v1 with: - username: ${{ secrets.DOCKER_ORG_USER }} - password: ${{ secrets.DOCKER_ORG_PASS }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: checkout uses: actions/checkout@master @@ -84,9 +86,5 @@ jobs: with: push: true target: bdsbase - tags: | - bdsmaneger/base:latest - bdsmaneger/base:${{ github.run_id }} - bdsmaneger/node_image:latest - bdsmaneger/node_image:${{ github.run_id }} + tags: ghcr.io/the-bds-maneger/base:latest platforms: ${{ env.DOCKER_ARCH }} diff --git a/bin/Docker.js b/bin/Docker.js index 2044f1e..1dc1cf5 100644 --- a/bin/Docker.js +++ b/bin/Docker.js @@ -54,6 +54,14 @@ function StartServer(){ } }); } + // Debug Arch + if (process.env.DebugArch === "true") { + console.log("Debug Arch:", process.arch); + setTimeout(() => { + console.log("Stop Server end debug"); + process.exit(0); + }, 1000); + } } // Check Installed Server