Skip to content

Commit

Permalink
Improve workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
baileyherbert committed Mar 16, 2022
1 parent 6acea8d commit c0699c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 79 deletions.
84 changes: 10 additions & 74 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- published

jobs:

build:
strategy:
matrix:
Expand Down Expand Up @@ -42,12 +41,14 @@ jobs:
run: npm ci --ignore-scripts

- name: Build artifact (ia32)
# if: matrix.os != 'macos-latest'
run: npm run build --target_arch=ia32

- name: Build artifact (x64)
run: npm run build --target_arch=x64

- name: Run tests
run: npm run test

- name: Upload to release
if: steps.get_version.outputs.is-semver == 'true'
uses: csexton/release-asset-action@v2
Expand Down Expand Up @@ -85,12 +86,13 @@ jobs:
install: |
apt-get update -y
apt-get install -y curl
curl -fsSL https://deb.nodesource.com/setup_12.x | bash -
curl -fsSL https://deb.nodesource.com/setup_10.x | bash -
apt-get install -y make g++ python nodejs
run: |
cd /repo
npm ci --ignore-scripts
npm run build
npm run test
- name: Upload to release
if: steps.get_version.outputs.is-semver == 'true'
Expand All @@ -100,77 +102,8 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
release-url: ${{ github.event.release.upload_url }}

test:
needs: build
strategy:
matrix:
node-version: [10, 12, 14, 16, 17]
os: [ubuntu-latest, macos-latest, windows-latest]
architecture: [x64]
include:
- os: windows-latest
node-version: 16
architecture: x86

name: test ${{ matrix.os }}:${{ matrix.architecture }} (node v${{ matrix.node-version }})
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
architecture: ${{ matrix.architecture }}

- id: get_version
name: Extract semver
uses: battila7/get-version-action@v2

- name: Set package version
run: npm --no-git-tag-version version ${{ steps.get_version.outputs.version-without-v }}

- name: Install dependencies & artifact
run: npm ci

- name: Run tests
run: npm test

test-arm:
needs: build-arm
strategy:
fail-fast: false
matrix:
node-version: [10, 16]

name: test arm (node v${{ matrix.node-version }})
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- id: get_version
name: Extract semver
uses: battila7/get-version-action@v2

- name: Set package version
run: npm --no-git-tag-version version ${{ steps.get_version.outputs.version-without-v }}

- name: Set up qemu
uses: docker/setup-qemu-action@v1

- name: Set up docker buildx
uses: docker/setup-buildx-action@v1

- name: Install & run tests in docker
run: |
docker buildx build --build-arg NODE_VERSION=${{ matrix.node-version }} --platform linux/arm,linux/arm64 -t armbuild:latest --progress=plain .
publish:
needs: [test, test-arm]
needs: [build, build-arm]
runs-on: ubuntu-latest

steps:
Expand All @@ -191,7 +124,10 @@ jobs:
run: npm --no-git-tag-version version ${{ steps.get_version.outputs.version-without-v }}

- name: Install dependencies
run: npm ci --ignore-scripts
run: npm ci

- name: Run tests
run: npm test

- name: Build source files
run: npm run tsc
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ name: test
on:
push:
branches: [main]
paths-ignore:
- 'README.md'
- 'LICENSE.md'
- '.github/workflows/publish.yml'
- '.github/dependabot.yml'
pull_request:
branches: [main]

Expand Down

0 comments on commit c0699c9

Please sign in to comment.