Test #1051
This file contains 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: Test | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
schedule: | |
- cron: 6 22 * * FRI | |
jobs: | |
check-format: | |
name: Check Format | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone | |
uses: actions/checkout@v4 | |
- name: Check | |
run: scripts/github/check-format | |
check-lint: | |
name: Check Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone | |
uses: actions/checkout@v4 | |
- name: Lint | |
run: scripts/github/lint | |
unit-test: | |
strategy: | |
matrix: | |
sanitizer: ["none", "asan"] | |
include: | |
- sanitizer: asan | |
name_suffix: " (ASAN)" | |
name: Unit Test${{ matrix.name_suffix }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone | |
uses: actions/checkout@v4 | |
- name: Unit Test | |
env: | |
SANITIZER: ${{ matrix.sanitizer }} | |
run: scripts/github/unit-test | |
build-integration-test-images: | |
strategy: | |
matrix: | |
target: | |
- name: "Latest" | |
libmpdclient_version: "latest" | |
mpd_version: "latest" | |
- name: "Noble" | |
libmpdclient_version: "2.22" | |
mpd_version: "0.23.14" | |
- name: "Jammy" | |
libmpdclient_version: "2.20" | |
mpd_version: "0.23.5" | |
- name: "Focal" | |
libmpdclient_version: "2.18" | |
mpd_version: "0.21.20" | |
name: "Build ${{ matrix.target.name }} Integration Test Container" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 'stable' | |
cache-dependency-path: tools/meta/go.sum | |
- uses: docker/setup-buildx-action@v3 | |
# This whole little song and dance is pretty annoying. Ideally I could | |
# just use ./scripts/run-integration and be done with it, but to get | |
# caching, I need to use the build-push-action. This is because gha | |
# only exposes the necessary values to the node runtime, not via a script | |
# consumable mechanism. There is a bug out for this, so hopefully this | |
# can all be deleted eventually: https://github.com/actions/runner/issues/3046 | |
# | |
# We still need to run "build-test-image" here to do the little tarring | |
# step. Maybe I can delete that, and just go straight to build-push-action? | |
- name: Stage Build | |
id: stage | |
env: | |
MPD_VERSION: ${{ matrix.target.mpd_version }} | |
LIBMPDCLIENT_VERSION: ${{ matrix.target.libmpdclient_version }} | |
run: | | |
git submodule update --init --recursive | |
# produces the outputs used in the subseqent step | |
scripts/github/resolve-versions | |
- name: Build Integration Test Container | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: t/docker/Dockerfile.ubuntu | |
build-args: | | |
LIBMPDCLIENT_VERSION=${{ steps.stage.outputs.LIBMPDCLIENT_VERSION }} | |
MPD_VERSION=${{ steps.stage.outputs.MPD_VERSION }} | |
tags: test/ashuffle:latest | |
cache-from: type=gha,scope=${{ matrix.target.name }} | |
cache-to: type=gha,mode=max,scope=${{ matrix.target.name }} | |
integration-test: | |
strategy: | |
matrix: | |
target: | |
- name: "Latest" | |
libmpdclient_version: "latest" | |
mpd_version: "latest" | |
- name: "Noble" | |
libmpdclient_version: "2.22" | |
mpd_version: "0.23.14" | |
- name: "Jammy" | |
libmpdclient_version: "2.20" | |
mpd_version: "0.23.5" | |
- name: "Focal" | |
libmpdclient_version: "2.18" | |
mpd_version: "0.21.20" | |
test_group: | |
- name: "Short" | |
args: "-short" | |
- name: "Memory (Massive)" | |
args: "-run 'TestMaxMemoryUsage/massive'" | |
- name: "Memory (Worst Case)" | |
args: "-run 'TestMaxMemoryUsage/worst.case'" | |
- name: "Startup (From MPD)" | |
args: "-run 'TestFastStartup/from.mpd'" | |
- name: "Startup (From File)" | |
args: "-run 'TestFastStartup/from.file'" | |
- name: "Startup (From File, With Filter)" | |
args: "-run 'TestFastStartup/from.file,.with.filter'" | |
- name: "Startup (From MPD, Group By)" | |
args: "-run 'TestFastStartup/from.mpd,.group-by'" | |
name: "Integration Test (${{ matrix.target.name }}): ${{ matrix.test_group.name }}" | |
runs-on: ubuntu-latest | |
needs: [check-format, check-lint, unit-test, build-integration-test-images] | |
steps: | |
# this is a replay of the build-container steps, but since those ran | |
# previously, this should be fully cached. | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 'stable' | |
cache-dependency-path: tools/meta/go.sum | |
- uses: docker/setup-buildx-action@v3 | |
# This whole little song and dance is pretty annoying. Ideally I could | |
# just use ./scripts/run-integration and be done with it, but to get | |
# caching, I need to use the build-push-action. This is because gha | |
# only exposes the necessary values to the node runtime, not via a script | |
# consumable mechanism. There is a bug out for this, so hopefully this | |
# can all be deleted eventually: https://github.com/actions/runner/issues/3046 | |
# | |
# We still need to run "build-test-image" here to do the little tarring | |
# step. Maybe I can delete that, and just go straight to build-push-action? | |
- name: Stage Build | |
id: stage | |
env: | |
MPD_VERSION: ${{ matrix.target.mpd_version }} | |
LIBMPDCLIENT_VERSION: ${{ matrix.target.libmpdclient_version }} | |
run: | | |
git submodule update --init --recursive | |
# produces the outputs used in the subseqent step | |
scripts/github/resolve-versions | |
- name: Build Integration Test Container | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: t/docker/Dockerfile.ubuntu | |
build-args: | | |
LIBMPDCLIENT_VERSION=${{ steps.stage.outputs.LIBMPDCLIENT_VERSION }} | |
MPD_VERSION=${{ steps.stage.outputs.MPD_VERSION }} | |
tags: test/ashuffle:latest | |
cache-from: type=gha,scope=${{ matrix.target.name }} | |
load: true | |
# This is the actual new work, running the actual test. | |
- name: Run Test | |
run: | | |
scripts/run-integration \ | |
--no_build_use_image=test/ashuffle:latest \ | |
--no_tty ${{ matrix.test_group.args }} | |
release-build: | |
name: Release Build (${{ matrix.target.arch }}) | |
runs-on: ubuntu-latest | |
needs: [check-format, check-lint, unit-test] | |
strategy: | |
matrix: | |
target: | |
- arch: "x86_64" | |
triple: "x86_64-linux-gnu" | |
- arch: "aarch64" | |
triple: "aarch64-linux-gnu" | |
- arch: "armv6h" | |
triple: "armv6h-linux-gnueabihf" | |
- arch: "armv7h" | |
triple: "armv7h-linux-gnueabihf" | |
steps: | |
- name: Clone | |
uses: actions/checkout@v4 | |
- name: Release Build | |
run: scripts/github/release ashuffle.${{ matrix.target.triple }} ${{ matrix.target.arch }} | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ashuffle.${{ matrix.target.triple }} | |
path: ashuffle.${{ matrix.target.triple }} | |
if-no-files-found: error | |
retention-days: 7 | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [release-build, integration-test] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Clone | |
uses: actions/checkout@v4 | |
- name: Download Builds | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "ashuffle.*" | |
# Download files into the destination path, not separate directories. | |
merge-multiple: true | |
- name: Deploy | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RELEASE_TAG: ${{ github.ref }} | |
run: | | |
find . | |
# Cut off the "refs/tags" prefix. | |
tag="${RELEASE_TAG#"refs/tags/"}" | |
gh release create \ | |
--draft \ | |
--title "${tag}" \ | |
--generate-notes \ | |
"${tag}" \ | |
ashuffle.x86_64-linux-gnu \ | |
ashuffle.aarch64-linux-gnu \ | |
ashuffle.armv7h-linux-gnueabihf \ | |
ashuffle.armv6h-linux-gnueabihf |