mirror of
https://github.com/docker/actions-toolkit.git
synced 2024-11-23 19:56:09 +08:00
70fba4e078
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
109 lines
2.4 KiB
YAML
109 lines
2.4 KiB
YAML
name: test
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
pull_request:
|
|
paths-ignore:
|
|
- '.github/*-releases.json'
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v3
|
|
-
|
|
name: Test
|
|
uses: docker/bake-action@v2
|
|
with:
|
|
targets: test-coverage
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
-
|
|
name: Upload coverage
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
file: ./coverage/clover.xml
|
|
flags: unit
|
|
|
|
prepare-itg:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
matrix: ${{ steps.tests.outputs.matrix }}
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v3
|
|
-
|
|
name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
cache: 'yarn'
|
|
-
|
|
name: Install
|
|
run: yarn install
|
|
-
|
|
name: Create matrix
|
|
id: tests
|
|
run: |
|
|
declare -a tests
|
|
for test in $(yarn run test:itg-list); do
|
|
tests+=("${test#$(pwd)/__tests__/}")
|
|
done
|
|
echo "matrix=$(echo ${tests[@]} | jq -cR 'split(" ")')" >>${GITHUB_OUTPUT}
|
|
-
|
|
name: Show matrix
|
|
run: |
|
|
echo ${{ steps.tests.outputs.matrix }}
|
|
|
|
test-itg:
|
|
runs-on: ${{ matrix.os }}
|
|
needs:
|
|
- prepare-itg
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
test: ${{ fromJson(needs.prepare-itg.outputs.matrix) }}
|
|
os:
|
|
- ubuntu-latest
|
|
- macos-latest
|
|
- windows-latest
|
|
exclude:
|
|
- os: macos-latest
|
|
test: buildx/bake.test.itg.ts
|
|
- os: windows-latest
|
|
test: buildx/bake.test.itg.ts
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v3
|
|
-
|
|
name: Setup Node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
cache: 'yarn'
|
|
-
|
|
name: Install
|
|
run: yarn install
|
|
-
|
|
name: Test
|
|
run: yarn test:itg-coverage --runTestsByPath __tests__/${{ matrix.test }} --coverageDirectory=./coverage
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
-
|
|
name: Upload coverage
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
file: ./coverage/clover.xml
|
|
flags: itg
|