diff --git a/.github/linters/.jscpd.json b/.github/linters/.jscpd.json new file mode 100644 index 0000000..446e398 --- /dev/null +++ b/.github/linters/.jscpd.json @@ -0,0 +1,9 @@ +{ + "threshold": 0, + "reporters": ["html", "markdown"], + "ignore": [ + "**/.git/**", + "**/*.md", + "**/.github/**" + ] +} diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..d44f903 --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,54 @@ +name: Build and deploy Node.js app to Azure Web App - projectricotta(dev) + + # For override below, see https://github.com/adrienverge/yamllint/issues/430 +on: # yamllint disable-line rule:truthy + push: + branches: + - dev + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Node.js version + uses: actions/setup-node@v1 + with: + node-version: '18.x' + + - name: npm install, build, and test + run: | + npm install + npm run build --if-present + npm run test --if-present + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v2 + with: + name: node-app + path: . + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: 'projectricotta-dev' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v2 + with: + name: node-app + + - name: 'Deploy to Azure Web App' + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: 'projectricotta-dev' + slot-name: 'projectricotta-dev' + publish-profile: ${{ secrets.AzureAppService_PublishProfile_f2f5546ef3b74ad88fb8ac0c8872bc6e }} + package: . diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml new file mode 100644 index 0000000..9a5db8f --- /dev/null +++ b/.github/workflows/prod.yml @@ -0,0 +1,57 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Build and deploy Node.js app to Azure Web App - projectricotta + + # For override below, see https://github.com/adrienverge/yamllint/issues/430 +on: # yamllint disable-line rule:truthy + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Node.js version + uses: actions/setup-node@v1 + with: + node-version: '18.x' + + - name: npm install, build, and test + run: | + npm install + npm run build --if-present + npm run test --if-present + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v2 + with: + name: node-app + path: . + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: 'projectricotta' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v2 + with: + name: node-app + + - name: 'Deploy to Azure Web App' + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: 'projectricotta' + slot-name: 'projectricotta' + publish-profile: ${{ secrets.AzureAppService_PublishProfile_1234 }} + package: . diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index f7882a6..ca138a6 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -53,6 +53,7 @@ You can use Visual Studio Code or other tools to debug when developing locally w ### Execute commands inside the container If you need to execute a command inside the application's environment (such as for debugging): + 1. Start the app (see above). 2. `docker compose exec frontend /bin/sh` at the root of the repository. @@ -72,16 +73,16 @@ and your own: 1. Obtain the Super Linter Docker container: - `docker pull github/super-linter:latest` +`docker pull github/super-linter:latest` 2. Invoke Docker to run the Super Linter against your project directory with the included environment variables: - `docker run --env-file super-linter.env -v [path-to-project]:/tmp/lint github/super-linter` +`docker run --env-file super-linter.env -v [path-to-project]:/tmp/lint github/super-linter` -Where [path-to-project] is the path to your project. This can be a full or relative path. +Where `[path-to-project]` is the path to your project. This can be a full or relative path. For example, if you're currently in the top level project-ricotta directory you can run the linter with: - `docker run --env-file super-linter.env -v .:/tmp/lint github/super-linter` +`docker run --env-file super-linter.env -e FILTER_REGEX_INCLUDE=DEVELOPMENT.md -v .:/tmp/lint github/super-linter` To narrow the files to lint, pass the file(s) to run as a regular expression in the environment variable `FILTER_REGEX_INCLUDE`. To exclude file(s) pass an appropriate addition to the @@ -90,7 +91,7 @@ or supply the regular expression for the files you wish to include on the comman For example, to only lint the file DEVELOPMENT.md in the top level directory: - `docker run --env-file super-linter.env -e FILTER_REGEX_INCLUDE=DEVELOPMENT.md -v .:/tmp/lint github/super-linter` +`docker run --env-file super-linter.env -e FILTER_REGEX_INCLUDE=DEVELOPMENT.md -v .:/tmp/lint github/super-linter` Use UNIX-style paths with forward-slash \/ characters as path separators. See the [super-linter GitHub repository](https://github.com/github/super-linter/blob/main/README.md#filter-linted-files) @@ -99,6 +100,7 @@ for more information on how to specify files for super-linter runs. ## Architecture Software Stack: + - next.js - React - TypeScript