Skip to content

fix: allow lib-install from git using revision hash as a reference #2882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 8, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added integration test
  • Loading branch information
cmaglie committed Apr 7, 2025
commit e7f8f8829c1990a24f030fafe68907e6836f3af7
21 changes: 21 additions & 0 deletions internal/integrationtest/lib/lib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
package lib_test

import (
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"io"
Expand Down Expand Up @@ -687,6 +689,7 @@ func TestInstallWithGitUrlFragmentAsBranch(t *testing.T) {

t.Run("RefPointingToBranch", func(t *testing.T) {
libInstallDir := cli.SketchbookDir().Join("libraries", "ArduinoCloud")
t.Cleanup(func() { libInstallDir.RemoveAll() })

// Verify install with ref pointing to a branch
require.NoDirExists(t, libInstallDir.String())
Expand All @@ -700,6 +703,24 @@ func TestInstallWithGitUrlFragmentAsBranch(t *testing.T) {
require.NoError(t, err)
require.Contains(t, string(fileToTest), `#define LENGHT_M "meters"`) // nolint:misspell
})

t.Run("RefPointingToHash", func(t *testing.T) {
libInstallDir := cli.SketchbookDir().Join("libraries", "ArduinoCloud")
t.Cleanup(func() { libInstallDir.RemoveAll() })

// Verify install with ref pointing to a branch
require.NoDirExists(t, libInstallDir.String())
_, _, err = cli.Run("lib", "install", "--git-url", "https://github.com/arduino-libraries/ArduinoCloud.git#fe1a1c5d1f8ea2cb27ece1a3b9344dc1eaed60b6", "--config-file", "arduino-cli.yaml")
require.NoError(t, err)
require.DirExists(t, libInstallDir.String())

// Verify that the correct branch is checked out
// https://github.com/arduino-libraries/ArduinoCloud/commit/fe1a1c5d1f8ea2cb27ece1a3b9344dc1eaed60b6
fileToTest, err := libInstallDir.Join("examples", "ReadAndWrite", "ReadAndWrite.ino").ReadFile()
require.NoError(t, err)
chksum := sha256.Sum256(fileToTest)
require.Equal(t, hex.EncodeToString(chksum[:]), `f71889cd6da3b91755c7d1b8ec76b7ee6e2824d8a417c043d117ffdf1546f896`)
})
}

func TestUpdateIndex(t *testing.T) {
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy