tenex / rails-assets

The solution to assets management in Rails
https://rails-assets.org
MIT License
1.63k stars 69 forks source link

Parity issue on testing #488

Closed hut8 closed 2 years ago

hut8 commented 2 years ago

When running locally, all tests pass. On CI, several fail. I am having a hard time identifying the exact difference that causes the errors. Example:

CI

Building package swipe 2.0.0
.Generating gemspec.rz for rails-assets-swipe-2.0.0...
--> Checking file app/assets/javascripts/swipe.js -> NOT FOUND
--> Existing files: /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/**/*
 - /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/app
 - /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/app/assets
 - /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/app/assets/javascripts
 - /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/app/assets/javascripts/Swipe
 - /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/app/assets/javascripts/Swipe/swipe.js
 - /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/app/assets/javascripts/Swipe.js
 - /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/Gemfile
 - /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/README.md
 - /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/Rakefile
 - /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/rails-assets-swipe.json
 - /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/rails-assets-swipe.gemspec
 - /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/lib
 - /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/lib/rails-assets-swipe
 - /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/lib/rails-assets-swipe/version.rb
 - /home/runner/work/rails-assets/rails-assets/public/gems/rails-assets-swipe-2.0.0/lib/rails-assets-swipe.rb

Local

Building package swipe 2.0.0
Generating gemspec.rz for rails-assets-swipe-2.0.0...
--> Checking file app/assets/javascripts/swipe.js -> OK
--> Checking file app/assets/javascripts/swipe/swipe.js -> OK
--> Checking contents of app/assets/javascripts/swipe.js

So, in this one example, swipe should have swipe.js but instead contains Swipe.js. Note that there's a package Swipe which works fine on both.

Potential problems

Check means "I checked and it's not the problem."

hut8 commented 2 years ago

Output from logs locally vs remote logs:

Local

{:message=>"running bower", :command=>"/home/liam/rails-assets/node_modules/.bin/bower install -p -F swipe#2.0.0 --json --config.tmp=/tmp/bower20220715-1929983-10usurp/tmp --config.storage.packages=/tmp/bower20220715-1929983-10usurp/cache --config.interactive=false"}
{:message=>"running shell command", :command=>"cd /tmp/d20220715-1929983-1dtakld && /home/liam/rails-assets/node_modules/.bin/bower install -p -F swipe#2.0.0 --json --config.tmp=/tmp/bower20220715-1929983-10usurp/tmp --config.storage.packages=/tmp/bower20220715-1929983-10usurp/cache --config.interactive=false"}
{:message=>"shell command finished", :command=>"/home/liam/rails-assets/node_modules/.bin/bower install -p -F swipe#2.0.0 --json --config.tmp=/tmp/bower20220715-1929983-10usurp/tmp --config.storage.packages=/tmp/bower20220715-1929983-10usurp/cache --config.interactive=false", :output=>"{\n  \"Swipe\": {\n    \"endpoint\": {\n      \"name\": \"Swipe\",\n      \"source\": \"swipe\",\n      \"target\": \"2.0.0\"\n    },\n    \"canonicalDir\": \"/tmp/d20220715-1929983-1dtakld/bower_components/Swipe\",\n    \"pkgMeta\": {\n      \"name\": \"Swipe\",\n      \"version\": \"2.0.0\",\n      \"main\": [\n        \"./swipe.js\"\n      ],\n      \"author\": \"Brad Birdsall\",\n      \"license\": \"MIT\",\n      \"ignore\": [\n        \"**/*.html\",\n        \"**/*.css\",\n        \"Gruntfile.js\"\n      ],\n      \"homepage\": \"https://github.com/bradbirdsall/Swipe\",\n      \"_release\": \"2.0.0\",\n      \"_resolution\": {\n        \"type\": \"version\",\n        \"tag\": \"2.0.0\",\n        \"commit\": \"ec579c7846acaac2e74d67c00b073e48c19b010d\"\n      },\n      \"_source\": \"https://github.com/bradbirdsall/Swipe.git\",\n      \"_target\": \"2.0.0\"\n    },\n    \"dependencies\": {},\n    \"nrDependants\": 0\n  }\n}\n"}
  Component Load (0.6ms)  SELECT  "components".* FROM "components" WHERE "components"."name" = $1 LIMIT 1  [["name", "swipe"]]
Building Swipe#2.0.0...
{:message=>"running shell command", :command=>"cd /tmp/d20220715-1929983-15zpfyd && rake build"}
{:message=>"shell command finished", :command=>"rake build", :output=>"rails-assets-swipe 2.0.0 built to pkg/rails-assets-swipe-2.0.0.gem.\n"}
   (0.2ms)  BEGIN
  Component Exists (0.5ms)  SELECT  1 AS one FROM "components" WHERE "components"."name" = 'swipe' LIMIT 1
  SQL (0.9ms)  INSERT INTO "components" ("name", "bower_name", "description", "homepage", "summary_cache", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"  [["name", "swipe"], ["bower_name", "swipe"], ["description", ""], ["homepage", "https://github.com/bradbirdsall/Swipe"], ["summary_cache", "{\"name\":\"swipe\",\"description\":\"\",\"homepage\":\"https://github.com/bradbirdsall/Swipe\",\"versions\":[]}"], ["created_at", "2022-07-15 12:21:06.557270"], ["updated_at", "2022-07-15 12:21:06.557270"]]
  Version Exists (0.9ms)  SELECT  1 AS one FROM "versions" WHERE ("versions"."string" = '2.0.0' AND "versions"."component_id" = 1) LIMIT 1
  SQL (1.3ms)  INSERT INTO "versions" ("string", "bower_version", "dependencies", "build_status", "asset_paths", "main_paths", "component_id", "position", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING "id"  [["string", "2.0.0"], ["bower_version", "2.0.0"], ["dependencies", ""], ["build_status", "builded"], ["asset_paths", "{app/assets/javascripts/Swipe/swipe.js,app/assets/javascripts/Swipe.js}"], ["main_paths", "{app/assets/javascripts/Swipe/swipe.js}"], ["component_id", 1], ["position", ".00000000000002.00000000000000.00000000000000."], ["created_at", "2022-07-15 12:21:06.563728"], ["updated_at", "2022-07-15 12:21:06.563728"]]

Pretty-printed output of bower install:

{
  "Swipe": {
    "endpoint": {
      "name": "Swipe",
      "source": "swipe",
      "target": "2.0.0"
    },
    "canonicalDir": "/tmp/d20220715-1929983-1dtakld/bower_components/Swipe",
    "pkgMeta": {
      "name": "Swipe",
      "version": "2.0.0",
      "main": [
        "./swipe.js"
      ],
      "author": "Brad Birdsall",
      "license": "MIT",
      "ignore": [
        "**/*.html",
        "**/*.css",
        "Gruntfile.js"
      ],
      "homepage": "https://github.com/bradbirdsall/Swipe",
      "_release": "2.0.0",
      "_resolution": {
        "type": "version",
        "tag": "2.0.0",
        "commit": "ec579c7846acaac2e74d67c00b073e48c19b010d"
      },
      "_source": "https://github.com/bradbirdsall/Swipe.git",
      "_target": "2.0.0"
    },
    "dependencies": {},
    "nrDependants": 0
  }
}

CI

{:message=>"running bower", :command=>"/home/runner/work/rails-assets/rails-assets/node_modules/.bin/bower install -p -F swipe#2.0.0 --json --config.tmp=/tmp/bower20220715-3824-1iir5qy/tmp --config.storage.packages=/tmp/bower20220715-3824-1iir5qy/cache --config.interactive=false"}
{:message=>"running shell command", :command=>"cd /tmp/d20220715-3824-8xxqhl && /home/runner/work/rails-assets/rails-assets/node_modules/.bin/bower install -p -F swipe#2.0.0 --json --config.tmp=/tmp/bower20220715-3824-1iir5qy/tmp --config.storage.packages=/tmp/bower20220715-3824-1iir5qy/cache --config.interactive=false"}
{:message=>"shell command finished", :command=>"/home/runner/work/rails-assets/rails-assets/node_modules/.bin/bower install -p -F swipe#2.0.0 --json --config.tmp=/tmp/bower20220715-3824-1iir5qy/tmp --config.storage.packages=/tmp/bower20220715-3824-1iir5qy/cache --config.interactive=false", :output=>"{\n  \"Swipe\": {\n    \"endpoint\": {\n      \"name\": \"Swipe\",\n      \"source\": \"swipe\",\n      \"target\": \"2.0.0\"\n    },\n    \"canonicalDir\": \"/tmp/d20220715-3824-8xxqhl/bower_components/Swipe\",\n    \"pkgMeta\": {\n      \"name\": \"Swipe\",\n      \"version\": \"2.0.0\",\n      \"main\": [\n        \"./swipe.js\"\n      ],\n      \"author\": \"Brad Birdsall\",\n      \"license\": \"MIT\",\n      \"ignore\": [\n        \"**/*.html\",\n        \"**/*.css\",\n        \"Gruntfile.js\"\n      ],\n      \"homepage\": \"https://github.com/bradbirdsall/Swipe\",\n      \"_release\": \"2.0.0\",\n      \"_resolution\": {\n        \"type\": \"version\",\n        \"tag\": \"2.0.0\",\n        \"commit\": \"ec579c7846acaac2e74d67c00b073e48c19b010d\"\n      },\n      \"_source\": \"https://github.com/bradbirdsall/Swipe.git\",\n      \"_target\": \"2.0.0\"\n    },\n    \"dependencies\": {},\n    \"nrDependants\": 0\n  }\n}\n"}
  Component Load (0.8ms)  SELECT  "components".* FROM "components" WHERE "components"."name" = $1 LIMIT 1  [["name", "swipe"]]
Building Swipe#2.0.0...
{:message=>"running shell command", :command=>"cd /tmp/d20220715-3824-14daqpt && rake build"}
{:message=>"shell command finished", :command=>"rake build", :output=>"rails-assets-swipe 2.0.0 built to pkg/rails-assets-swipe-2.0.0.gem.\n"}
   (0.4ms)  BEGIN
  Component Exists (0.6ms)  SELECT  1 AS one FROM "components" WHERE "components"."name" = 'swipe' LIMIT 1
  SQL (0.8ms)  INSERT INTO "components" ("name", "bower_name", "description", "homepage", "summary_cache", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"  [["name", "swipe"], ["bower_name", "swipe"], ["description", ""], ["homepage", "https://github.com/bradbirdsall/Swipe"], ["summary_cache", "{\"name\":\"swipe\",\"description\":\"\",\"homepage\":\"https://github.com/bradbirdsall/Swipe\",\"versions\":[]}"], ["created_at", "2022-07-15 12:06:09.409287"], ["updated_at", "2022-07-15 12:06:09.409287"]]
  Version Exists (0.9ms)  SELECT  1 AS one FROM "versions" WHERE ("versions"."string" = '2.0.0' AND "versions"."component_id" = 1) LIMIT 1
  SQL (1.0ms)  INSERT INTO "versions" ("string", "bower_version", "dependencies", "build_status", "asset_paths", "main_paths", "component_id", "position", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING "id"  [["string", "2.0.0"], ["bower_version", "2.0.0"], ["dependencies", ""], ["build_status", "builded"], ["asset_paths", "{app/assets/javascripts/Swipe/swipe.js,app/assets/javascripts/Swipe.js}"], ["main_paths", "{app/assets/javascripts/Swipe/swipe.js}"], ["component_id", 1], ["position", ".00000000000002.00000000000000.00000000000000."], ["created_at", "2022-07-15 12:06:09.413653"], ["updated_at", "2022-07-15 12:06:09.413653"]]

Pretty printed bower install output:

{
  "Swipe": {
    "endpoint": {
      "name": "Swipe",
      "source": "swipe",
      "target": "2.0.0"
    },
    "canonicalDir": "/tmp/d20220715-3824-8xxqhl/bower_components/Swipe",
    "pkgMeta": {
      "name": "Swipe",
      "version": "2.0.0",
      "main": [
        "./swipe.js"
      ],
      "author": "Brad Birdsall",
      "license": "MIT",
      "ignore": [
        "**/*.html",
        "**/*.css",
        "Gruntfile.js"
      ],
      "homepage": "https://github.com/bradbirdsall/Swipe",
      "_release": "2.0.0",
      "_resolution": {
        "type": "version",
        "tag": "2.0.0",
        "commit": "ec579c7846acaac2e74d67c00b073e48c19b010d"
      },
      "_source": "https://github.com/bradbirdsall/Swipe.git",
      "_target": "2.0.0"
    },
    "dependencies": {},
    "nrDependants": 0
  }
}

Conclusions

The output of bower looks identical. Also I've put effort into making absolute sure that bower is precisely the same, including dependencies, on both local and remote, and also cleared my bower cache and other caches.

These outputs overall look identical except for the expected difference in paths. So, nothing to see here. 😕

hut8 commented 2 years ago

I added functionality to make a tarball of the directory (in this case, the bower_components subdirectory) and upload it as an artifact. They contain identical files.

hut8 commented 2 years ago

On CI:

{:all=>[[#<Build::Path:swipe.js>, #<Build::Path:app/assets/javascripts/Swipe/swipe.js>], ["//= require Swipe/swipe.js\n", #<Build::Path:app/assets/javascripts/Swipe.js>]], :main=>[[#<Build::Path:swipe.js>, #<Build::Path:app/assets/javascripts/Swipe/swipe.js>]]}

Local:

{:all=>[[#<Build::Path:swipe.js>, #<Build::Path:app/assets/javascripts/Swipe/swipe.js>], ["//= require Swipe/swipe.js\n", #<Build::Path:app/assets/javascripts/Swipe.js>]], :main=>[[#<Build::Path:swipe.js>, #<Build::Path:app/assets/javascripts/Swipe/swipe.js>]]} 

So these are identical too.

hut8 commented 2 years ago

Identified cause: I had run tests before upgrade. All the gems were built and the original paths to gem directories were intact. The test suite never removes those directories before writing to them, so the old files stuck around. That explains the difference in behavior. The directories in question were in public/gems/*(/)

Test suite needs to be updated to fix that.