ubuntu buiding #173
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ubuntu buiding | |
| on: | |
| push: | |
| branches: | |
| - 'master' | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: | |
| - 'master' | |
| schedule: | |
| - cron: "0 3 * * *" | |
| env: | |
| TEST_COMPLIE: yunnysunny/node-compiler:latest | |
| TEST_RUNTIME: yunnysunny/node-runtime:latest | |
| jobs: | |
| generate-matrix: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.gen.outputs.matrix }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Generate matrix JSON with Node.js | |
| id: gen | |
| run: | | |
| MATRIX_JSON=$(node ./scripts/get_all_versions.mjs) | |
| echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT | |
| docker: | |
| runs-on: ubuntu-latest | |
| needs: generate-matrix | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Docker meta for core on node ${{ matrix.node-version }} | |
| id: meta-core | |
| uses: docker/metadata-action@v4 | |
| with: | |
| images: | | |
| yunnysunny/node | |
| tags: | | |
| type=semver,pattern={{version}},value=v${{matrix.node-version}} | |
| type=semver,pattern={{major}}.{{minor}},value=v${{matrix.node-version}} | |
| type=semver,pattern={{major}},value=v${{matrix.node-version}} | |
| flavor: | | |
| latest=${{matrix.latest || 'false'}} | |
| - name: Docker meta for compiler | |
| id: meta-compiler | |
| uses: docker/metadata-action@v4 | |
| with: | |
| images: | | |
| yunnysunny/node-compiler | |
| tags: | | |
| type=semver,pattern={{version}},value=v${{matrix.node-version}} | |
| type=semver,pattern={{major}}.{{minor}},value=v${{matrix.node-version}} | |
| type=semver,pattern={{major}},value=v${{matrix.node-version}} | |
| flavor: | | |
| latest=${{matrix.latest || 'false'}} | |
| - name: Docker meta for xtransit | |
| id: meta-xtransit | |
| uses: docker/metadata-action@v4 | |
| with: | |
| images: | | |
| yunnysunny/node-xtransit | |
| tags: | | |
| type=semver,pattern={{version}},value=v${{matrix.node-version}} | |
| type=semver,pattern={{major}}.{{minor}},value=v${{matrix.node-version}} | |
| type=semver,pattern={{major}},value=v${{matrix.node-version}} | |
| flavor: | | |
| latest=${{matrix.latest || 'false'}} | |
| - name: Docker meta for easy-monitor | |
| id: meta-easy-monitor | |
| uses: docker/metadata-action@v4 | |
| with: | |
| images: | | |
| yunnysunny/easy-monitor | |
| tags: | | |
| type=semver,pattern={{version}},value=v${{matrix.node-version}} | |
| type=semver,pattern={{major}}.{{minor}},value=v${{matrix.node-version}} | |
| type=semver,pattern={{major}},value=v${{matrix.node-version}} | |
| flavor: | | |
| latest=${{matrix.latest || 'false'}} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Login to DockerHub | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build core | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: core | |
| push: false | |
| tags: yunnysunny/node:latest | |
| file: node.dockerfile | |
| target: core | |
| cache-from: type=registry,ref=yunnysunny/node:buildcache-${{matrix.major-version}} | |
| cache-to: type=registry,ref=yunnysunny/node:buildcache-${{matrix.major-version}},mode=max | |
| build-args: | | |
| NODE_VERSION=${{matrix.node-version}} | |
| load: true | |
| - name: Build compiler | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: compiler | |
| push: false | |
| tags: ${{ env.TEST_COMPLIE }} | |
| file: node.dockerfile | |
| target: compiler | |
| cache-from: type=registry,ref=yunnysunny/node-compiler:buildcache-${{matrix.major-version}} | |
| cache-to: type=registry,ref=yunnysunny/node-compiler:buildcache-${{matrix.major-version}},mode=max | |
| build-args: | | |
| NODE_VERSION=${{matrix.node-version}} | |
| load: true | |
| - name: Build xtransit | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: xtransit | |
| build-args: | | |
| NODE_VERSION=${{matrix.node-version}} | |
| push: false | |
| target: xtransit | |
| cache-from: type=registry,ref=yunnysunny/node-xtransit:buildcache-${{matrix.major-version}} | |
| cache-to: type=registry,ref=yunnysunny/node-xtransit:buildcache-${{matrix.major-version}},mode=max | |
| tags: ${{ env.TEST_RUNTIME }} | |
| file: node.dockerfile | |
| load: true | |
| - name: Test hello | |
| run: | | |
| cd test/hello && ./test.sh | |
| # - uses: docker/build-push-action@v2 | |
| # with: | |
| # tags: test-image:latest | |
| # context: test/hello | |
| # build-args: | | |
| # IMAGE_VERSION=latest | |
| # file: test/hello/Dockerfile | |
| # push: false | |
| # load: true | |
| # - uses: addnab/docker-run-action@v3 | |
| # with: | |
| # image: test-image:latest | |
| # run: | | |
| # node src/app.js & | |
| # whoami | |
| # ps -ef | grep node | |
| # pldd $(ps -ef | grep node | grep -v grep | awk '{print $2}') || true | |
| # sudo ps -ef | grep node || true | |
| - name: Build and push core | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: core | |
| platforms: linux/amd64,linux/arm64 | |
| file: node.dockerfile | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta-core.outputs.tags }} | |
| labels: ${{ steps.meta-core.outputs.labels }} | |
| target: core | |
| cache-from: type=registry,ref=yunnysunny/node:buildcache-${{matrix.major-version}} | |
| cache-to: type=registry,ref=yunnysunny/node:buildcache-${{matrix.major-version}},mode=max | |
| build-args: | | |
| NODE_VERSION=${{matrix.node-version}} | |
| - name: Build and push compiler | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: core | |
| platforms: linux/amd64,linux/arm64 | |
| file: node.dockerfile | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta-compiler.outputs.tags }} | |
| labels: ${{ steps.meta-compiler.outputs.labels }} | |
| target: compiler | |
| cache-from: type=registry,ref=yunnysunny/node-compiler:buildcache-${{matrix.major-version}} | |
| cache-to: type=registry,ref=yunnysunny/node-compiler:buildcache-${{matrix.major-version}},mode=max | |
| build-args: | | |
| NODE_VERSION=${{matrix.node-version}} | |
| - name: Build and push compiler | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: easy-monitor | |
| platforms: linux/amd64,linux/arm64 | |
| file: node.dockerfile | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta-easy-monitor.outputs.tags }} | |
| labels: ${{ steps.meta-easy-monitor.outputs.labels }} | |
| target: ezm-runtime | |
| cache-from: type=registry,ref=yunnysunny/easy-monitor:buildcache-${{matrix.major-version}} | |
| cache-to: type=registry,ref=yunnysunny/easy-monitor:buildcache-${{matrix.major-version}},mode=max | |
| build-args: | | |
| NODE_VERSION=${{matrix.node-version}} | |
| - name: Build and push xtransit | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: xtransit | |
| platforms: linux/amd64,linux/arm64 | |
| file: node.dockerfile | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta-xtransit.outputs.tags }} | |
| labels: ${{ steps.meta-xtransit.outputs.labels }} | |
| target: xtransit | |
| cache-from: type=registry,ref=yunnysunny/node-xtransit:buildcache-${{matrix.major-version}} | |
| cache-to: type=registry,ref=yunnysunny/node-xtransit:buildcache-${{matrix.major-version}},mode=max | |
| build-args: | | |
| NODE_VERSION=${{matrix.node-version}} | |
| - name: Update core description | |
| uses: peter-evans/dockerhub-description@v2 | |
| if: ${{ github.event_name != 'pull_request' }} | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| repository: yunnysunny/node | |
| - name: Update compiler description | |
| uses: peter-evans/dockerhub-description@v2 | |
| if: ${{ github.event_name != 'pull_request' }} | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| repository: yunnysunny/node-compiler | |
| - name: Update rumtime description | |
| uses: peter-evans/dockerhub-description@v2 | |
| if: ${{ github.event_name != 'pull_request' }} | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| repository: yunnysunny/node-xtransit | |
| - name: Update easy-monitor description | |
| uses: peter-evans/dockerhub-description@v2 | |
| if: ${{ github.event_name != 'pull_request' }} | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| repository: yunnysunny/easy-monitor |