Skip to content

Commit 3bd3be0

Browse files
authored
Merge pull request #156 from NREL/3.10.0_prep
initial commit for prep for 3.10
2 parents 2fda610 + ad3bc12 commit 3bd3be0

File tree

54 files changed

+172
-53
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+172
-53
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Test with OpenStudio container
2+
name: test_with_openstudio
3+
on: push
4+
5+
jobs:
6+
test-gems-latest:
7+
runs-on: ubuntu-latest
8+
env:
9+
BRANCH_NAME: ${{ github.ref_name }}
10+
BUILD_NUMBER: ${{ github.run_number }}
11+
DEPLOY_PATH: ${{ github.repository }}/${{ github.ref_name }}/${{ github.run_number }} # Path for S3 deployment
12+
S3_BUCKET: ext-gem-dashboard
13+
14+
container: # Define the Docker container for the job. All subsequent steps run inside it.
15+
image: nrel/openstudio:3.10.0
16+
options: -u root -e "LANG=en_US.UTF-8" # These options are passed to the 'docker run' command internally
17+
18+
steps:
19+
- name: Checkout Repository
20+
# The repository will be checked out inside the 'nrel/openstudio:3.10.0' container
21+
uses: actions/checkout@v4 # Use v4 for better security and features
22+
with:
23+
submodules: true # Set to true if your repository uses Git submodules
24+
25+
- name: Install Node.js and AWS CLI
26+
# Install required dependencies for AWS actions to work in the OpenStudio container
27+
shell: bash
28+
run: |
29+
echo "Installing Node.js and AWS CLI..."
30+
31+
# Update package list
32+
apt-get update
33+
34+
# Install curl and other dependencies
35+
apt-get install -y curl unzip
36+
37+
# Install Node.js (using NodeSource repository for latest LTS)
38+
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
39+
apt-get install -y nodejs
40+
41+
# Install AWS CLI v2
42+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
43+
unzip awscliv2.zip
44+
./aws/install
45+
46+
# Verify installations
47+
echo "Node.js version: $(node --version)"
48+
echo "npm version: $(npm --version)"
49+
echo "AWS CLI version: $(aws --version)"
50+
51+
# Clean up
52+
rm -rf awscliv2.zip aws/
53+
54+
- name: Verify Environment and Run Measures
55+
# All 'run' commands in this job now execute inside the specified Docker container.
56+
shell: bash # Specify the shell if needed, though bash is default for Ubuntu runners
57+
run: |
58+
# Fix git ownership issue in container
59+
git config --global --add safe.directory /__w/openstudio-load-flexibility-measures-gem/openstudio-load-flexibility-measures-gem
60+
61+
echo "OpenStudio Version: $(openstudio --version)"
62+
echo "Ruby Version: $(ruby -v)"
63+
echo "Listing OpenStudio Gems: $(openstudio gem_list)"
64+
65+
# Install dependencies before running tests
66+
echo "Installing gem dependencies..."
67+
bundle install
68+
69+
echo "Running spec tests..."
70+
rake spec
71+
echo "Running measures with verbose output:"
72+
# This command will execute within the container.
73+
# Ensure that './lib/measures' is the correct path relative to the checkout.
74+
openstudio --verbose measure -r ./lib/measures
75+
76+
# The output for 'test' should now be generated directly into the workspace
77+
# within the container, which is mounted from the host.
78+
# No 'docker cp' is needed as the workspace is shared.
79+
ls -al ./test # Verify the output directory exists and contains files
80+
81+
- name: Configure AWS Credentials
82+
# This step is crucial for authenticating with AWS S3
83+
uses: aws-actions/configure-aws-credentials@v4 # Use v4 for updated features
84+
with:
85+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
86+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # Assuming this is your secret name
87+
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} # Replace with your AWS region, e.g., us-east-1
88+
89+
- name: Sync files to S3 with branch and build in path
90+
shell: bash
91+
run: |
92+
echo "Deploying to s3://${{ env.S3_BUCKET }}/${{ env.DEPLOY_PATH }}/"
93+
# Ensure './test_results' is the correct source directory for the files to upload to S3.
94+
dir_name=$(find -type d -name "test_results")
95+
# It must match the output directory from the 'Run Measures' step.
96+
aws s3 sync $dir_name s3://${{ env.S3_BUCKET }}/${{ env.DEPLOY_PATH }}/ \
97+
--delete \
98+
--acl public-read \
99+
--cache-control "max-age=0, no-cache, no-store, must-revalidate"
100+
echo "S3 sync complete."
101+
echo "https://${{ env.S3_BUCKET }}.s3.amazonaws.com/${{ env.DEPLOY_PATH }}/dashboard/index.html"
102+
echo dir_name=$dir_name >> $GITHUB_ENV # Save the directory name to an environment variable for later use
103+
104+
- name: Archive static site as artifact
105+
uses: actions/upload-artifact@v4
106+
with:
107+
name: static-html-artifact
108+
path: ${{ env.dir_name }} # Path should be relative to the GitHub workspace, which is shared with the container

CHANGELOG.md

Lines changed: 4 additions & 0 deletions

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//Jenkins pipelines are stored in shared libaries. Please see: https://github.com/NREL/cbci_jenkins_libs
22

3-
@Library('cbci_shared_libs@developExtension') _
3+
@Library('cbci_shared_libs') _
44

55
// Build for PR to develop branch only.
66
if ((env.CHANGE_ID) && (env.CHANGE_TARGET) ) { // check if set

LICENSE.md

Lines changed: 1 addition & 1 deletion

README.md

Lines changed: 2 additions & 0 deletions

lib/measures/AssignConstructionSetToBuilding/LICENSE.md

Lines changed: 1 addition & 1 deletion

lib/measures/AssignSpaceTypeBySpaceName/LICENSE.md

Lines changed: 1 addition & 1 deletion

lib/measures/AssignSpaceTypeToBuilding/LICENSE.md

Lines changed: 1 addition & 1 deletion

lib/measures/AssignSpacesToStories/LICENSE.md

Lines changed: 1 addition & 1 deletion

lib/measures/BarAspectRatioStudy/LICENSE.md

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)