diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e89b83844..be8fc98c5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,12 +13,12 @@ permissions: read-all jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: apt - run: sudo apt-get install gcc autoconf bison gettext autopoint help2man lzip texinfo texlive + run: sudo apt-get update && sudo apt-get install -y gcc autoconf automake libtool gettext autopoint help2man lzip texinfo texlive - name: autogen run: ./autogen.sh - name: configure diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 41cf11810..b8281b5c9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,67 +13,71 @@ name: "CodeQL" on: push: - branches: [ master ] + branches: [ "master" ] pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] + branches: [ "master" ] schedule: - - cron: '31 22 * * 4' + - cron: '39 5 * * 5' -permissions: read-all +permissions: {} jobs: analyze: - name: Analyze - runs-on: ubuntu-latest + 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: ubuntu-22.04 + timeout-minutes: 240 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: - language: [ 'cpp' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - + include: + - language: c-cpp + build-mode: autobuild + # CodeQL supports the following values keywords for 'language': '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: Apt - run: sudo apt-get install gcc autoconf bison gettext autopoint help2man lzip texinfo texlive - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - + + # Ensure autopoint is installed. CodeQL misses it sometimes. + - name: apt + run: sudo apt-get update && sudo apt-get install -y gcc autoconf automake libtool gettext autopoint help2man lzip texinfo texlive + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0 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. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild expects to start by running configure. - # Run autogen.sh to ensure configure exists. - - name: Autogen - run: | - ./autogen.sh - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - # âœī¸ If the Autobuild fails above, remove it and uncomment the following four lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - #- name: Build - # run: | - # ./configure - # make + # 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 - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 000000000..ade348118 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,90 @@ +name: Nightly + +on: + schedule: + - cron: '04 00 * * *' + workflow_dispatch: + +permissions: {} + +jobs: + nightly: + name: Run a Nightly Build and Save the Artifacts + runs-on: ubuntu-22.04 + outputs: + update_needed: ${{ steps.update.outputs.needed }} + version_slug: ${{ steps.update.outputs.slug }} + version: ${{ steps.version.outputs.version }} + permissions: + actions: read + contents: write + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Check time since last commit + id: update + run: | + slug=$(git log -n 1 --pretty='format:%h-%as') + echo "slug=$slug" >> $GITHUB_OUTPUT + authorDate=$(echo $slug | cut -d '-' -f 2-4) + update=1 + [ $(( $(date +%s) - $(date --date=$authorDate +%s) )) -ge 172800 ] && echo "::notice title=No Changes::No changes within the last two days. Skipping nightly build." && update=0 + echo "needed=$update" >> $GITHUB_OUTPUT + - name: Change version number + id: version + env: + slug: ${{ steps.update.outputs.slug }} + update_needed: ${{ steps.update.outputs.needed }} + if: ${{ env.update_needed == 1 }} + run: | + ver=$(sed -n "s/^\(AC_INIT.*generator\],\)\[\(.*\)\]\(,\[flex-help.*\)$/\2/p" $GITHUB_WORKSPACE/configure.ac) + ver=${ver#v} + ver=${ver%-*} + ver=$ver-$slug + echo "version=$ver" >> $GITHUB_OUTPUT + sed -i "s/^\(AC_INIT.*generator\],\)\(.*\)\(,\[flex-help.*\)$/\1[$ver]\3/" $GITHUB_WORKSPACE/configure.ac + - name: apt + env: + update_needed: ${{ steps.update.outputs.needed }} + if: ${{ env.update_needed == 1 }} + run: sudo apt-get update && sudo apt-get install -y gcc autoconf automake libtool gettext autopoint help2man lzip texinfo texlive + - name: Update CHANGE_LOG + env: + update_needed: ${{ steps.update.outputs.needed }} + if: ${{ env.update_needed == 1 }} + run: | + ./tools/git2cl > $GITHUB_WORKSPACE/ChangeLog + - name: build + env: + update_needed: ${{ steps.update.outputs.needed }} + if: ${{ env.update_needed == 1 }} + run: | + ./autogen.sh + ./configure + make + make distcheck + - name: Make Git archives + env: + ver: ${{ steps.version.outputs.version }} + update_needed: ${{ steps.update.outputs.needed }} + if: ${{ env.update_needed == 1 }} + run: | + git archive -o $ver.src.tar.gz --prefix=flex-$ver/ HEAD + TZ=America/Los_Angeles git archive -o $ver.src.zip --prefix=flex-$ver/ HEAD + echo "SOURCE_GZ=$(echo $ver.src.tar.gz)" >> $GITHUB_ENV + echo "SOURCE_ZIP=$(echo $ver.src.zip)" >> $GITHUB_ENV + - name: Get artifact names + env: + ver: ${{ steps.version.outputs.version }} + update_needed: ${{ steps.update.outputs.needed }} + if: ${{ env.update_needed == 1 }} + run: | + echo "ARTIFACT_GZ=$(echo flex-$ver.tar.gz)" >> $GITHUB_ENV + echo "ARTIFACT_LZ=$(echo flex-$ver.tar.lz)" >> $GITHUB_ENV + - name: Upload Artifacts to Nightlies Release + id: upload-nightly-artifacts + env: + update_needed: ${{ steps.update.outputs.needed }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: ${{ env.update_needed == 1 }} + run: | + gh release upload nightlies ${{ env.ARTIFACT_GZ }} ${{ env.ARTIFACT_LZ }} ${{ env.SOURCE_GZ }} ${{ env.SOURCE_ZIP }} --clobber