From 840eea70db68fcbfb0603b70817b8a79c0fdf578 Mon Sep 17 00:00:00 2001 From: Paul Zhang Date: Sun, 14 Apr 2024 23:09:55 -0700 Subject: [PATCH 1/2] Add continuous integration using `html-proofer` --- .github/workflows/ci.yml | 34 +++++++++++++++++++ Gemfile | 4 ++- Rakefile | 24 +++++++++++++ _site/Rakefile | 24 +++++++++++++ _site/feed.xml | 2 +- .../projects/1-back-to-the-basics/index.html | 6 ++-- _site/projects/2-debugging/index.html | 6 ++-- .../projects/3-integrated-circuits/index.html | 6 ++-- _site/projects/4-microcontrollers/index.html | 6 ++-- .../projects/5-digital-analog-pwm/index.html | 6 ++-- _site/projects/6-transistors/index.html | 6 ++-- .../7-serial-communication/index.html | 6 ++-- .../8-communication-protocols/index.html | 6 ++-- .../9-pid-and-motor-control/index.html | 6 ++-- _site/sitemap.xml | 18 +++++----- 15 files changed, 122 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 Rakefile create mode 100644 _site/Rakefile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e3487e0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake +# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby + +name: Ruby + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ["2.6", "2.7", "3.0"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run tests + run: bundle exec rake diff --git a/Gemfile b/Gemfile index 2b361dd..c8797ff 100644 --- a/Gemfile +++ b/Gemfile @@ -27,4 +27,6 @@ gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby] gem "minimal-mistakes-jekyll", "~> 4.24" -gem "html-proofer", "~> 5.0" +group :test do + gem "html-proofer", "~> 5.0" +end diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..1b8a204 --- /dev/null +++ b/Rakefile @@ -0,0 +1,24 @@ +abort('Please run this using `bundle exec rake`') unless ENV["BUNDLE_BIN_PATH"] +require 'html-proofer' + +desc "Test the website" +task :test => [:build, 'html:check'] do + options = { + :check_sri => true, + :check_external_hash => true, + :check_html => true, + :check_img_http => true, + :check_opengraph => true, + :enforce_https => true, + :cache => { + :timeframe => '6w' + } + } + begin + HTMLProofer.check_directory(".", options).run + rescue => msg + puts "#{msg}" + end +end + +task :default => [:test] diff --git a/_site/Rakefile b/_site/Rakefile new file mode 100644 index 0000000..1b8a204 --- /dev/null +++ b/_site/Rakefile @@ -0,0 +1,24 @@ +abort('Please run this using `bundle exec rake`') unless ENV["BUNDLE_BIN_PATH"] +require 'html-proofer' + +desc "Test the website" +task :test => [:build, 'html:check'] do + options = { + :check_sri => true, + :check_external_hash => true, + :check_html => true, + :check_img_http => true, + :check_opengraph => true, + :enforce_https => true, + :cache => { + :timeframe => '6w' + } + } + begin + HTMLProofer.check_directory(".", options).run + rescue => msg + puts "#{msg}" + end +end + +task :default => [:test] diff --git a/_site/feed.xml b/_site/feed.xml index 3432dec..adbb23f 100644 --- a/_site/feed.xml +++ b/_site/feed.xml @@ -1 +1 @@ -Jekyll2024-04-14T23:00:26-07:00http://localhost:4000/feed.xmlOPS 2.0IEEE at UCLA \ No newline at end of file +Jekyll2024-04-14T23:09:17-07:00http://localhost:4000/feed.xmlOPS 2.0IEEE at UCLA \ No newline at end of file diff --git a/_site/projects/1-back-to-the-basics/index.html b/_site/projects/1-back-to-the-basics/index.html index f3c812d..dcfb7bc 100644 --- a/_site/projects/1-back-to-the-basics/index.html +++ b/_site/projects/1-back-to-the-basics/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -439,7 +439,7 @@

Checkoff Questions

-

Updated:

+

Updated:

diff --git a/_site/projects/2-debugging/index.html b/_site/projects/2-debugging/index.html index 9d93199..76c14ff 100644 --- a/_site/projects/2-debugging/index.html +++ b/_site/projects/2-debugging/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -259,7 +259,7 @@

Potential Buggy circuits

-

Updated:

+

Updated:

diff --git a/_site/projects/3-integrated-circuits/index.html b/_site/projects/3-integrated-circuits/index.html index 790f5fa..295d1d9 100644 --- a/_site/projects/3-integrated-circuits/index.html +++ b/_site/projects/3-integrated-circuits/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -537,7 +537,7 @@

Part 2

-

Updated:

+

Updated:

diff --git a/_site/projects/4-microcontrollers/index.html b/_site/projects/4-microcontrollers/index.html index 11cb118..d52be1b 100644 --- a/_site/projects/4-microcontrollers/index.html +++ b/_site/projects/4-microcontrollers/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -524,7 +524,7 @@

Checkoff Questions

-

Updated:

+

Updated:

diff --git a/_site/projects/5-digital-analog-pwm/index.html b/_site/projects/5-digital-analog-pwm/index.html index c2591a0..2e09960 100644 --- a/_site/projects/5-digital-analog-pwm/index.html +++ b/_site/projects/5-digital-analog-pwm/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -436,7 +436,7 @@

Checkoff Questions

-

Updated:

+

Updated:

diff --git a/_site/projects/6-transistors/index.html b/_site/projects/6-transistors/index.html index c01befd..78078e2 100644 --- a/_site/projects/6-transistors/index.html +++ b/_site/projects/6-transistors/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -485,7 +485,7 @@

Checkoff Questions

-

Updated:

+

Updated:

diff --git a/_site/projects/7-serial-communication/index.html b/_site/projects/7-serial-communication/index.html index 9201111..e7f47d0 100644 --- a/_site/projects/7-serial-communication/index.html +++ b/_site/projects/7-serial-communication/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -633,7 +633,7 @@

Connecting HC-05 to Windows

-

Updated:

+

Updated:

diff --git a/_site/projects/8-communication-protocols/index.html b/_site/projects/8-communication-protocols/index.html index 98a6928..136fe3a 100644 --- a/_site/projects/8-communication-protocols/index.html +++ b/_site/projects/8-communication-protocols/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -544,7 +544,7 @@

Section two: controla’ controla’

-

Updated:

+

Updated:

diff --git a/_site/projects/9-pid-and-motor-control/index.html b/_site/projects/9-pid-and-motor-control/index.html index 0855d50..c638c7f 100644 --- a/_site/projects/9-pid-and-motor-control/index.html +++ b/_site/projects/9-pid-and-motor-control/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -617,7 +617,7 @@

FAQ

-

Updated:

+

Updated:

diff --git a/_site/sitemap.xml b/_site/sitemap.xml index d5d864a..ac26bba 100644 --- a/_site/sitemap.xml +++ b/_site/sitemap.xml @@ -2,39 +2,39 @@ http://localhost:4000/projects/1-back-to-the-basics/ -2024-04-14T23:00:26-07:00 +2024-04-14T23:09:17-07:00 http://localhost:4000/projects/2-debugging/ -2024-04-14T23:00:26-07:00 +2024-04-14T23:09:17-07:00 http://localhost:4000/projects/3-integrated-circuits/ -2024-04-14T23:00:26-07:00 +2024-04-14T23:09:17-07:00 http://localhost:4000/projects/4-microcontrollers/ -2024-04-14T23:00:26-07:00 +2024-04-14T23:09:17-07:00 http://localhost:4000/projects/5-digital-analog-pwm/ -2024-04-14T23:00:26-07:00 +2024-04-14T23:09:17-07:00 http://localhost:4000/projects/6-transistors/ -2024-04-14T23:00:26-07:00 +2024-04-14T23:09:17-07:00 http://localhost:4000/projects/7-serial-communication/ -2024-04-14T23:00:26-07:00 +2024-04-14T23:09:17-07:00 http://localhost:4000/projects/8-communication-protocols/ -2024-04-14T23:00:26-07:00 +2024-04-14T23:09:17-07:00 http://localhost:4000/projects/9-pid-and-motor-control/ -2024-04-14T23:00:26-07:00 +2024-04-14T23:09:17-07:00 http://localhost:4000/555-timer/ From c5004bb5ddd8092d7ae3f97040d8ba5196af910f Mon Sep 17 00:00:00 2001 From: Paul Zhang Date: Sun, 14 Apr 2024 23:25:46 -0700 Subject: [PATCH 2/2] Build before running rake tests --- .github/workflows/ci.yml | 13 +++++----- Rakefile | 25 +++---------------- _site/Rakefile | 25 +++---------------- _site/feed.xml | 2 +- .../projects/1-back-to-the-basics/index.html | 6 ++--- _site/projects/2-debugging/index.html | 6 ++--- .../projects/3-integrated-circuits/index.html | 6 ++--- _site/projects/4-microcontrollers/index.html | 6 ++--- .../projects/5-digital-analog-pwm/index.html | 6 ++--- _site/projects/6-transistors/index.html | 6 ++--- .../7-serial-communication/index.html | 6 ++--- .../8-communication-protocols/index.html | 6 ++--- .../9-pid-and-motor-control/index.html | 6 ++--- _site/sitemap.xml | 18 ++++++------- 14 files changed, 51 insertions(+), 86 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3487e0..4966e2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,16 +19,15 @@ permissions: jobs: test: runs-on: ubuntu-latest - strategy: - matrix: - ruby-version: ["2.6", "2.7", "3.0"] steps: - - uses: actions/checkout@v4 - - name: Set up Ruby + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Ruby uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0 with: - ruby-version: ${{ matrix.ruby-version }} + ruby-version: "3.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: Run tests - run: bundle exec rake + run: bundle exec rake test diff --git a/Rakefile b/Rakefile index 1b8a204..c41945d 100644 --- a/Rakefile +++ b/Rakefile @@ -1,24 +1,7 @@ -abort('Please run this using `bundle exec rake`') unless ENV["BUNDLE_BIN_PATH"] require 'html-proofer' -desc "Test the website" -task :test => [:build, 'html:check'] do - options = { - :check_sri => true, - :check_external_hash => true, - :check_html => true, - :check_img_http => true, - :check_opengraph => true, - :enforce_https => true, - :cache => { - :timeframe => '6w' - } - } - begin - HTMLProofer.check_directory(".", options).run - rescue => msg - puts "#{msg}" - end +task :test do +sh "bundle exec jekyll build" +options = { :assume_extension => true } +HTMLProofer.check_directory("_site", options).run end - -task :default => [:test] diff --git a/_site/Rakefile b/_site/Rakefile index 1b8a204..c41945d 100644 --- a/_site/Rakefile +++ b/_site/Rakefile @@ -1,24 +1,7 @@ -abort('Please run this using `bundle exec rake`') unless ENV["BUNDLE_BIN_PATH"] require 'html-proofer' -desc "Test the website" -task :test => [:build, 'html:check'] do - options = { - :check_sri => true, - :check_external_hash => true, - :check_html => true, - :check_img_http => true, - :check_opengraph => true, - :enforce_https => true, - :cache => { - :timeframe => '6w' - } - } - begin - HTMLProofer.check_directory(".", options).run - rescue => msg - puts "#{msg}" - end +task :test do +sh "bundle exec jekyll build" +options = { :assume_extension => true } +HTMLProofer.check_directory("_site", options).run end - -task :default => [:test] diff --git a/_site/feed.xml b/_site/feed.xml index adbb23f..d611767 100644 --- a/_site/feed.xml +++ b/_site/feed.xml @@ -1 +1 @@ -Jekyll2024-04-14T23:09:17-07:00http://localhost:4000/feed.xmlOPS 2.0IEEE at UCLA \ No newline at end of file +Jekyll2024-04-14T23:25:42-07:00http://localhost:4000/feed.xmlOPS 2.0IEEE at UCLA \ No newline at end of file diff --git a/_site/projects/1-back-to-the-basics/index.html b/_site/projects/1-back-to-the-basics/index.html index dcfb7bc..cd93d88 100644 --- a/_site/projects/1-back-to-the-basics/index.html +++ b/_site/projects/1-back-to-the-basics/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -439,7 +439,7 @@

Checkoff Questions

-

Updated:

+

Updated:

diff --git a/_site/projects/2-debugging/index.html b/_site/projects/2-debugging/index.html index 76c14ff..ec679fc 100644 --- a/_site/projects/2-debugging/index.html +++ b/_site/projects/2-debugging/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -259,7 +259,7 @@

Potential Buggy circuits

-

Updated:

+

Updated:

diff --git a/_site/projects/3-integrated-circuits/index.html b/_site/projects/3-integrated-circuits/index.html index 295d1d9..64d03d6 100644 --- a/_site/projects/3-integrated-circuits/index.html +++ b/_site/projects/3-integrated-circuits/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -537,7 +537,7 @@

Part 2

-

Updated:

+

Updated:

diff --git a/_site/projects/4-microcontrollers/index.html b/_site/projects/4-microcontrollers/index.html index d52be1b..a031fff 100644 --- a/_site/projects/4-microcontrollers/index.html +++ b/_site/projects/4-microcontrollers/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -524,7 +524,7 @@

Checkoff Questions

-

Updated:

+

Updated:

diff --git a/_site/projects/5-digital-analog-pwm/index.html b/_site/projects/5-digital-analog-pwm/index.html index 2e09960..7cce928 100644 --- a/_site/projects/5-digital-analog-pwm/index.html +++ b/_site/projects/5-digital-analog-pwm/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -436,7 +436,7 @@

Checkoff Questions

-

Updated:

+

Updated:

diff --git a/_site/projects/6-transistors/index.html b/_site/projects/6-transistors/index.html index 78078e2..9b8974b 100644 --- a/_site/projects/6-transistors/index.html +++ b/_site/projects/6-transistors/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -485,7 +485,7 @@

Checkoff Questions

-

Updated:

+

Updated:

diff --git a/_site/projects/7-serial-communication/index.html b/_site/projects/7-serial-communication/index.html index e7f47d0..0e61fa1 100644 --- a/_site/projects/7-serial-communication/index.html +++ b/_site/projects/7-serial-communication/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -633,7 +633,7 @@

Connecting HC-05 to Windows

-

Updated:

+

Updated:

diff --git a/_site/projects/8-communication-protocols/index.html b/_site/projects/8-communication-protocols/index.html index 136fe3a..23c36d3 100644 --- a/_site/projects/8-communication-protocols/index.html +++ b/_site/projects/8-communication-protocols/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -544,7 +544,7 @@

Section two: controla’ controla’

-

Updated:

+

Updated:

diff --git a/_site/projects/9-pid-and-motor-control/index.html b/_site/projects/9-pid-and-motor-control/index.html index c638c7f..ad0930e 100644 --- a/_site/projects/9-pid-and-motor-control/index.html +++ b/_site/projects/9-pid-and-motor-control/index.html @@ -36,7 +36,7 @@ - + @@ -171,7 +171,7 @@
- +
@@ -617,7 +617,7 @@

FAQ

-

Updated:

+

Updated:

diff --git a/_site/sitemap.xml b/_site/sitemap.xml index ac26bba..6202030 100644 --- a/_site/sitemap.xml +++ b/_site/sitemap.xml @@ -2,39 +2,39 @@ http://localhost:4000/projects/1-back-to-the-basics/ -2024-04-14T23:09:17-07:00 +2024-04-14T23:25:42-07:00 http://localhost:4000/projects/2-debugging/ -2024-04-14T23:09:17-07:00 +2024-04-14T23:25:42-07:00 http://localhost:4000/projects/3-integrated-circuits/ -2024-04-14T23:09:17-07:00 +2024-04-14T23:25:42-07:00 http://localhost:4000/projects/4-microcontrollers/ -2024-04-14T23:09:17-07:00 +2024-04-14T23:25:42-07:00 http://localhost:4000/projects/5-digital-analog-pwm/ -2024-04-14T23:09:17-07:00 +2024-04-14T23:25:42-07:00 http://localhost:4000/projects/6-transistors/ -2024-04-14T23:09:17-07:00 +2024-04-14T23:25:42-07:00 http://localhost:4000/projects/7-serial-communication/ -2024-04-14T23:09:17-07:00 +2024-04-14T23:25:42-07:00 http://localhost:4000/projects/8-communication-protocols/ -2024-04-14T23:09:17-07:00 +2024-04-14T23:25:42-07:00 http://localhost:4000/projects/9-pid-and-motor-control/ -2024-04-14T23:09:17-07:00 +2024-04-14T23:25:42-07:00 http://localhost:4000/555-timer/