From f75c6d15cc962bda699f7c534499e626a2940756 Mon Sep 17 00:00:00 2001 From: Mickey Gousset Date: Fri, 24 Apr 2020 11:31:00 -0500 Subject: [PATCH 1/7] Initial version of GH Action Workflow This is the initial version of the GH Action workflow for building expressjs/express on Linux and Windows --- .github/workflows/express-build.yml | 110 ++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 .github/workflows/express-build.yml diff --git a/.github/workflows/express-build.yml b/.github/workflows/express-build.yml new file mode 100644 index 0000000000..5aaf4c9f80 --- /dev/null +++ b/.github/workflows/express-build.yml @@ -0,0 +1,110 @@ +# GitHub Action Workflow for building on Linux and Windows + +name: ExpressJS Express Build + +on: + push: + branches: [ master ] + +jobs: + + build: + name: Express Build + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} + strategy: + fail-fast: false + matrix: + node-version: ["0.10", "0.12", "1.8", "2.5", "3.3", "4.9", "5.12", "6.17", "7.10", "8.17", "9.11", "10.19", "11.15", "12.16"] + os: [ubuntu-latest, windows-latest] + experimental: [false] + node-mirror: ["https://nodejs.org/dist/"] + include: + - node-version: 13 + os: ubuntu-latest + node-mirror: "https://nodejs.org/download/nightly" + experimental: true + - node-version: 13 + os: windows-latest + node-mirror: "https://nodejs.org/download/nightly" + experimental: true + + steps: + - uses: actions/checkout@v2 + + - name: Set up node using nvm + uses: dcodeIO/setup-node-nvm@v4.0.0 + with: + node-version: ${{ matrix.node-version }} + node-mirror: ${{ matrix.node-mirror }} + + # Configure npm + # Skip updating shrinkwrap / lock + - run: npm config set shrinkwrap false + + # Remove all non-test dependencies + # Remove example dependencies + - run: npm rm --silent --save-dev connect-redis + + - name: Get Major Version Number of NodeJs Using Powershell + run: | + echo ${{ matrix.node-version }} + $mynodeVersion = "${{ matrix.node-version }}" + $mynodeMajorVersion = $mynodeVersion.split(".")[0] + echo "::set-env name=NodeMajorVersion::$mynodeMajorVersion" + shell: pwsh + + # Setup Node.js version-specific dependencies + + # mocha for testing + # - use 3.x for Node.js < 4 + # - use 5.x for Node.js < 6 + # - use 6.x for Node.js < 8 + - name: Setup Node.js version-specific dependencies - mocha for testing - use 3.5.3 for Node.js < 4 + run: npm install --silent --save-dev mocha@3.5.3 + if: env.NodeMajorVersion < 4 + + - name: Setup Node.js version-specific dependencies - mocha for testing - use 5.2.0 for Node.js < 6 + run: npm install --silent --save-dev mocha@5.2.0 + if: env.NodeMajorVersion < 6 && env.NodeMajorVersion >= 4 + + - name: Setup Node.js version-specific dependencies - mocha for testing - use 6.2.2 for Node.js < 8 + run: npm install --silent --save-dev mocha@6.2.2 + if: env.NodeMajorVersion < 8 && env.NodeMajorVersion >= 6 + + # supertest for http calls + # - use 2.0.0 for Node.js < 4 + # - use 3.4.2 for Node.js < 6 + - name: Setup Node.js version-specific dependencies - supertest for http calls - use 2.0.0 for Node.js < 4 + run: npm install --silent --save-dev supertest@2.0.0 + if: env.NodeMajorVersion < 4 + + - name: Setup Node.js version-specific dependencies - supertest for http calls - use 3.4.2 for Node.js < 6 + run: npm install --silent --save-dev supertest@3.4.2 + if: env.NodeMajorVersion < 6 && env.NodeMajorVersion >= 4 + + + # Update Node.js modules + # Prune and rebuild node_modules + - name: prune and rebuild node_modules + run: | + if (Test-Path -Path node_modules) { + npm prune + npm rebuild + } + shell: pwsh + + - name: npm install + run: | + npm install + + # Run test script + - run: npm run test-ci + # Run linting + - run: npm run lint + + # Upload coverage to coveralls + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} From 2c4b61a38741b8a079fa12d9bcaa1b236fdfd915 Mon Sep 17 00:00:00 2001 From: Mickey Gousset Date: Fri, 24 Apr 2020 13:40:10 -0500 Subject: [PATCH 2/7] Modified name of workflow to Test Changed the name of the workflow from ExpressJS Express Build to Test, per feedback from team. Co-Authored-By: Wes Todd --- .github/workflows/express-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/express-build.yml b/.github/workflows/express-build.yml index 5aaf4c9f80..821246d1e4 100644 --- a/.github/workflows/express-build.yml +++ b/.github/workflows/express-build.yml @@ -1,6 +1,6 @@ # GitHub Action Workflow for building on Linux and Windows -name: ExpressJS Express Build +name: Test on: push: From f98d1b94b2419a4faf23e3b53799a7195fdf84fc Mon Sep 17 00:00:00 2001 From: Mickey Gousset Date: Sun, 26 Apr 2020 17:58:35 -0500 Subject: [PATCH 3/7] Renamed YAML file to Test.yml Renamed YAML file to Test.yml, based off feedback from the initial pull request. --- .github/workflows/{express-build.yml => Test.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{express-build.yml => Test.yml} (100%) diff --git a/.github/workflows/express-build.yml b/.github/workflows/Test.yml similarity index 100% rename from .github/workflows/express-build.yml rename to .github/workflows/Test.yml From cb153f916dbbff75783b86bdd3ea7caf3543f53e Mon Sep 17 00:00:00 2001 From: Mickey Gousset Date: Sun, 26 Apr 2020 18:06:53 -0500 Subject: [PATCH 4/7] Changed trigger to any pull request Changed the workflow to be any pull request to any branch, per suggestions from the submitted pull request. Leaving "on push to master" in right now, to facilitate testing, and in the event someone does do a push directly to master. --- .github/workflows/Test.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index 821246d1e4..b13320b533 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -1,10 +1,16 @@ # GitHub Action Workflow for building on Linux and Windows +#Name of the workflow. name: Test +# Workflow Trigger +# Trigger the workflow on a pull request to any branch, including master on: + pull_request: + #This triggers the workflow in the event there is a push directly to master push: - branches: [ master ] + branches: + - master jobs: From b3d1f941a9896637015ca1bfd1b8a03940121be2 Mon Sep 17 00:00:00 2001 From: Mickey Gousset Date: Sun, 26 Apr 2020 18:17:46 -0500 Subject: [PATCH 5/7] Add Node 13 and 14 to the matrix - Added Node versions 13 and 14 to the matrix - Commented out nightly build from the matrix - Added comments to YAML file --- .github/workflows/Test.yml | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index b13320b533..75969785c6 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -1,39 +1,48 @@ # GitHub Action Workflow for building on Linux and Windows -#Name of the workflow. +# Displaye name of the workflow. name: Test # Workflow Trigger # Trigger the workflow on a pull request to any branch, including master on: pull_request: - #This triggers the workflow in the event there is a push directly to master + # This triggers the workflow in the event there is a push directly to master push: branches: - master jobs: - + # This workflow file defines only one job, "build". The steps have been made generic to run on Linux, Windows, and Mac. build: + # Display name of the job name: Express Build + # The OS to run the job steps on. We are using a matrix definition that defines the node versions and the OS to use, so + # here we just specify use the OS defined in the matrix. runs-on: ${{ matrix.os }} + # This prevents a workflow from failing just because a specific job fails. In this case it checks the experimental tag in + # the matrix continue-on-error: ${{ matrix.experimental }} strategy: fail-fast: false matrix: - node-version: ["0.10", "0.12", "1.8", "2.5", "3.3", "4.9", "5.12", "6.17", "7.10", "8.17", "9.11", "10.19", "11.15", "12.16"] + # Added node version 13 and 14 based off feedback from the group. + node-version: ["0.10", "0.12", "1.8", "2.5", "3.3", "4.9", "5.12", "6.17", "7.10", "8.17", "9.11", "10.19", "11.15", "12.16", "13.0", "14.0"] os: [ubuntu-latest, windows-latest] experimental: [false] node-mirror: ["https://nodejs.org/dist/"] - include: - - node-version: 13 - os: ubuntu-latest - node-mirror: "https://nodejs.org/download/nightly" - experimental: true - - node-version: 13 - os: windows-latest - node-mirror: "https://nodejs.org/download/nightly" - experimental: true + # The following include is commented out, but kept for now in case it is decided to add it back. This include is how you would add + # a nightly build to the matrix, but not allow the nightly build from Node to fail the workflow. It was decided, for now, to add + # Node versions 13 and 14 to the matrix, and eliminate the use of the nightly build. + #include: + # - node-version: 13 + # os: ubuntu-latest + # node-mirror: "https://nodejs.org/download/nightly" + # experimental: true + # - node-version: 13 + # os: windows-latest + # node-mirror: "https://nodejs.org/download/nightly" + # experimental: true steps: - uses: actions/checkout@v2 From 82a33e7279eb5ff9375ecb3a88e3d74b4e4f72af Mon Sep 17 00:00:00 2001 From: Mickey Gousset Date: Sun, 26 Apr 2020 18:25:26 -0500 Subject: [PATCH 6/7] Modified scripts to be unix-like on all platforms - Change to bash script that runs on all platforms, for calculating the major node versions - removed if statement from the prune and rebuild node_modules step. - Add more comments to the file --- .github/workflows/Test.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index 75969785c6..27a35f9a17 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -45,8 +45,11 @@ jobs: # experimental: true steps: + # Check out the repository so the workflow can access it - uses: actions/checkout@v2 + # Using this action instead of the setup-node action from GitHub, because the setup-node action currently doesn't support + # versions of Node <= 3.3. Also, the setup-node action does not support using the nightly Node build. - name: Set up node using nvm uses: dcodeIO/setup-node-nvm@v4.0.0 with: @@ -61,13 +64,15 @@ jobs: # Remove example dependencies - run: npm rm --silent --save-dev connect-redis - - name: Get Major Version Number of NodeJs Using Powershell + # This step gets the major version number off the node version being run. It is used in later steps as a + # conditional to setup different aspects of the workflow. + - name: Get Major Version Number of NodeJs run: | echo ${{ matrix.node-version }} - $mynodeVersion = "${{ matrix.node-version }}" - $mynodeMajorVersion = $mynodeVersion.split(".")[0] - echo "::set-env name=NodeMajorVersion::$mynodeMajorVersion" - shell: pwsh + nodeMajorVersion=$( cut -d. -f1 <<< "${{ matrix.node-version }}" ) + echo "::set-env name=NodeMajorVersion::$nodeMajorVersion" + echo $nodeMajorVersion + shell: bash # Setup Node.js version-specific dependencies @@ -103,11 +108,9 @@ jobs: # Prune and rebuild node_modules - name: prune and rebuild node_modules run: | - if (Test-Path -Path node_modules) { npm prune npm rebuild - } - shell: pwsh + shell: bash - name: npm install run: | From 78266efe97a35781eb65f4226a6334a9bb2aaa4e Mon Sep 17 00:00:00 2001 From: Mickey Gousset Date: Sun, 26 Apr 2020 21:18:16 -0500 Subject: [PATCH 7/7] Changed matrix to list and added nightly builds Changed the matrix to a list format and added the nightly builds. --- .github/workflows/Test.yml | 41 ++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index 27a35f9a17..cb1118fe37 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -27,22 +27,37 @@ jobs: fail-fast: false matrix: # Added node version 13 and 14 based off feedback from the group. - node-version: ["0.10", "0.12", "1.8", "2.5", "3.3", "4.9", "5.12", "6.17", "7.10", "8.17", "9.11", "10.19", "11.15", "12.16", "13.0", "14.0"] - os: [ubuntu-latest, windows-latest] + node-version: + - "0.10" + - "0.12" + - "1.8" + - "2.5" + - "3.3" + - "4.9" + - "5.12" + - "6.17" + - "7.10" + - "8.17" + - "9.11" + - "10.19" + - "11.15" + - "12.16" + os: + - ubuntu-latest + - windows-latest experimental: [false] node-mirror: ["https://nodejs.org/dist/"] # The following include is commented out, but kept for now in case it is decided to add it back. This include is how you would add - # a nightly build to the matrix, but not allow the nightly build from Node to fail the workflow. It was decided, for now, to add - # Node versions 13 and 14 to the matrix, and eliminate the use of the nightly build. - #include: - # - node-version: 13 - # os: ubuntu-latest - # node-mirror: "https://nodejs.org/download/nightly" - # experimental: true - # - node-version: 13 - # os: windows-latest - # node-mirror: "https://nodejs.org/download/nightly" - # experimental: true + # a nightly build to the matrix, but not allow the nightly build from Node to fail the workflow. + include: + - node-version: 13 + os: ubuntu-latest + node-mirror: "https://nodejs.org/download/nightly" + experimental: true + - node-version: 13 + os: windows-latest + node-mirror: "https://nodejs.org/download/nightly" + experimental: true steps: # Check out the repository so the workflow can access it