Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add preliminary CI/CD configuration for app service #55

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"threshold": 0,
"reporters": ["html", "markdown"],
"ignore": [
"**/.git/**",
"**/*.md",
"**/.github/**"
]
}
54 changes: 54 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -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: .
57 changes: 57 additions & 0 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
@@ -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: .
12 changes: 7 additions & 5 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
Expand All @@ -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)
Expand All @@ -99,6 +100,7 @@ for more information on how to specify files for super-linter runs.
## Architecture

Software Stack:

- next.js
- React
- TypeScript
Expand Down