Skip to content

Commit

Permalink
update references to ruby 3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
drew-usds committed Jan 2, 2024
1 parent 884b2e3 commit f2216ca
Show file tree
Hide file tree
Showing 6 changed files with 396 additions and 331 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ on:
workflow_dispatch:
inputs:
ref:
description: 'Which commit/branch/tag do you want to deploy?'
description: "Which commit/branch/tag do you want to deploy?"
required: true
type: string

# Allow another Action to call this one (e.g., revert)
workflow_call:
inputs:
Expand All @@ -34,7 +34,7 @@ permissions:
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -44,52 +44,52 @@ jobs:
with:
# Retrieve the entire history in case an old ref is being deployed
fetch-depth: 0

- name: Checkout the branch/commit
# This is usually redundant with previous step, but needed for ancestry refs like HEAD^
run: git checkout ${{ inputs.ref }}

- name: Setup Ruby
uses: ruby/setup-ruby@ee2113536afb7f793eed4ce60e8d3b26db912da4 # v1.127.0
with:
ruby-version: '2.7' # Not needed with a .ruby-version file
ruby-version: "3.1.1" # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems

- name: Setup Pages
id: pages
uses: actions/configure-pages@v2
- name: Jekyll build for repo usds/website

- name: Jekyll build for repo usds/website
if: github.repository == 'usds/website'
run: bundle exec jekyll build
run: bundle exec jekyll build
env:
JEKYLL_ENV: production

- name: Jekyll build for repos other than usds/website
if: github.repository != 'usds/website'
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"

- name: Create a file to identify the git ref that deployed
- name: Create a file to identify the git ref that deployed
run: echo ${{ inputs.ref }} > ./_site/ref.txt; grep .*[^\s\n\r].* ./_site/ref.txt || echo $GITHUB_REF > ./_site/ref.txt

- name: Store newly built files as artifact of workflow run
uses: actions/upload-pages-artifact@v1

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: For usds/website, check safety flag
- name: For usds/website, check safety flag
# This is an extra precaution against unintended deploys to the Pages space in usds/website.
if: github.repository == 'usds/website' && vars.MOCK_PAGES_DEPLOY != 'FALSE'
run: |
echo "::error ::To enable deploy in usds/website, define MOCK_PAGES_DEPLOY=FALSE as Actions repo var under Settings/Security"
exit 1
- name: Deploy to GitHub Pages
- name: Deploy to GitHub Pages
if: github.repository != 'usds/website' || vars.MOCK_PAGES_DEPLOY == 'FALSE'
id: deployment
uses: actions/deploy-pages@v1
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.7
FROM ruby:3.1.1
ENV NODE_VERSION=18.11.0
ENV NVM_DIR=/root/.nvm
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
Expand Down
36 changes: 25 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,28 @@ The USDS website is built with:

Before getting started, install the following on your system:

- [Ruby](https://www.ruby-lang.org/en/documentation/installation/), best set up on version 2.7 for Jekyll
- [Ruby](https://www.ruby-lang.org/en/documentation/installation/)(v 3.1.1)
- [NPM](https://github.com/npm/cli)
- Docker

## Deployment steps

see [How to use staging environment](https://github.com/usds/website-management#how-to-use-the-usds-website-staging-environment)

## Install and run a development environment

### Initial setup

We recommmend that you use a Docker container to run the site as a development environment because of dependency and version collisions. This allows the site to run in a contained place, minimizing setup issues.

```
docker build -t usds-website . --no-cache
```

### Run locally, with and without live reload

Run this command to have a local version on `http://localhost:4080`.

```
docker run -p 4080:4000 --name usdsweb usds-website
```
Expand All @@ -34,22 +38,26 @@ If you want to make changes and have them update on the running container
we need to map the active source code in to the container with a volume mount and
expose the port for livereload. This should ensure that changes you make are being
mapped to the /app director and refresh on the running container. Note the volume mount syntax
for `pwd` might be different on Windows or a non Bash shell.
for `pwd` might be different on Windows or a non Bash shell.

```
docker run -p 4080:4000 -p 35729:35729 -v $(pwd):/app --name usdsweb usds-website
```
```

### Development environment for sharing on cloud.gov

Builds staging Jekyll site using `JEKYLL_ENV=staging`. Staging builds are used for temporary testing on cloud.gov. Do not deploy a staging build to GitHub pages.

Staging sites are one-off, per-user builds in a cloud.gov sandbox. Handy for testing and gathering feedback.

To create a cloud.gov staging build:

1. `npm run build-staging`
1. Log in to cloud.gov cli, `cf` (TODO: details here)
1. Log in to cloud.gov cli, `cf` (TODO: details here)
1. `cf push`

#### Create a cloud.gov account and configure Cloud Foundry

If you haven't used cloud.gov before, you'll want to set up

1. [Determine if you have access to cloud.gov](https://cloud.gov/docs/getting-started/accounts/) and follow instructions to [sign up](https://cloud.gov/docs/getting-started/setup/).
Expand All @@ -69,26 +77,29 @@ A GitHub workflow automatically runs the regression script when a pull request t

This website relies on Cypress and cypress-axe to identify page-level accessibility issues. Hopefully, the issues identified in this testing are caught earlier in the development process using a combination of a good accessibility linter such as [axe-Linter](https://marketplace.visualstudio.com/items?itemName=deque-systems.vscode-axe-linter) and a browser plugin such as [Microsoft Accessibility Insights](https://accessibilityinsights.io/docs/web/overview/). This type of testing is to catch any errors missed.

Currently, the tests are designed to test work as you develop locally. When you implement any changes in the UI, open the cypress e2e tests with `npm run cypress:open`. These tests will inject the axe-core library into the page-level instance and run the accessibility API.
Currently, the tests are designed to test work as you develop locally. When you implement any changes in the UI, open the cypress e2e tests with `npm run cypress:open`. These tests will inject the axe-core library into the page-level instance and run the accessibility API.

Once you open cypress, select e2e testing and select your browser for testing. At this point you may click on the individual page-level tests. This will open a browser instance directly to the test, cypress will render the whole page. Accessibility violations will be visible on the left of the browser instance.
Once you open cypress, select e2e testing and select your browser for testing. At this point you may click on the individual page-level tests. This will open a browser instance directly to the test, cypress will render the whole page. Accessibility violations will be visible on the left of the browser instance.

Additional output is in the browser console, which you'll want to open. With the console open, you can now click on any of the issues in the test body, and learn more information about the error and how to resolve it.

The accessibility.cy.js file runs a loop through all the pages, which may prove useful for future accessibility testing. A developer could more fully integrate cypress-axe testing with the CICD build process -- breaking the build if any accessibility error is detected.

Additional Resources about Cypress-axe:

- [Cypress-axe](https://www.npmjs.com/package/cypress-axe)
- [Setting up Cypress with axe for accessibility](https://timdeschryver.dev/blog/setting-up-cypress-with-axe-for-accessibility)

## Maintenance

### Tickets
Tickets are in [website-management](https://github.com/usds/website-management). Board is (https://github.com/orgs/usds/projects/77/views/1).

Tickets are in [website-management](https://github.com/usds/website-management). Board is (https://github.com/orgs/usds/projects/77/views/1).

**NOTE**: make tickets in `website-management` not here.

### USWDS and custom styles

We use USWDS version 3. Most of the styles are built off of v2.12.0, but the underlying framework is v3. The `scss` is in `assets/stylesheets/uswds`, with the entry of `index.scss`. `uswds-settings.scss` has custom variables and `styles.scss` has custom scss.

#### Change theme settings
Expand All @@ -98,15 +109,18 @@ Custom USWDS theme settings are declared in `assets/stylesheets/uswds/_uswds-the
After updating, make a [new build or restart your localhost](#running-and-building) to see any changes.

#### Updating USWDS

To update a major version of `uswds`, consult their documentation. The `package.json` settings will allow for minor and patch updates as a matter of course.

### Content updates

#### Uploading images
- [/images](https://github.com/usds/website/tree/master/images): This folder contains *editorial photos* and other images for People cards and pages, Project cards and pages, event logos for the Events cards and page, and other areas that are likely to change semi-frequently.

- [/images](https://github.com/usds/website/tree/master/images): This folder contains _editorial photos_ and other images for People cards and pages, Project cards and pages, event logos for the Events cards and page, and other areas that are likely to change semi-frequently.
- [/assets/img](https://github.com/usds/website/tree/master/assets/img): Site assets and evergreen images such as page banners/headers and vector graphics should be placed in the assets/img folder here. The images in this folder typically will not be subject to change.

#### Adding Content
* [How to add people](https://github.com/usds/website/wiki/Adding-People-(carousel-and-pages))
* [How to add projects](https://github.com/usds/website/wiki/Adding-projects-(carousel-and-pages))
* [How to add a new page without HTML](https://github.com/usds/website/wiki/Adding-a-simple-page)

- [How to add people](<https://github.com/usds/website/wiki/Adding-People-(carousel-and-pages)>)
- [How to add projects](<https://github.com/usds/website/wiki/Adding-projects-(carousel-and-pages)>)
- [How to add a new page without HTML](https://github.com/usds/website/wiki/Adding-a-simple-page)
32 changes: 18 additions & 14 deletions documentation/2023-refresh/engineering-resources.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
# Usability ideas
* gh desktop

- gh desktop

# Gotchas
* gh pages info is on `Settings | Pages`
* uswds compilation is pretty wild
* if you do upgrade, check issue #634 for info about how the iframe is looking for uswds
* bottom of `/apply` is not an iframe. there's some sizing stuff going on to pay attention to
* Lisa's gonna look at codespaces PR
* dependabot PR merging process?
* cloud.gov staging deploy isn't tested
* in github codespaces, how to downgrade the ruby version:

- gh pages info is on `Settings | Pages`
- uswds compilation is pretty wild
- if you do upgrade, check issue #634 for info about how the iframe is looking for uswds
- bottom of `/apply` is not an iframe. there's some sizing stuff going on to pay attention to
- Lisa's gonna look at codespaces PR
- dependabot PR merging process?
- cloud.gov staging deploy isn't tested
- in github codespaces, how to downgrade the ruby version:

```
$ rvm list
ruby-3.0.5 [ x86_64 ]
=* ruby-3.1.3 [ x86_64 ]
$ rvm install ruby-2.7
$ rvm install ruby-3.1.1
[...]
$ bundle install
$ bundle install
[...]
$ bundle exec jekyll serve
$ bundle exec jekyll serve
[rainbows and unicorns]
```

# Resources
* sprint.usds.gov / its repo
* `onceler` repo for gh actions

- sprint.usds.gov / its repo
- `onceler` repo for gh actions
Loading

0 comments on commit f2216ca

Please sign in to comment.