]> source.dussan.org Git - jquery.git/commitdiff
Build: Migrate CI to GitHub Actions 4979/head
authorygj6 <7699524+ygj6@users.noreply.github.com>
Tue, 30 Nov 2021 23:02:57 +0000 (00:02 +0100)
committerMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Tue, 30 Nov 2021 23:03:59 +0000 (00:03 +0100)
Closes gh-4800

(cherry picked from commit e23190e63cb121da79b92e6641a81a44dcea9252)

.github/workflows/node.js.yml [new file with mode: 0644]
Gruntfile.js

diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
new file mode 100644 (file)
index 0000000..d4e4c24
--- /dev/null
@@ -0,0 +1,68 @@
+name: CI
+
+on: [push, pull_request]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        # Node.js 10 is required by jQuery infra
+        NODE_VERSION: [10.x, 12.x, 14.x, 16.x]
+        NPM_SCRIPT: ["test:browserless"]
+        include:
+          - NAME: "Browser tests: full build, Chrome & Firefox stable"
+            NODE_VERSION: "16.x"
+            NPM_SCRIPT: "test:browser"
+            BROWSERS: "ChromeHeadless,FirefoxHeadless"
+          - NAME: "Browser tests: slim build, Chrome stable"
+            NODE_VERSION: "16.x"
+            NPM_SCRIPT: "test:slim"
+            BROWSERS: "ChromeHeadless"
+          - NAME: "Browser tests: no-deprecated build, Chrome stable"
+            NODE_VERSION: "16.x"
+            NPM_SCRIPT: "test:no-deprecated"
+            BROWSERS: "ChromeHeadless"
+          - NAME: "Browser tests: no-Sizzle build, Chrome stable"
+            NODE_VERSION: "16.x"
+            NPM_SCRIPT: "test:no-sizzle"
+            BROWSERS: "ChromeHeadless"
+          - NAME: "Browser tests: AMD build, Chrome stable"
+            NODE_VERSION: "16.x"
+            NPM_SCRIPT: "test:amd"
+            BROWSERS: "ChromeHeadless"
+          - NAME: "Browser tests: full build, Firefox ESR"
+            NODE_VERSION: "16.x"
+            NPM_SCRIPT: "test:browser"
+            BROWSERS: "FirefoxHeadless"
+    steps:
+    - name: Checkout
+      uses: actions/checkout@v2
+
+    - name: Cache
+      uses: actions/cache@v2
+      with:
+        path: ~/.npm
+        key: ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
+        restore-keys: |
+          ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-npm-lock-
+
+    - name: Use Node.js ${{ matrix.NODE_VERSION }}
+      uses: actions/setup-node@v2.1.2
+      with:
+        node-version: ${{ matrix.NODE_VERSION }}
+
+    - name: Install firefox ESR
+      run: |
+        export FIREFOX_SOURCE_URL='https://download.mozilla.org/?product=firefox-esr-latest&lang=en-US&os=linux64'
+        wget --no-verbose $FIREFOX_SOURCE_URL -O - | tar -jx -C ${HOME}
+      if: "contains(matrix.NAME, 'Firefox ESR')"
+
+    - name: Run test
+      env:
+        BROWSERS: ${{ matrix.BROWSERS }}
+      run: |
+        export PATH=${HOME}/firefox:$PATH
+        npm install
+        npm run ${{ matrix.NPM_SCRIPT }}
index 50a835c9c67d9dac61f3f4720b09b62fa0e846dd..b0b63e1e17fb208eb8465c56a59d6a2713d3515c 100644 (file)
@@ -14,8 +14,8 @@ module.exports = function( grunt ) {
 
        var fs = require( "fs" ),
                gzip = require( "gzip-js" ),
-               isTravis = process.env.TRAVIS,
-               travisBrowsers = process.env.BROWSERS && process.env.BROWSERS.split( "," );
+               isCi = process.env.TRAVIS || process.env.GITHUB_ACTION,
+               ciBrowsers = process.env.BROWSERS && process.env.BROWSERS.split( "," );
 
        if ( !grunt.option( "filename" ) ) {
                grunt.option( "filename", "jquery.js" );
@@ -223,10 +223,10 @@ module.exports = function( grunt ) {
                                singleRun: true
                        },
                        main: {
-                               browsers: isTravis && travisBrowsers || [ "ChromeHeadless", "FirefoxHeadless" ]
+                               browsers: isCi && ciBrowsers || [ "ChromeHeadless", "FirefoxHeadless" ]
                        },
                        amd: {
-                               browsers: isTravis && travisBrowsers || [ "ChromeHeadless" ],
+                               browsers: isCi && ciBrowsers || [ "ChromeHeadless" ],
                                options: {
                                        client: {
                                                qunit: {