diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index a20fe5b0..00000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,3 +0,0 @@ -# These are supported funding model platforms - -github: weejewel diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index dd84ea78..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/workflows/deploy-nightly.yml b/.github/workflows/deploy-nightly.yml deleted file mode 100644 index efff9525..00000000 --- a/.github/workflows/deploy-nightly.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Build & Publish Docker Image to Docker Hub - -on: - workflow_dispatch: - schedule: - - cron: "0 12 * * *" - -jobs: - deploy: - name: Build & Deploy - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: production - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - # Set environment variables - - run: echo RELEASE=$(cat ./src/package.json | jq -r .release) >> $GITHUB_ENV - - # Build & Publish - - name: Build & Publish Docker Image - uses: docker/build-push-action@v2 - with: - push: true - platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 - tags: weejewel/wg-easy:nightly, weejewel/wg-easy:${{ env.RELEASE }}-nightly diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 0f2fe55d..00000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Build & Publish Docker Image to Docker Hub - -on: - workflow_dispatch: - push: - branches: - - production - - production/** - -jobs: - deploy: - name: Build & Deploy - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: production - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - # Set environment variables - - run: echo RELEASE=$(cat ./src/package.json | jq -r .release) >> $GITHUB_ENV - - # Build & Publish - - name: Build & Publish Docker Image - uses: docker/build-push-action@v2 - with: - push: true - platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 - tags: weejewel/wg-easy:latest, weejewel/wg-easy:${{ env.RELEASE }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index b2a65b9f..00000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Lint - -on: - push: - branches: - - master - - production - pull_request: - -jobs: - lint: - name: Lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: '14' - - - run: | - cd src - npm ci - npm run lint diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..9411a6a8 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,60 @@ +name: Publish + +# Controls when the workflow will run +on: + # Triggers the workflow on release tag creation in the repository + release: + types: [released] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + build-and-publish: + runs-on: self-hosted + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Docker meta + id: docker_meta + uses: docker/metadata-action@v4 + with: + # list of Docker images to use as base name for tags + images: | + ${{ secrets.DATOMS_DOCKER_IMAGE_NAME }} + # generate Docker tags based on the following attributes + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha,prefix=,format=short + # https://docs.docker.com/language/java/configure-ci-cd/#optimize-the-workflow + # - name: Cache Docker layers + # uses: actions/cache@v3 + # with: + # path: /tmp/.buildx-cache + # key: ${{ runner.os }}-buildx-${{ github.sha }} + # restore-keys: | + # ${{ runner.os }}-buildx- + - name: Build and push + uses: docker/build-push-action@v3 + with: + build-args: | + DATOMS_JS_REGISTRY_USER=${{ secrets.DATOMS_JS_REGISTRY_USER }} + DATOMS_JS_REGISTRY_PASSWORD=${{ secrets.DATOMS_JS_REGISTRY_PASSWORD }} + DATOMS_JS_REGISTRY_EMAIL=${{ secrets.DATOMS_JS_REGISTRY_EMAIL }} + DATOMS_JS_REGISTRY_URL=${{ secrets.DATOMS_JS_REGISTRY_URL }} + CI=${{ secrets.CI }} + # cache-from: type=local,src=/tmp/.buildx-cache + # cache-to: type=local,dest=/tmp/.buildx-cache + push: true + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.tags }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..932dee86 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,140 @@ +name: Release + +# Controls when the workflow will run +on: + # Triggers the workflow on push to main / master branch in the repository + push: + branches: + - main + - master + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + vulnerability-assessment: + # The type of runner that the job will run on + runs-on: self-hosted + # Docker image + container: node:16.19.0 + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Checkout + uses: actions/checkout@v3 + - run: yarn audit --groups dependencies + continue-on-error: true + + code-style-check: + runs-on: self-hosted + container: node:16.19.0 + steps: + - name: Checkout + uses: actions/checkout@v3 + - run: npx prettier --check . + + code-syntax-check: + runs-on: self-hosted + container: node:16.19.0 + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: NPM Login + env: + DATOMS_JS_REGISTRY_USER: ${{ secrets.DATOMS_JS_REGISTRY_USER }} + DATOMS_JS_REGISTRY_PASSWORD: ${{ secrets.DATOMS_JS_REGISTRY_PASSWORD }} + DATOMS_JS_REGISTRY_EMAIL: ${{ secrets.DATOMS_JS_REGISTRY_EMAIL }} + DATOMS_JS_REGISTRY_URL: ${{ secrets.DATOMS_JS_REGISTRY_URL }} + run: npm i -g npm-cli-login && npm-cli-login -u $DATOMS_JS_REGISTRY_USER -p $DATOMS_JS_REGISTRY_PASSWORD -e $DATOMS_JS_REGISTRY_EMAIL -r $DATOMS_JS_REGISTRY_URL -s @datoms + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Setup Yarn Cache + uses: actions/cache@v3 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: NPM Install + run: yarn + - run: yarn test:syntax + + build: + runs-on: self-hosted + needs: [vulnerability-assessment, code-style-check, code-syntax-check] + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Docker meta + id: docker_meta + uses: docker/metadata-action@v4 + with: + # list of Docker images to use as base name for tags + images: | + ${{ secrets.DATOMS_DOCKER_IMAGE_NAME }} + # generate Docker tags based on the following attributes + tags: | + type=sha,prefix=,format=short + # https://docs.docker.com/language/java/configure-ci-cd/#optimize-the-workflow + # - name: Cache Docker layers + # uses: actions/cache@v3 + # with: + # path: /tmp/.buildx-cache + # key: ${{ runner.os }}-buildx-${{ github.sha }} + # restore-keys: | + # ${{ runner.os }}-buildx- + - name: Build and push + uses: docker/build-push-action@v3 + with: + build-args: | + DATOMS_JS_REGISTRY_USER=${{ secrets.DATOMS_JS_REGISTRY_USER }} + DATOMS_JS_REGISTRY_PASSWORD=${{ secrets.DATOMS_JS_REGISTRY_PASSWORD }} + DATOMS_JS_REGISTRY_EMAIL=${{ secrets.DATOMS_JS_REGISTRY_EMAIL }} + DATOMS_JS_REGISTRY_URL=${{ secrets.DATOMS_JS_REGISTRY_URL }} + CI=${{ secrets.CI }} + # cache-from: type=local,src=/tmp/.buildx-cache + # cache-to: type=local,dest=/tmp/.buildx-cache + push: true + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.tags }} + + release: + runs-on: self-hosted + needs: [build] + container: node:16.19.0 + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: NPM Login + env: + DATOMS_JS_REGISTRY_USER: ${{ secrets.DATOMS_JS_REGISTRY_USER }} + DATOMS_JS_REGISTRY_PASSWORD: ${{ secrets.DATOMS_JS_REGISTRY_PASSWORD }} + DATOMS_JS_REGISTRY_EMAIL: ${{ secrets.DATOMS_JS_REGISTRY_EMAIL }} + DATOMS_JS_REGISTRY_URL: ${{ secrets.DATOMS_JS_REGISTRY_URL }} + run: npm i -g npm-cli-login && npm-cli-login -u $DATOMS_JS_REGISTRY_USER -p $DATOMS_JS_REGISTRY_PASSWORD -e $DATOMS_JS_REGISTRY_EMAIL -r $DATOMS_JS_REGISTRY_URL -s @datoms + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: Setup Yarn Cache + uses: actions/cache@v3 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: NPM Install + run: yarn + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.DATOMS_GITHUB_TOKEN }} + run: yarn semantic-release diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..a69d6e93 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,106 @@ +name: Test + +# Controls when the workflow will run +on: + # Triggers the workflow on push to any branch except main / master in the repository + pull_request: + branches: ["master", "main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # vulnerability-assessment: + # # The type of runner that the job will run on + # runs-on: self-hosted + # # Docker image + # container: node:16.19.0 + # # Steps represent a sequence of tasks that will be executed as part of the job + # steps: + # - name: Checkout + # uses: actions/checkout@v3 + # - run: yarn audit --groups dependencies + # continue-on-error: true + + # code-style-check: + # runs-on: self-hosted + # container: node:16.19.0 + # steps: + # - name: Checkout + # uses: actions/checkout@v3 + # - run: npx prettier --check . + + # code-syntax-check: + # runs-on: self-hosted + # container: node:16.19.0 + # steps: + # - name: Checkout + # uses: actions/checkout@v3 + # - name: NPM Login + # env: + # DATOMS_JS_REGISTRY_USER: ${{ secrets.DATOMS_JS_REGISTRY_USER }} + # DATOMS_JS_REGISTRY_PASSWORD: ${{ secrets.DATOMS_JS_REGISTRY_PASSWORD }} + # DATOMS_JS_REGISTRY_EMAIL: ${{ secrets.DATOMS_JS_REGISTRY_EMAIL }} + # DATOMS_JS_REGISTRY_URL: ${{ secrets.DATOMS_JS_REGISTRY_URL }} + # run: npm i -g npm-cli-login && npm-cli-login -u $DATOMS_JS_REGISTRY_USER -p $DATOMS_JS_REGISTRY_PASSWORD -e $DATOMS_JS_REGISTRY_EMAIL -r $DATOMS_JS_REGISTRY_URL -s @datoms + # - name: Get yarn cache directory path + # id: yarn-cache-dir-path + # run: echo "::set-output name=dir::$(yarn cache dir)" + # - name: Setup Yarn Cache + # uses: actions/cache@v3 + # id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + # with: + # path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + # key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + # restore-keys: | + # ${{ runner.os }}-yarn- + # - name: NPM Install + # run: yarn + # - run: yarn test:syntax + + build: + runs-on: self-hosted + # needs: [vulnerability-assessment, code-style-check, code-syntax-check] + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Docker meta + id: docker_meta + uses: docker/metadata-action@v4 + with: + # list of Docker images to use as base name for tags + images: | + ${{ secrets.DATOMS_DOCKER_IMAGE_NAME }} + # generate Docker tags based on the following attributes + tags: | + type=sha,prefix=,format=short + # https://docs.docker.com/language/java/configure-ci-cd/#optimize-the-workflow + # - name: Cache Docker layers + # uses: actions/cache@v3 + # with: + # path: /tmp/.buildx-cache + # key: ${{ runner.os }}-buildx-${{ github.sha }} + # restore-keys: | + # ${{ runner.os }}-buildx- + - name: Build and push + uses: docker/build-push-action@v3 + with: + build-args: | + DATOMS_JS_REGISTRY_USER=${{ secrets.DATOMS_JS_REGISTRY_USER }} + DATOMS_JS_REGISTRY_PASSWORD=${{ secrets.DATOMS_JS_REGISTRY_PASSWORD }} + DATOMS_JS_REGISTRY_EMAIL=${{ secrets.DATOMS_JS_REGISTRY_EMAIL }} + DATOMS_JS_REGISTRY_URL=${{ secrets.DATOMS_JS_REGISTRY_URL }} + CI=${{ secrets.CI }} + # cache-from: type=local,src=/tmp/.buildx-cache + # cache-to: type=local,dest=/tmp/.buildx-cache + push: true + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.tags }}