From 642deba39d09206e133deb93bc109b4c7ca420cf Mon Sep 17 00:00:00 2001 From: Mark Percival Date: Mon, 6 Jan 2025 14:22:00 -0800 Subject: [PATCH] Fix: Fix tests breaking in latest Ruby, update devcontainer to 3.3 (#143) * Fix: Update to Ruby 3.3/3.4 and fix broken tests due to bad import * Chore: Update devcontainer to ruby 3.3 --- .devcontainer/Dockerfile | 19 --------------- .devcontainer/devcontainer.json | 41 +++++++++------------------------ .github/workflows/test.yaml | 5 ++-- spec/lib/rotp/hotp_spec.rb | 1 + 4 files changed, 14 insertions(+), 52 deletions(-) delete mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index cefebba..0000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/ruby/.devcontainer/base.Dockerfile - -# [Choice] Ruby version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.1, 3.0, 2, 2.7, 3-bullseye, 3.1-bullseye, 3.0-bullseye, 2-bullseye, 2.7-bullseye, 3-buster, 3.1-buster, 3.0-buster, 2-buster, 2.7-buster -ARG VARIANT="3.1-bullseye" -FROM mcr.microsoft.com/vscode/devcontainers/ruby:0-${VARIANT} - -# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 -ARG NODE_VERSION="none" -RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi - -# [Optional] Uncomment this section to install additional OS packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends - -# [Optional] Uncomment this line to install additional gems. -# RUN gem install - -# [Optional] Uncomment this line to install global node packages. -# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 200680d..6c6df7e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,41 +1,22 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: -// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/ruby +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/ruby { "name": "Ruby", - "build": { - "dockerfile": "Dockerfile", - "args": { - // Update 'VARIANT' to pick a Ruby version: 3, 3.1, 3.0, 2, 2.7 - // Append -bullseye or -buster to pin to an OS version. - // Use -bullseye variants on local on arm64/Apple Silicon. - "VARIANT": "3-bullseye", - // Options - "NODE_VERSION": "16" - } - }, + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/ruby:1-3.3-bullseye" + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, - // Configure tool-specific properties. - "customizations": { - // Configure properties specific to VS Code. - "vscode": { - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "rebornix.Ruby" - ] - } - }, - // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. // "postCreateCommand": "ruby --version", - // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "vscode", - "features": { - "ghcr.io/devcontainers-contrib/features/act:1": {}, - "ghcr.io/devcontainers/features/docker-in-docker:2": {} - } + // Configure tool-specific properties. + // "customizations": {}, + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" } diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2399b48..ff6047e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,7 +4,7 @@ on: push: branches: [ main ] pull_request: - types: [opened, reopened, synchronize] + branches: [ main ] jobs: test: @@ -13,8 +13,7 @@ jobs: strategy: matrix: - ruby-version: ['3.2', '3.0', '2.7', '2.3', truffleruby-head] - + ruby-version: ['3.4', '3.3', '3.2', '3.0', '2.7', '2.3', truffleruby-head] steps: - uses: actions/checkout@v4 - name: Set up Ruby ${{ matrix.ruby-version }} diff --git a/spec/lib/rotp/hotp_spec.rb b/spec/lib/rotp/hotp_spec.rb index 2f0c726..0646300 100644 --- a/spec/lib/rotp/hotp_spec.rb +++ b/spec/lib/rotp/hotp_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' +require 'uri' RSpec.describe ROTP::HOTP do let(:counter) { 1234 }