Skip to content

Commit

Permalink
wip(ci): test
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F committed Feb 12, 2024
1 parent 2e6779a commit 8976d31
Showing 1 changed file with 60 additions and 53 deletions.
113 changes: 60 additions & 53 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ jobs:
matrix:
node-version: [20]
os: [
macos-14,
macos-12,
# macos-14,
# macos-12,
ubuntu-latest,
windows-latest
# windows-latest
]

env:
NODE_VERSION: ${{ matrix.node-version }}

Expand All @@ -44,10 +43,10 @@ jobs:
with:
fetch-depth: 0

- name: Use Node.js ${{ env.NODE_VERSION }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version: ${{ matrix.node-version }}

- if: runner.os == 'Windows'
run: echo "ONLY_DOWNLOAD_PACT_FOR_WINDOWS=true" >> $GITHUB_ENV
Expand All @@ -59,18 +58,15 @@ jobs:
- name: Set up Docker Buildx
if: runner.os == 'Linux'
uses: docker/setup-buildx-action@v3

- if: runner.os == 'Linux'
name: prebuild linux amd64 musl
run: docker run -v $PWD:/home --platform linux/amd64 -e CIRRUS_CI=true --rm node:20-alpine bin/sh -c 'apk add bash && cd /home && /home/script/ci/prebuild-alpine.sh && rm -rf ffi node_modules'
# run: docker run -v $PWD:/home --platform linux/amd64 -e CIRRUS_CI=true --rm node:20-alpine bin/sh -c 'apk add bash && cd /home && /home/script/ci/prebuild-alpine.sh && npm run build && npm test && rm -rf ffi'
run: docker run -v $PWD:/home --platform linux/amd64 --rm node:${{ matrix.node-version }}-alpine bin/sh -c 'apk add bash && cd /home && /home/script/ci/prebuild-alpine.sh && rm -rf ffi node_modules'
- if: runner.os == 'Linux'
name: prebuild linux arm64 musl
run: docker run -v $PWD:/home --platform linux/arm64 -e CIRRUS_CI=true --rm node:20-alpine bin/sh -c 'apk add bash && cd /home && /home/script/ci/prebuild-alpine.sh && rm -rf ffi node_modules'
# run: docker run -v $PWD:/home --platform linux/arm64 -e CIRRUS_CI=true --rm node:20-alpine bin/sh -c 'apk add bash && cd /home && /home/script/ci/prebuild-alpine.sh && npm run build && npm test && rm -rf ffi'
run: docker run -v $PWD:/home --platform linux/arm64 --rm node:${{ matrix.node-version }}-alpine bin/sh -c 'apk add bash && cd /home && /home/script/ci/prebuild-alpine.sh && rm -rf ffi node_modules'
- if: runner.os == 'Linux'
name: prebuild linux arm64
run: docker run -v $PWD:/home --platform linux/arm64 --rm node:20 bin/bash -c 'cd /home && /home/script/ci/prebuild.sh && rm -rf ffi node_modules'
run: docker run -v $PWD:/home --platform linux/arm64 --rm node:${{ matrix.node-version }} bin/bash -c 'cd /home && /home/script/ci/prebuild.sh && rm -rf ffi node_modules'
- run: sudo chown -R $(id -u):$(id -g) prebuilds
if: runner.os == 'Linux'
- run: ./script/ci/prebuild.sh
Expand All @@ -79,10 +75,10 @@ jobs:
with:
path: prebuilds/*.tar.gz

- run: GH_PRE_RELEASE_UPLOAD=true ./script/ci/release.sh
if: github.ref == 'refs/heads/master' && env.ACT != 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
# - run: GH_PRE_RELEASE_UPLOAD=true ./script/ci/release.sh
# if: github.ref == 'refs/heads/master' && env.ACT != 'true'
# env:
# GITHUB_TOKEN: ${{ github.token }}

test:
runs-on: ${{ matrix.os }}
Expand All @@ -95,7 +91,21 @@ jobs:
matrix:
node-version: [16,18,20]
os: [macos-14, macos-12, ubuntu-latest,windows-latest]

include:
- os: ubuntu-latest
node-version: 20
musl: false
arch: amd64
docker: true
- os: ubuntu-latest
node-version: 20
musl: true
arch: amd64
- os: ubuntu-latest
node-version: 20
musl: true
arch: arm64
docker: true
env:
NODE_VERSION: ${{ matrix.node-version }}

Expand Down Expand Up @@ -126,40 +136,37 @@ jobs:
- name: Set up Docker Buildx
if: runner.os == 'Linux'
uses: docker/setup-buildx-action@v3
- if: runner.os == 'Linux'
- if: runner.os == 'Linux' && matrix.docker == 'true' && matrix.musl != 'true'
name: test arm64
run: docker run -v $PWD:/home --platform linux/arm64 --rm node:${{ env.NODE_VERSION }} bin/bash -c 'apt install -y shared-mime-info && cd /home && /home/script/ci/unpack-and-test.sh'
- if: runner.os == 'Linux'
name: test linux amd64 musl
run: docker run -v $PWD:/home --platform linux/amd64 --rm node:${{ env.NODE_VERSION }}-alpine bin/sh -c 'apk add bash curl shared-mime-info && cd /home && /home/script/ci/unpack-and-test.sh'
- if: runner.os == 'Linux'
name: test linux arm64 musl
run: docker run -v $PWD:/home --platform linux/arm64 --rm node:${{ env.NODE_VERSION }}-alpine bin/sh -c 'apk add bash curl shared-mime-info && cd /home && /home/script/ci/unpack-and-test.sh'

release_dry_run:
runs-on: ubuntu-latest
needs: [ create_pre_release, prebuild ]
if: github.ref == 'refs/heads/master'

env:
NODE_VERSION: 20

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'

- name: "release - dry run: ${{ env.DRY_RUN }}"
id: publish
run: script/ci/release.sh
env:
GITHUB_TOKEN: ${{ github.token }}
DRY_RUN: true

- run: echo "New Release will be v${{ steps.publish.outputs.version }}"
run: docker run -v $PWD:/home --platform linux/${{ matrix.arch }} --rm node:${{ matrix.node-version }} bin/bash -c 'apt install -y shared-mime-info && cd /home && /home/script/ci/unpack-and-test.sh'
- if: runner.os == 'Linux' && matrix.docker == 'true' && matrix.musl == 'true'
name: test linux ${{ matrix.arch }} musl
run: docker run -v $PWD:/home --platform linux/${{ matrix.arch }} --rm node:${{ matrix.node-version }}-alpine bin/sh -c 'apk add bash curl shared-mime-info && cd /home && /home/script/ci/unpack-and-test.sh'

# release_dry_run:
# runs-on: ubuntu-latest
# needs: [ create_pre_release, prebuild ]
# if: github.ref == 'refs/heads/master'

# env:
# NODE_VERSION: 20

# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0

# - name: Use Node.js ${{ env.NODE_VERSION }}
# uses: actions/setup-node@v4
# with:
# node-version: ${{ env.NODE_VERSION }}
# registry-url: 'https://registry.npmjs.org'

# - name: "release - dry run: ${{ env.DRY_RUN }}"
# id: publish
# run: script/ci/release.sh
# env:
# GITHUB_TOKEN: ${{ github.token }}
# DRY_RUN: true

# - run: echo "New Release will be v${{ steps.publish.outputs.version }}"

0 comments on commit 8976d31

Please sign in to comment.