generated from athackst/vscode_ros2_workspace
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Updated CI/CD Tests #405
Open
JordanChen123
wants to merge
15
commits into
main
Choose a base branch
from
ci_tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+115
−38
Open
Updated CI/CD Tests #405
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
203c4c6
Added npm build checks
JordanChen123 1017cdf
test
JordanChen123 3a8b31d
test2
JordanChen123 479ba67
testagain
JordanChen123 ce838f8
another test
JordanChen123 9d4c8bb
more test
JordanChen123 b328059
trying to debug
JordanChen123 85f42a1
a
JordanChen123 215fb2a
Ran style formatting
JordanChen123 6a73bf6
.
JordanChen123 e3cc3a1
Workflow triggered only when src/website** or .devcontainer/** are mo…
JordanChen123 f33d6e3
added debugging for SSH keys
JordanChen123 c567be8
more debugging
JordanChen123 6b5883c
.
JordanChen123 678484d
.
JordanChen123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,68 @@ | ||
name: Deployment | ||
|
||
on: | ||
# Uncomment once we are ready to deploy | ||
#push: | ||
# branches: | ||
# - main | ||
workflow_dispatch: | ||
# Uncomment once we are ready to deploy | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- 'src/website/**' | ||
- '.devcontainer/**' | ||
|
||
jobs: | ||
deploy-web: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout workspace | ||
uses: actions/checkout@v4 | ||
- name: Update docker image | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_KEY }} | ||
script: | | ||
[ ! -d "sailbot_workspace" ] && git clone https://github.com/UBCSailbot/sailbot_workspace.git | ||
cd sailbot_workspace | ||
git pull | ||
touch src/website/.env.local # Adds a local environment file to VM to override env vars in .env.production | ||
echo NEXT_PUBLIC_SERVER_HOST=http://${{ secrets.SSH_HOST }} >> src/website/.env.local | ||
docker compose -f .devcontainer/docker-compose.yml -f .devcontainer/website/docker-compose.website.prod.yml up --force-recreate -d --build --remove-orphans | ||
- name: Checkout workspace | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GH_TOKEN }} | ||
|
||
- name: Debug - List directory structure | ||
run: | | ||
ls -R | ||
|
||
- name: Install dependencies and run lint checks | ||
run: | | ||
cd src/website | ||
npm ci | ||
npm run lint | ||
|
||
- name: Build website | ||
run: | | ||
cd src/website | ||
npm run build | ||
|
||
- name: Update docker image for pre-production | ||
if: github.event_name == 'pull_request' | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_KEY }} | ||
script: | | ||
[ ! -d "sailbot_workspace" ] && git clone https://github.com/UBCSailbot/sailbot_workspace.git | ||
cd sailbot_workspace | ||
git pull | ||
touch src/website/.env.local # Adds a local environment file to VM to override env vars in .env.production | ||
echo NEXT_PUBLIC_SERVER_HOST=http://${{ secrets.SSH_HOST }} >> src/website/.env.local | ||
docker compose -f .devcontainer/docker-compose.yml -f .devcontainer/website/docker-compose.website.prod.yml up --force-recreate -d --build --remove-orphans | ||
|
||
- name: Update docker image for production | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_KEY }} | ||
script: | | ||
[ ! -d "sailbot_workspace" ] && git clone https://github.com/UBCSailbot/sailbot_workspace.git | ||
cd sailbot_workspace | ||
git pull | ||
touch src/website/.env.local # Adds a local environment file to VM to override env vars in .env.production | ||
echo NEXT_PUBLIC_SERVER_HOST=http://${{ secrets.SSH_HOST }} >> src/website/.env.local | ||
docker compose -f .devcontainer/docker-compose.yml -f .devcontainer/website/docker-compose.website.prod.yml up --force-recreate -d --build --remove-orphans | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see a verification that docker is installed on the VM prior to deploying to it. Which is fine, just wanted to clarify as you mentioned it resolved that issue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,4 @@ module.exports = () => { | |
}; | ||
}; | ||
|
||
export {} | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the motivation for running this on every pull request rather than on pushes to main?
Wouldn't this just be testing the configuration of the main branch and not the changes being introduced?
If we want to keep it as being triggered by pull requests can we only trigger it when files in src/website and .devcontainer are modified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my understanding, running this on every PR would ensure that changes in the PR would not break the deployment before they are merged into the main branch, which would also provide another layer of testing to catch issues early. What do you think?
Also, good point. If we do want to keep it as being triggered by PR's, then it should only trigger when files in src/website and .devcontainer are modified. I will fix that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sounds like a great idea to test out how changes deploy before actually deploying to the real site.
The main branch will be checked out on the VM, and not the development branchI'm sorry that's totally wrong ^
Would the VM that this workflow deploys to be like a pre-production environment and not the actual web host?
If so, then I think keeping it as triggered by PRs makes sense, and maybe we can keep the push trigger as well and deploy to either the pre-production VM or the actual website host VM depending on the trigger event.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your idea sounds great, since the VM that the workflow deploys will not be the actual web host.