Skip to content
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

Modernize the CI/CD by migrating travis.yml to .github/workflows/CI.yml #4

Open
10 of 12 tasks
reactive-firewall opened this issue Dec 31, 2024 · 2 comments
Open
10 of 12 tasks

Comments

@reactive-firewall
Copy link
Contributor

reactive-firewall commented Dec 31, 2024

Goal: get CI/CD working on OSS plan of GHA (open source GitHub Actions) instead of travis.

Tasks:

- [ ] assign to @reactive-firewall (optional)

  • readup on Travis CI/CD config
  • re-write for GHA (see below for details)
  • Test on feature branch (Caveat: Expected failure without further maintenance to core project codebase 🙈 )
  • Submit PR/MR review and hand off ticket . . .
    - [ ] assign back to @mbrossard (optional)
  • Merge back (optional)

Re-write for GHA

  • re-write for GHA

    • Initial re-write for GHA (before debug)
    • Read up on libsoftokn3
    Here are some useful (albeit OLD) links

    NSS Documentation: This includes detailed documentation on how to use NSS, including its libraries and APIs.
    NSS Documentation

    Source Code Repository: As we are looking for implementation details, we can also check the source code, which is hosted on GitHub.
    NSS GitHub Repository

    • find and document ALL broken C_Initialize definition in project (e.g. /* C_Initialize calls are broken see mbrossard/pkcs11#4 */)
      - [ ] read up on the project secmod.db in order to understand codebase better
    • re-write GHA environment to include NSS_LIB_PARAMS="configdir='$PWD' certPrefix='' keyPrefix='' secmod='secmod.db'"
    • Misc. (e.g. cleanup from complexity fan-out)
    • report back on this GHI summary findings

Findings

Migration from libssl3-dev to libssl-dev

  • If you were previously using libssl3-dev with OpenSSL 1.1, we should be able to migrate to libssl-dev for OpenSSL 3.0 without significant issues, but may need to review the code for every deprecated functions or changes in the API between OpenSSL 1.1 and OpenSSL 3.0.

  • As already mentioned: OpenSSL 3.0 introduced some changes, including a new licensing model and some API changes. (clarification from suspected to confirmed)

Tip

we can probably use simple conditionals on the incorrect pointer types:

    #if (OPENSSL_VERSION_NUMBER & 0xF0000000) >= 0x30000000
       // Code for when OPENSSL_VERSION_MAJOR is at least 3
    #else
       // Code for when OPENSSL_VERSION_MAJOR is less than 3
    #endif

see definition

Summary

  • On Ubuntu 22.04, libssl-dev corresponds to OpenSSL 3.0.

  • We can check the specific version using apt-cache policy libssl-dev.

  • we can ignore the deprecated warnings (at least for the moment) as long as openssl does not define OPENSSL_NO_DEPRECATED_3_0 they are just deprecated attributes and the functions are still present.

  • 🤔 the Travis CI is migrated to GHA (caveat: expected failures due to discussed API changes in dependencies 🙊 🙈 )

  • 👍🏻 main goal accomplished

  • 👎 Not sure I'm comfortable tweaking the more security relevant code with my level of understanding of cryptokit and NSSlib (or rather lack-there-of)

  • I think I'll clean up the circleci config before anymore attempts at debugging the modernization issues (debugging the main code, if left to me alone, will have significant learning time-lag as I read all the things, so I want a solid test workflow setup in CI first)

reactive-firewall added a commit to reactive-firewall/pkcs11 that referenced this issue Dec 31, 2024
---
**Explanation of the Configuration**

  **Workflow Triggers**: The workflow is triggered on pushes and pull requests to the master branch.
  **Job Matrix**: The strategy.matrix allows us to define multiple operating systems and compilers, similar to the Travis CI matrix. This ensures that the code is tested across different environments.
  **Environment Setup**: The Set up environment step handles the installation of dependencies and sets environment variables based on the operating system and compiler being used.
  **Dependency Installation**: The Install dependencies step installs the necessary packages for Ubuntu. For macOS, it uses Homebrew to install the required packages.
  **Compiler Version Check**: The Check compiler version step verifies the compiler version being used.
  **Build and Test Steps**: The Build step runs the build commands, and the Run tests step executes the tests. The Clean up step ensures that any temporary files or states are cleaned up after the tests.

---
**Considerations for SOLID Principles and BCP**

**Single Responsibility Principle**: Each step in the workflow has a single responsibility (e.g., checking out code, setting up the environment, installing dependencies, building, testing, and cleaning up).
**Open/Closed Principle**: The matrix strategy allows for easy addition of new operating systems or compilers without modifying existing steps.

---
Other minor changes from personal template:

- yaml-linting GHA to lint the yaml files used for CI/CD
- optional circle-ci CI/CD config
- yamllint.conf for yaml-linting GHA
- xcode workspace with dynamic path includes
- gitignore for xcode workspace user settings
reactive-firewall added a commit to reactive-firewall/pkcs11 that referenced this issue Dec 31, 2024
---
**Explanation of the Configuration**

  **Workflow Triggers**: The workflow is triggered on pushes and pull requests to the master branch.
  **Job Matrix**: The strategy.matrix allows us to define multiple operating systems and compilers, similar to the Travis CI matrix. This ensures that the code is tested across different environments.
  **Environment Setup**: The Set up environment step handles the installation of dependencies and sets environment variables based on the operating system and compiler being used.
  **Dependency Installation**: The Install dependencies step installs the necessary packages for Ubuntu. For macOS, it uses Homebrew to install the required packages.
  **Compiler Version Check**: The Check compiler version step verifies the compiler version being used.
  **Build and Test Steps**: The Build step runs the build commands, and the Run tests step executes the tests. The Clean up step ensures that any temporary files or states are cleaned up after the tests.

---
**Considerations for SOLID Principles and BCP**

**Single Responsibility Principle**: Each step in the workflow has a single responsibility (e.g., checking out code, setting up the environment, installing dependencies, building, testing, and cleaning up).
**Open/Closed Principle**: The matrix strategy allows for easy addition of new operating systems or compilers without modifying existing steps.

---
Other minor changes from personal template:

- yaml-linting GHA to lint the yaml files used for CI/CD
- optional circle-ci CI/CD config
- yamllint.conf for yaml-linting GHA
- xcode workspace with dynamic path includes
- gitignore for xcode workspace user settings
- added CodeQL GHA
reactive-firewall added a commit to reactive-firewall/pkcs11 that referenced this issue Dec 31, 2024
---
**Explanation of the Configuration**

  **Workflow Triggers**: The workflow is triggered on pushes and pull requests to the master branch.
  **Job Matrix**: The strategy.matrix allows us to define multiple operating systems and compilers, similar to the Travis CI matrix. This ensures that the code is tested across different environments.
  **Environment Setup**: The Set up environment step handles the installation of dependencies and sets environment variables based on the operating system and compiler being used.
  **Dependency Installation**: The Install dependencies step installs the necessary packages for Ubuntu. For macOS, it uses Homebrew to install the required packages.
  **Compiler Version Check**: The Check compiler version step verifies the compiler version being used.
  **Build and Test Steps**: The Build step runs the build commands, and the Run tests step executes the tests. The Clean up step ensures that any temporary files or states are cleaned up after the tests.

---
**Considerations for SOLID Principles and BCP**

**Single Responsibility Principle**: Each step in the workflow has a single responsibility (e.g., checking out code, setting up the environment, installing dependencies, building, testing, and cleaning up).
**Open/Closed Principle**: The matrix strategy allows for easy addition of new operating systems or compilers without modifying existing steps.

---
Other minor changes from personal template:

- yaml-linting GHA to lint the yaml files used for CI/CD
- optional circle-ci CI/CD config
- yamllint.conf for yaml-linting GHA
- xcode workspace with dynamic path includes
- gitignore for xcode workspace user settings
- added CodeQL GHA
reactive-firewall added a commit to reactive-firewall/pkcs11 that referenced this issue Dec 31, 2024
---
**Explanation of the Configuration**

  **Workflow Triggers**: The workflow is triggered on pushes and pull requests to the master branch.
  **Job Matrix**: The strategy.matrix allows us to define multiple operating systems and compilers, similar to the Travis CI matrix. This ensures that the code is tested across different environments.
  **Environment Setup**: The Set up environment step handles the installation of dependencies and sets environment variables based on the operating system and compiler being used.
  **Dependency Installation**: The Install dependencies step installs the necessary packages for Ubuntu. For macOS, it uses Homebrew to install the required packages.
  **Compiler Version Check**: The Check compiler version step verifies the compiler version being used.
  **Build and Test Steps**: The Build step runs the build commands, and the Run tests step executes the tests. The Clean up step ensures that any temporary files or states are cleaned up after the tests.

---
**Considerations for SOLID Principles and BCP**

**Single Responsibility Principle**: Each step in the workflow has a single responsibility (e.g., checking out code, setting up the environment, installing dependencies, building, testing, and cleaning up).
**Open/Closed Principle**: The matrix strategy allows for easy addition of new operating systems or compilers without modifying existing steps.

---
Other minor changes from personal template:

- yaml-linting GHA to lint the yaml files used for CI/CD
- optional circle-ci CI/CD config
- yamllint.conf for yaml-linting GHA
- xcode workspace with dynamic path includes
- gitignore for xcode workspace user settings
- added CodeQL GHA
reactive-firewall added a commit to reactive-firewall/pkcs11 that referenced this issue Dec 31, 2024
---
**Explanation of the Configuration**

  **Workflow Triggers**: The workflow is triggered on pushes and pull requests to the master branch.
  **Job Matrix**: The strategy.matrix allows us to define multiple operating systems and compilers, similar to the Travis CI matrix. This ensures that the code is tested across different environments.
  **Environment Setup**: The Set up environment step handles the installation of dependencies and sets environment variables based on the operating system and compiler being used.
  **Dependency Installation**: The Install dependencies step installs the necessary packages for Ubuntu. For macOS, it uses Homebrew to install the required packages.
  **Compiler Version Check**: The Check compiler version step verifies the compiler version being used.
  **Build and Test Steps**: The Build step runs the build commands, and the Run tests step executes the tests. The Clean up step ensures that any temporary files or states are cleaned up after the tests.

---
**Considerations for SOLID Principles and BCP**

**Single Responsibility Principle**: Each step in the workflow has a single responsibility (e.g., checking out code, setting up the environment, installing dependencies, building, testing, and cleaning up).
**Open/Closed Principle**: The matrix strategy allows for easy addition of new operating systems or compilers without modifying existing steps.

---
Other minor changes from personal template:

- yaml-linting GHA to lint the yaml files used for CI/CD
- optional circle-ci CI/CD config
- yamllint.conf for yaml-linting GHA
- xcode workspace with dynamic path includes
- gitignore for xcode workspace user settings
- added CodeQL GHA
reactive-firewall added a commit to reactive-firewall/pkcs11 that referenced this issue Dec 31, 2024
---
**Explanation of the Configuration**

  **Workflow Triggers**: The workflow is triggered on pushes and pull requests to the master branch.
  **Job Matrix**: The strategy.matrix allows us to define multiple operating systems and compilers, similar to the Travis CI matrix. This ensures that the code is tested across different environments.
  **Environment Setup**: The Set up environment step handles the installation of dependencies and sets environment variables based on the operating system and compiler being used.
  **Dependency Installation**: The Install dependencies step installs the necessary packages for Ubuntu. For macOS, it uses Homebrew to install the required packages.
  **Compiler Version Check**: The Check compiler version step verifies the compiler version being used.
  **Build and Test Steps**: The Build step runs the build commands, and the Run tests step executes the tests. The Clean up step ensures that any temporary files or states are cleaned up after the tests.

---
**Considerations for SOLID Principles and BCP**

**Single Responsibility Principle**: Each step in the workflow has a single responsibility (e.g., checking out code, setting up the environment, installing dependencies, building, testing, and cleaning up).
**Open/Closed Principle**: The matrix strategy allows for easy addition of new operating systems or compilers without modifying existing steps.

---
Other minor changes from personal template:

- yaml-linting GHA to lint the yaml files used for CI/CD
- optional circle-ci CI/CD config
- yamllint.conf for yaml-linting GHA
- xcode workspace with dynamic path includes
- gitignore for xcode workspace user settings
- added CodeQL GHA
reactive-firewall added a commit to reactive-firewall/pkcs11 that referenced this issue Dec 31, 2024
---
**Explanation of the Configuration**

  **Workflow Triggers**: The workflow is triggered on pushes and pull requests to the master branch.
  **Job Matrix**: The strategy.matrix allows us to define multiple operating systems and compilers, similar to the Travis CI matrix. This ensures that the code is tested across different environments.
  **Environment Setup**: The Set up environment step handles the installation of dependencies and sets environment variables based on the operating system and compiler being used.
  **Dependency Installation**: The Install dependencies step installs the necessary packages for Ubuntu. For macOS, it uses Homebrew to install the required packages.
  **Compiler Version Check**: The Check compiler version step verifies the compiler version being used.
  **Build and Test Steps**: The Build step runs the build commands, and the Run tests step executes the tests. The Clean up step ensures that any temporary files or states are cleaned up after the tests.

---
**Considerations for SOLID Principles and BCP**

**Single Responsibility Principle**: Each step in the workflow has a single responsibility (e.g., checking out code, setting up the environment, installing dependencies, building, testing, and cleaning up).
**Open/Closed Principle**: The matrix strategy allows for easy addition of new operating systems or compilers without modifying existing steps.

---
Other minor changes from personal template:

- yaml-linting GHA to lint the yaml files used for CI/CD
- optional circle-ci CI/CD config
- yamllint.conf for yaml-linting GHA
- xcode workspace with dynamic path includes
- gitignore for xcode workspace user settings
- added CodeQL GHA
reactive-firewall added a commit to reactive-firewall/pkcs11 that referenced this issue Dec 31, 2024
---
**Explanation of the Configuration**

  **Workflow Triggers**: The workflow is triggered on pushes and pull requests to the master branch.
  **Job Matrix**: The strategy.matrix allows us to define multiple operating systems and compilers, similar to the Travis CI matrix. This ensures that the code is tested across different environments.
  **Environment Setup**: The Set up environment step handles the installation of dependencies and sets environment variables based on the operating system and compiler being used.
  **Dependency Installation**: The Install dependencies step installs the necessary packages for Ubuntu. For macOS, it uses Homebrew to install the required packages.
  **Compiler Version Check**: The Check compiler version step verifies the compiler version being used.
  **Build and Test Steps**: The Build step runs the build commands, and the Run tests step executes the tests. The Clean up step ensures that any temporary files or states are cleaned up after the tests.

---
**Considerations for SOLID Principles and BCP**

**Single Responsibility Principle**: Each step in the workflow has a single responsibility (e.g., checking out code, setting up the environment, installing dependencies, building, testing, and cleaning up).
**Open/Closed Principle**: The matrix strategy allows for easy addition of new operating systems or compilers without modifying existing steps.

---
Other minor changes from personal template:

- yaml-linting GHA to lint the yaml files used for CI/CD
- optional circle-ci CI/CD config
- yamllint.conf for yaml-linting GHA
- xcode workspace with dynamic path includes
- gitignore for xcode workspace user settings
- added CodeQL GHA
reactive-firewall added a commit to reactive-firewall/pkcs11 that referenced this issue Dec 31, 2024
---
**Explanation of the Configuration**

  **Workflow Triggers**: The workflow is triggered on pushes and pull requests to the master branch.
  **Job Matrix**: The strategy.matrix allows us to define multiple operating systems and compilers, similar to the Travis CI matrix. This ensures that the code is tested across different environments.
  **Environment Setup**: The Set up environment step handles the installation of dependencies and sets environment variables based on the operating system and compiler being used.
  **Dependency Installation**: The Install dependencies step installs the necessary packages for Ubuntu. For macOS, it uses Homebrew to install the required packages.
  **Compiler Version Check**: The Check compiler version step verifies the compiler version being used.
  **Build and Test Steps**: The Build step runs the build commands, and the Run tests step executes the tests. The Clean up step ensures that any temporary files or states are cleaned up after the tests.

---
**Considerations for SOLID Principles and BCP**

**Single Responsibility Principle**: Each step in the workflow has a single responsibility (e.g., checking out code, setting up the environment, installing dependencies, building, testing, and cleaning up).
**Open/Closed Principle**: The matrix strategy allows for easy addition of new operating systems or compilers without modifying existing steps.

---
Other minor changes from personal template:

- yaml-linting GHA to lint the yaml files used for CI/CD
- optional circle-ci CI/CD config
- yamllint.conf for yaml-linting GHA
- xcode workspace with dynamic path includes
- gitignore for xcode workspace user settings
- added CodeQL GHA
@reactive-firewall
Copy link
Contributor Author

@mbrossard,

🤔 ok some things have changed in openssl and gcc 🙊

Of note:

  • GHA CI/CD runners need a gcc version between 10 and 12 (caveat: macOS can find a 13 and 14)
  • openssl v3 (the default now) deprecated a bunch of stuff see: these logs in CI/CD (the build warnings)
    • if you don't plan to update the code, can you point me in the right direction for me to start learning the relevant API so I can debug this? 🙇

ignroe the issue tag commit list, I'm just using --amend while I debug.
The working GHA with the failing build/tests? are on the git commit:
2f08d3a

🙇 Hope this helps!

@mbrossard
Copy link
Owner

It seems libsoftokn3 has changed behavior. The current method that relied on fallbacks from C_Initialize calls do not work anymore. If you want (some) tests to succeed you need to set this environment variable: NSS_LIB_PARAMS="configdir='$PWD' certPrefix='' keyPrefix='' secmod='secmod.db'"

There are also some other changes to OpenSSL (the command-line arguments to genrsa and the ECDSA-support detection). It's probably easier to assume OpenSSL version 3.x.

reactive-firewall added a commit to reactive-firewall/pkcs11 that referenced this issue Jan 6, 2025
---
**Explanation of the Configuration**

  **Workflow Triggers**: The workflow is triggered on pushes and pull requests to the master branch.
  **Job Matrix**: The strategy.matrix allows us to define multiple operating systems and compilers, similar to the Travis CI matrix. This ensures that the code is tested across different environments.
  **Environment Setup**: The Set up environment step handles the installation of dependencies and sets environment variables based on the operating system and compiler being used.
  **Dependency Installation**: The Install dependencies step installs the necessary packages for Ubuntu. For macOS, it uses Homebrew to install the required packages.
  **Compiler Version Check**: The Check compiler version step verifies the compiler version being used.
  **Build and Test Steps**: The Build step runs the build commands, and the Run tests step executes the tests. The Clean up step ensures that any temporary files or states are cleaned up after the tests.

---
**Considerations for SOLID Principles and BCP**

**Single Responsibility Principle**: Each step in the workflow has a single responsibility (e.g., checking out code, setting up the environment, installing dependencies, building, testing, and cleaning up).
**Open/Closed Principle**: The matrix strategy allows for easy addition of new operating systems or compilers without modifying existing steps.

---
**Minor Refactoring**

  **ECDSA_SIG_get0** Usage differs in openssl v3 - refactored by adding version switch for v3+ in src/crypto.c
  **Possible Overflow in iniparser when using `-O`** use of `sprintf` with off-by-1 heuristic - refactored by using `snprintf` to clue in compiler as done elsewhere in codebase.

---
Other minor changes from personal template:

- yaml-linting GHA to lint the yaml files used for CI/CD
- optional circle-ci CI/CD config
- yamllint.conf for yaml-linting GHA
- xcode workspace with dynamic path includes
- gitignore for xcode workspace user settings
- added CodeQL GHA
reactive-firewall added a commit to reactive-firewall/pkcs11 that referenced this issue Jan 6, 2025
---
**Explanation of the Configuration**

  **Workflow Triggers**: The workflow is triggered on pushes and pull requests to the master branch.
  **Job Matrix**: The strategy.matrix allows us to define multiple operating systems and compilers, similar to the Travis CI matrix. This ensures that the code is tested across different environments.
  **Environment Setup**: The Set up environment step handles the installation of dependencies and sets environment variables based on the operating system and compiler being used.
  **Dependency Installation**: The Install dependencies step installs the necessary packages for Ubuntu. For macOS, it uses Homebrew to install the required packages.
  **Compiler Version Check**: The Check compiler version step verifies the compiler version being used.
  **Build and Test Steps**: The Build step runs the build commands, and the Run tests step executes the tests. The Clean up step ensures that any temporary files or states are cleaned up after the tests.

---
**Considerations for SOLID Principles and BCP**

**Single Responsibility Principle**: Each step in the workflow has a single responsibility (e.g., checking out code, setting up the environment, installing dependencies, building, testing, and cleaning up).
**Open/Closed Principle**: The matrix strategy allows for easy addition of new operating systems or compilers without modifying existing steps.

---
**Minor Refactoring**

  **ECDSA_SIG_get0** Usage differs in openssl v3 - refactored by adding version switch for v3+ in src/crypto.c
  **Possible Overflow in iniparser when using `-O`** use of `sprintf` with off-by-1 heuristic - refactored by using `snprintf` to clue in compiler as done elsewhere in codebase.

---
Other minor changes from personal template:

- yaml-linting GHA to lint the yaml files used for CI/CD
- optional circle-ci CI/CD config
- yamllint.conf for yaml-linting GHA
- xcode workspace with dynamic path includes
- gitignore for xcode workspace user settings
- added CodeQL GHA
- refactored appveyor.yml for consistant yaml indent as per linter
reactive-firewall added a commit to reactive-firewall/pkcs11 that referenced this issue Jan 6, 2025
---
**Explanation of the Configuration**

  **Workflow Triggers**: The workflow is triggered on pushes and pull requests to the master branch.
  **Job Matrix**: The strategy.matrix allows us to define multiple operating systems and compilers, similar to the Travis CI matrix. This ensures that the code is tested across different environments.
  **Environment Setup**: The Set up environment step handles the installation of dependencies and sets environment variables based on the operating system and compiler being used.
  **Dependency Installation**: The Install dependencies step installs the necessary packages for Ubuntu. For macOS, it uses Homebrew to install the required packages.
  **Version Check**: The Check compiler/tools/lib versions step verifies the versions being used.
  **Build and Test Steps**: The Build step runs the build commands, and the Run tests step executes the tests. The Clean up step ensures that any temporary files or states are cleaned up after the tests.

---
**Considerations for SOLID Principles and BCP**

**Single Responsibility Principle**: Each step in the workflow has a single responsibility (e.g., checking out code, setting up the environment, installing dependencies, building, testing, and cleaning up).
**Open/Closed Principle**: The matrix strategy allows for easy addition of new operating systems or compilers without modifying existing steps.

---
**Minor Refactoring**

  **ECDSA_SIG_get0** Usage differs in openssl v3 - refactored by adding version switch for v3+ in src/crypto.c
  **Possible Overflow in iniparser when using `-O`** use of `sprintf` with off-by-1 heuristic - refactored by using `snprintf` to clue in compiler as done elsewhere in codebase.

---
Other minor changes from personal template:

- yaml-linting GHA to lint the yaml files used for CI/CD
- optional circle-ci CI/CD config
- yamllint.conf for yaml-linting GHA
- xcode workspace with dynamic path includes
- gitignore for xcode workspace user settings
- added CodeQL GHA

---
Misc.

- refactored appveyor.yml for consistant yaml indent as per linter
- added a few comments to code where I felt could be improved in the future
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants