BaiduNetdisk-Docker/.github/workflows/test.yml
2024-05-05 22:41:26 +08:00

59 lines
1.4 KiB
YAML

name: test
on:
workflow_dispatch:
push:
branches:
- "main"
- "develop"
paths-ignore:
- "docs/**"
- "**.md"
env:
BUILD_TAG: localhost:5000/yucatovo/baidunetdisk-docker:test
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform: ["linux/amd64", "linux/arm64"]
services:
registry:
image: registry:3.0.0-alpha.1
ports:
- 5000:5000
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set the value
id: set-vars
run: |
echo "TARGET=$(echo ${{ matrix.platform }} | sed 's#/#-#g')" >> "$GITHUB_OUTPUT"
echo "ARCH=$(echo ${{ matrix.platform }} | sed 's#linux/##g')" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
platforms: ${{ matrix.platform }}
- name: Build
uses: docker/bake-action@v4
with:
push: true
targets: ${{ steps.set-vars.outputs.TARGET }}
env:
DEFAULT_TAG: ${{ env.BUILD_TAG }}-${{ steps.set-vars.outputs.TARGET }}
- name: Test
run: |
uname -m
docker run --rm --platform "${{ matrix.platform }}" alpine:edge echo hello