Browse Source

[CI] clean up, remove unused stuff

Andy Li 3 years ago
parent
commit
be7d2f9b8f
2 changed files with 34 additions and 78 deletions
  1. 17 39
      .github/workflows/main.yml
  2. 17 39
      extra/github-actions/workflows/main.yml

+ 17 - 39
.github/workflows/main.yml

@@ -229,10 +229,8 @@ jobs:
           path: out
       
 
-  linux-build:
+  linux-amd64-build:
     runs-on: ubuntu-18.04
-    env:
-      OPAMYES: 1
     steps:
       - name: Login to GitHub Container Registry
         uses: docker/login-action@v1
@@ -242,7 +240,7 @@ jobs:
           password: ${{ secrets.GITHUB_TOKEN }}
 
       - name: Install Earthly
-        run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'
+        run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.6.2/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'
 
       - uses: actions/checkout@main
         with:
@@ -253,20 +251,12 @@ jobs:
         run: echo "ADD_REVISION=1" >> $GITHUB_ENV
 
       - name: Build
-        run: earthly --platform=linux/amd64 --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache +build --ADD_REVISION=$ADD_REVISION
+        run: earthly --platform=linux/amd64 --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache-build-${{github.ref_name}}-amd64 +build --ADD_REVISION=$ADD_REVISION
         env:
-          EARTHLY_PUSH: "${{ github.ref == 'refs/heads/develop' }}"
-
-      # https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions
-      - name: Extract branch name
-        id: extract_branch
-        shell: bash
-        run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
+          EARTHLY_PUSH: "${{ github.event_name == 'push' }}"
 
       - name: Build xmldoc
-        run: earthly --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache-amd64 +xmldoc --COMMIT=$GITHUB_SHA --BRANCH=${{ steps.extract_branch.outputs.branch }}
-        env:
-          EARTHLY_PUSH: "${{ github.ref == 'refs/heads/develop' }}"
+        run: earthly +xmldoc --COMMIT="${{ github.sha }}" --BRANCH="${{ github.ref_name }}"
 
       - name: Upload xmldoc artifact
         uses: actions/[email protected]
@@ -282,8 +272,6 @@ jobs:
 
   linux-arm64-build:
     runs-on: ubuntu-18.04
-    env:
-      OPAMYES: 1
     steps:
       - name: Login to GitHub Container Registry
         uses: docker/login-action@v1
@@ -293,7 +281,7 @@ jobs:
           password: ${{ secrets.GITHUB_TOKEN }}
 
       - name: Install Earthly
-        run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'
+        run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.6.2/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'
 
       - name: Set up QEMU
         id: qemu
@@ -311,9 +299,9 @@ jobs:
         run: echo "ADD_REVISION=1" >> $GITHUB_ENV
 
       - name: Build
-        run: earthly --platform=linux/arm64 --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache-arm64 +build --ADD_REVISION=$ADD_REVISION
+        run: earthly --platform=linux/arm64 --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache-build-${{github.ref_name}}-arm64 +build --ADD_REVISION=$ADD_REVISION
         env:
-          EARTHLY_PUSH: "${{ github.ref == 'refs/heads/develop' }}"
+          EARTHLY_PUSH: "${{ github.event_name == 'push' }}"
 
       - name: Upload artifact
         uses: actions/[email protected]
@@ -627,11 +615,9 @@ jobs:
         working-directory: ${{github.workspace}}/tests
       
 
-  linux-test:
-    needs: linux-build
+  linux-amd64-test:
+    needs: linux-amd64-build
     runs-on: ubuntu-18.04
-    env:
-      HXCPP_COMPILE_CACHE: ~/hxcache
     steps:
       - name: Login to GitHub Container Registry
         uses: docker/login-action@v1
@@ -652,20 +638,12 @@ jobs:
             platforms: all
 
       - name: Install Earthly
-        run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'\
+        run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.6.2/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'\
 
       - name: Test
-        if: success() && !(matrix.SAUCE && matrix.SAUCE_ACCESS_KEY)
-        run: earthly --platform=linux/amd64 --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache +test-all
-        env:
-          EARTHLY_PUSH: "${{ github.ref == 'refs/heads/develop' }}"
-
-      - name: Test (with SauceLabs)
-        if: success() && matrix.SAUCE && matrix.SAUCE_ACCESS_KEY
-        run: earthly --platform=linux/amd64 --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache +test --TEST=js
+        run: earthly --platform=linux/amd64 --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache-test-${{github.ref_name}}-amd64 +test-all
         env:
-          EARTHLY_PUSH: "${{ github.ref == 'refs/heads/develop' }}"
-          SAUCE_ACCESS_KEY: matrix.SAUCE_ACCESS_KEY
+          EARTHLY_PUSH: "${{ github.event_name == 'push' }}"
 
   mac-test:
     needs: mac-build
@@ -752,8 +730,8 @@ jobs:
       
 
   deploy:
-    if: github.event_name != 'pull_request'
-    needs: [linux-test, linux-arm64-build, mac-test, windows-test, windows64-test]
+    if: success() && github.repository_owner == 'HaxeFoundation' && github.event_name != 'pull_request'
+    needs: [linux-amd64-test, linux-arm64-build, mac-test, windows-test, windows64-test]
     runs-on: ubuntu-18.04
     steps:
       # this is only needed for to get `COMMIT_DATE`...
@@ -828,8 +806,8 @@ jobs:
           aws s3 cp ${HXBUILDS_S3ADDR}/haxe/windows-choco/${FILE_NAME}   ${HXBUILDS_S3ADDR}/haxe/windows-choco/haxe_latest.nupkg   --acl public-read --website-redirect "${HXBUILDS_S3PATH}/haxe/windows-choco/${FILE_NAME}"
 
   deploy_apidoc:
-    if: github.event_name != 'pull_request' # TODO: also only when `GHP_REMOTE` is present
-    needs: [linux-test, mac-test, windows-test, windows64-test]
+    if: success() && github.repository_owner == 'HaxeFoundation' && github.event_name != 'pull_request'
+    needs: [linux-amd64-test, linux-arm64-build, mac-test, windows-test, windows64-test]
     runs-on: ubuntu-18.04
     steps:
       - name: Download Haxe

+ 17 - 39
extra/github-actions/workflows/main.yml

@@ -52,10 +52,8 @@ jobs:
       @import install-neko.yml
       @import build-windows.yml
 
-  linux-build:
+  linux-amd64-build:
     runs-on: ubuntu-18.04
-    env:
-      OPAMYES: 1
     steps:
       - name: Login to GitHub Container Registry
         uses: docker/login-action@v1
@@ -65,7 +63,7 @@ jobs:
           password: ${{ secrets.GITHUB_TOKEN }}
 
       - name: Install Earthly
-        run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'
+        run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.6.2/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'
 
       - uses: actions/checkout@main
         with:
@@ -76,20 +74,12 @@ jobs:
         run: echo "ADD_REVISION=1" >> $GITHUB_ENV
 
       - name: Build
-        run: earthly --platform=linux/amd64 --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache +build --ADD_REVISION=$ADD_REVISION
+        run: earthly --platform=linux/amd64 --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache-build-${{github.ref_name}}-amd64 +build --ADD_REVISION=$ADD_REVISION
         env:
-          EARTHLY_PUSH: "${{ github.ref == 'refs/heads/develop' }}"
-
-      # https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions
-      - name: Extract branch name
-        id: extract_branch
-        shell: bash
-        run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
+          EARTHLY_PUSH: "${{ github.event_name == 'push' }}"
 
       - name: Build xmldoc
-        run: earthly --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache-amd64 +xmldoc --COMMIT=$GITHUB_SHA --BRANCH=${{ steps.extract_branch.outputs.branch }}
-        env:
-          EARTHLY_PUSH: "${{ github.ref == 'refs/heads/develop' }}"
+        run: earthly +xmldoc --COMMIT="${{ github.sha }}" --BRANCH="${{ github.ref_name }}"
 
       - name: Upload xmldoc artifact
         uses: actions/[email protected]
@@ -105,8 +95,6 @@ jobs:
 
   linux-arm64-build:
     runs-on: ubuntu-18.04
-    env:
-      OPAMYES: 1
     steps:
       - name: Login to GitHub Container Registry
         uses: docker/login-action@v1
@@ -116,7 +104,7 @@ jobs:
           password: ${{ secrets.GITHUB_TOKEN }}
 
       - name: Install Earthly
-        run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'
+        run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.6.2/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'
 
       - name: Set up QEMU
         id: qemu
@@ -134,9 +122,9 @@ jobs:
         run: echo "ADD_REVISION=1" >> $GITHUB_ENV
 
       - name: Build
-        run: earthly --platform=linux/arm64 --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache-arm64 +build --ADD_REVISION=$ADD_REVISION
+        run: earthly --platform=linux/arm64 --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache-build-${{github.ref_name}}-arm64 +build --ADD_REVISION=$ADD_REVISION
         env:
-          EARTHLY_PUSH: "${{ github.ref == 'refs/heads/develop' }}"
+          EARTHLY_PUSH: "${{ github.event_name == 'push' }}"
 
       - name: Upload artifact
         uses: actions/[email protected]
@@ -209,11 +197,9 @@ jobs:
       @import install-neko.yml
       @import test-windows.yml
 
-  linux-test:
-    needs: linux-build
+  linux-amd64-test:
+    needs: linux-amd64-build
     runs-on: ubuntu-18.04
-    env:
-      HXCPP_COMPILE_CACHE: ~/hxcache
     steps:
       - name: Login to GitHub Container Registry
         uses: docker/login-action@v1
@@ -234,20 +220,12 @@ jobs:
             platforms: all
 
       - name: Install Earthly
-        run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'\
+        run: sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.6.2/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'\
 
       - name: Test
-        if: success() && !(matrix.SAUCE && matrix.SAUCE_ACCESS_KEY)
-        run: earthly --platform=linux/amd64 --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache +test-all
-        env:
-          EARTHLY_PUSH: "${{ github.ref == 'refs/heads/develop' }}"
-
-      - name: Test (with SauceLabs)
-        if: success() && matrix.SAUCE && matrix.SAUCE_ACCESS_KEY
-        run: earthly --platform=linux/amd64 --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache +test --TEST=js
+        run: earthly --platform=linux/amd64 --remote-cache=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):cache-test-${{github.ref_name}}-amd64 +test-all
         env:
-          EARTHLY_PUSH: "${{ github.ref == 'refs/heads/develop' }}"
-          SAUCE_ACCESS_KEY: matrix.SAUCE_ACCESS_KEY
+          EARTHLY_PUSH: "${{ github.event_name == 'push' }}"
 
   mac-test:
     needs: mac-build
@@ -275,8 +253,8 @@ jobs:
       @import test-mac.yml
 
   deploy:
-    if: github.event_name != 'pull_request'
-    needs: [linux-test, linux-arm64-build, mac-test, windows-test, windows64-test]
+    if: success() && github.repository_owner == 'HaxeFoundation' && github.event_name != 'pull_request'
+    needs: [linux-amd64-test, linux-arm64-build, mac-test, windows-test, windows64-test]
     runs-on: ubuntu-18.04
     steps:
       # this is only needed for to get `COMMIT_DATE`...
@@ -351,8 +329,8 @@ jobs:
           aws s3 cp ${HXBUILDS_S3ADDR}/haxe/windows-choco/${FILE_NAME}   ${HXBUILDS_S3ADDR}/haxe/windows-choco/haxe_latest.nupkg   --acl public-read --website-redirect "${HXBUILDS_S3PATH}/haxe/windows-choco/${FILE_NAME}"
 
   deploy_apidoc:
-    if: github.event_name != 'pull_request' # TODO: also only when `GHP_REMOTE` is present
-    needs: [linux-test, mac-test, windows-test, windows64-test]
+    if: success() && github.repository_owner == 'HaxeFoundation' && github.event_name != 'pull_request'
+    needs: [linux-amd64-test, linux-arm64-build, mac-test, windows-test, windows64-test]
     runs-on: ubuntu-18.04
     steps:
       - name: Download Haxe