diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 7868003cdfe9..184056ee5a42 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -1,5 +1,51 @@ name: FreeBSD Test +on: + push: + branches: + - "master" + pull_request: + +jobs: + testfreebsd: + runs-on: ubuntu-latest + name: Build and test on FreeBSD + timeout-minutes: 120 + steps: + - uses: actions/checkout@v4 + - name: Test in FreeBSD + id: test + uses: vmactions/freebsd-vm@v1 + with: + usesh: true + prepare: | + pkg install -y \ + wget \ + py38-pip \ + py38-sqlite3 \ + gmake \ + git \ + python \ + postgresql12-server \ + autoconf \ + automake \ + libtool \ + bash \ + gettext \ + sqlite3 \ + lowdown \ + curl \ + sudo + + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly-2021-08-3z1 + + cd /tmp/ || exit 1 + wget https://bitcoincore.org/bin/bitcoin-core-27.1/bitcoin-27.1-x86_64-linux-gnu.tar.gz + tar -xf bitcoin-27.1-x86_64-linux-gnu.tar.gz + sudo mv bitcoin-27.1/bin/* /usr/local/bin + rm -rf \ + bitcoin ▋name: FreeBSD Test + on: push: branches: diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml new file mode 100644 index 000000000000..fed11953fd35 --- /dev/null +++ b/.github/workflows/c-cpp.yml @@ -0,0 +1,23 @@ +name: C/C++ YertCoins + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: configure + run: ./configure + - name: make + run: make + - name: make check + run: make check + - name: make distcheck + run: make distcheck diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000000..e460dc99bb03 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,172 @@ + - name: Cache + uses: actions/cache@v4.2.3 + with: + # A list of files, directories, and wildcard patterns to cache and restore + path: + # An explicit key for restoring and saving the cache + key: + # An ordered multiline string listing the prefix-matched keys, that are used for restoring stale cache if no cache hit occurred for key. Note `cache-hit` returns false in this case. + restore-keys: # optional + # The chunk size used to split up large files during upload, in bytes + upload-chunk-size: # optional + # An optional boolean when enabled, allows windows runners to save or restore caches that can be restored or saved respectively on other platforms + enableCrossOsArchive: # optional, default is false + # Fail the workflow if cache entry is not found + fail-on-cache-miss: # optional, default is false + # Check if a cache entry exists for the given input(s) (key, restore-keys) without downloading the cache + lookup-only: # optional, default is false + # Run the post step to save the cache even if another step before fails + save-always: # optional, default is false + # For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL Advanced" + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + schedule: + - cron: '32 20 * * 3' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + - language: c-cpp + build-mode: autobuild + - language: python + build-mode: none + - language: ruby + build-mode: none + # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Add any setup steps before running the `github/codeql-action/init` action. + # This includes steps like installing compilers or runtimes (`actions/setup-node` + # or others). This is typically only required for manual builds. + # - name: Setup runtime (example) + # uses: actions/setup-example@v1 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysisname: CodeQL Advanced + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + - cron: '0 0 * * 0' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + strategy: + matrix: + language: [ 'c-cpp' ] + build-mode: [ 'autobuild' ] + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install mako + + - name: Initialize the CodeQL tools + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + config-file: .github/codeql/codeql-config.yml + + - name: Autobuild + run: | + if [ "${{ matrix.build-mode }}" == "autobuild" ]; then + /opt/hostedtoolcache/CodeQL/2.20.7/x64/codeql/cpp/tools/autobuild.sh + else + echo "Manual build mode" + fi + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + upload: true + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 19b9aa94d9ad..55e03468c4bf 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -1,4 +1,13 @@ ---- +steps: + - name: Set version + run: | + TAG=$(git describe --tags --abbrev=0) + if [ -z "$TAG" ]; then + echo "No tags found!" + exit 1 + fi + export VERSION=$TAG.post$(git rev-list $TAG..HEAD --count) + echo "VERSION=$VERSION" >> $GITHUB_ENV--- name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI on: # Only deploy if we're the result of a PR being merged diff --git a/tests/rkls_github_canned_server.py b/tests/rkls_github_canned_server.py index 138054a6ff9e..d419f855b7f5 100644 --- a/tests/rkls_github_canned_server.py +++ b/tests/rkls_github_canned_server.py @@ -27,7 +27,11 @@ def github_plugin_tree_api(github_user, github_repo, plugin_name): "tree": [] } # FIXME: Pull contents from directory - for file in os.listdir(f'tests/data/recklessrepo/{github_user}/{plugin_name}'): + base_path = 'tests/data/recklessrepo' + user_path = os.path.normpath(os.path.join(base_path, github_user, plugin_name)) + if not user_path.startswith(base_path): + raise Exception("Invalid path") + for file in os.listdir(user_path): dir_json["tree"].append({"path": file}) resp = flask.Response(response=json.dumps(dir_json), headers={'Content-Type': 'application/json; charset=utf-8'})