Skip to content

Test sound on macOS #219

Test sound on macOS

Test sound on macOS #219

Workflow file for this run

name: GitHub CI
on:
push:
pull_request:
workflow_dispatch:
inputs:
hello:
description: hello
required: true
type: boolean
world:
description: world
required: false
type: boolean
greeting:
description: greeting
type: string
default: github actions hello
jobs:
trial-sound:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-12
- macos-14
number:
- 1
include:
- os: macos-12
number: 2
- os: macos-12
number: 3
steps:
- name: Grant microphone access for macos-14
if: matrix.os == 'macos-14'
run: sqlite3 $HOME/Library/Application\ Support/com.apple.TCC/TCC.db "INSERT OR IGNORE INTO access VALUES ('kTCCServiceMicrophone','/usr/local/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159,NULL,NULL,'UNUSED',1687786159);"
- name: Test
id: test
run: |
echo "start_dt=$(date +'%F %H:%M:%S')" >> $GITHUB_OUTPUT
cat <<'EOT' > test.swift
import AppKit
if let s = NSSound(named: "Tink") {
if !s.play() {
exit(1)
}
}
EOT
xcrun swiftc -o test.out test.swift
./test.out
- name: Log
if: always()
run: |
log show --no-pager 2>&1 | head -n10 | tee "${{ matrix.os }}-${{ matrix.number }}.log"
log show --start "${{ steps.test.outputs.start_dt }}" --no-pager >>"${{ matrix.os }}-${{ matrix.number }}.log" 2>&1
- name: Upload artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.number }}-${{ github.run_number }}_${{ github.run_attempt }}-artifact
path: ${{ matrix.os }}-${{ matrix.number }}.log
retention-days: 1
# trial-bufsize:
# runs-on: ${{ matrix.os }}
#
# strategy:
# fail-fast: false
# matrix:
# os:
# - ubuntu-latest
# - macos-13
# - macos-14
#
# steps:
# - name: Checkout
# uses: actions/checkout@v4
#
# - name: Check pipebufsize
# run: python3 pipebufsize.py
#
# - name: Check ptsbufsize
# run: python3 ptsbufsize.py
# trial-docker-buildx:
# runs-on: ubuntu-latest
#
# steps:
# - name: Checkout
# uses: actions/checkout@v4
#
# - name: Setup Docker Buildx
# uses: docker/setup-buildx-action@v3
#
# - name: Preparation
# run: |
# mkdir -p target
# echo hello > target/index.txt
# find -type f -not -path './.*/*' | sort
#
# - name: Build Docker Image
# uses: docker/build-push-action@v5
# with:
# context: .
# push: false
# tags: "buildtest:latest"
# outputs: type=image,oci-mediatypes=true,compression=gzip,compression-level=3,force-compression=true
# trial-multiline:
# runs-on: ubuntu-latest
#
# steps:
# - name: Checkout
# uses: actions/checkout@v4
#
# - name: Multiline variables
# run: |
# echo "MULTILINE=${{
# inputs.hello == 'hello' &&
# inputs.world == 'world'
# }}" >> $GITHUB_ENV
#
# - name: Check greeting
# env:
# GREETING: ${{ inputs.greeting }}
# run: echo "greeting=$(echo "${GREETING}" | sed -e 's/./&-/g')" >> $GITHUB_ENV
#
# - name: Check env
# run: echo "${MULTILINE}"
#
# - name: Multiline input
# uses: ./.github/actions/test
# with:
# jq-input: |
# hello
# world
# github,actions
# trial-deno:
# runs-on: ${{ matrix.os }}
#
# strategy:
# fail-fast: false
# matrix:
# os:
# - ubuntu-latest
# - macos-13
# - macos-14
# - windows-latest
# deno-version:
# - v1.x
# # - "1.27.2"
# # - "1.27.1"
# # - "1.27.0"
#
# steps:
# - name: Setup Deno
# uses: denoland/setup-deno@v1
# with:
# deno-version: ${{ matrix.deno-version }}
#
# - name: Deno.systemMemoryInfo
# run: deno eval 'console.log(Deno.systemMemoryInfo());'
#
# - name: os.cpus
# run: deno eval 'import os from "node:os";console.log(os.cpus());'
# trial-secret:
# runs-on: ubuntu-latest
#
# steps:
# - name: Checkout
# uses: actions/checkout@v4
#
# - name: Set secret to env
# run: echo "MY_SECRET=${{ secrets.SECRET_VALUE }}" >> $GITHUB_ENV
#
# - name: Use env
# uses: ./.github/actions/test
# with:
# example: ${{ env.MY_SECRET }}
#
# trial-gh:
# runs-on: ubuntu-latest
#
# steps:
# - name: Show context
# run: |
# (
# echo "github.event_name=${{ github.event_name }}"
# echo "${{ toJSON(github.event) }}"
# ) || true
#
# - uses: actions/checkout@v4
#
# - name: Commit
# if: github.ref_name == 'master'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# grep -qv hello dir/sample.txt
# echo hello >> dir/sample.txt
# git config --local user.name 'github-actions[bot]'
# git config --local user.email 'github-actions[bot]@users.noreply.github.com'
# git switch -c trial/gh
# git add dir/sample.txt
# git commit -m 'Add message'
# git push -u origin trial/gh
#
# - name: Create pull request
# if: github.ref_name == 'master'
# id: pull_request
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# cat << EOT > /tmp/message
# ### Test
#
# * message 1
# * message 2
# EOT
# gh pr create --base master --title 'trial: Add message' --body-file /tmp/message | tee /tmp/pull_request
# echo "::set-output name=url::$(cat /tmp/pull_request)"
#
# - name: Merge pull request
# if: github.ref_name == 'master'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# gh pr merge ${{ steps.pull_request.outputs.url }} --auto --merge --delete-branch
#
# setup:
# runs-on: ubuntu-latest
#
# outputs:
# env: ${{ toJSON(env) }}
# matrix: ${{ steps.matrix.outputs.json }}
#
# env:
# VERSION: v1.0
# URL: https://github.com/
#
# steps:
# - uses: actions/checkout@v4
#
# - name: Matrix
# id: matrix
# uses: ./.github/actions/generate-matrix
# with:
# matrix: |
# compiler:
# - clang
# - gcc
# arch:
# - x86_64
# - arm64
# include:
# - compiler: gcc
# arch: powerpc
# exclude:
# - compiler: gcc
# arch: arm64
#
# prepare:
# needs: setup
#
# if: always()
#
# runs-on: ubuntu-latest
#
# env: ${{ fromJSON(needs.setup.outputs.env) }}
#
# strategy:
# fail-fast: false
# matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
#
# steps:
# - name: Prepare
# run: |
# ${{ matrix.arch != 'dummy' }} \
# && echo "${{ matrix.compiler }},${{ matrix.arch }}" > artifact-${{ matrix.compiler }}-${{ matrix.arch }}.txt
#
# - uses: actions/upload-artifact@v3
# with:
# name: artifact-${{ matrix.compiler }}-${{ matrix.arch }}
# path: artifact-${{ matrix.compiler }}-${{ matrix.arch }}.txt
#
# trial:
# needs: [setup, prepare]
#
# if: always()
#
# runs-on: ubuntu-latest
#
# env: ${{ fromJSON(needs.setup.outputs.env) }}
#
# strategy:
# fail-fast: false
# matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
#
# steps:
# - uses: actions/download-artifact@v3
# with:
# name: artifact-${{ matrix.compiler }}-${{ matrix.arch }}
#
# - name: Trial
# run: cat artifact-${{ matrix.compiler }}-${{ matrix.arch }}.txt
#
# cleanup:
# needs: trial
#
# if: always()
#
# runs-on: ubuntu-latest
#
# steps:
# - name: Delete artifacts
# run: |
# headers=( \
# -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
# -H "Accept: application/vnd.github.v3+json" \
# )
# api_url=${{ github.api_url }}/repos/${{ github.repository }}/actions
# curl -s "${headers[@]}" ${api_url}/runs/${{ github.run_id }}/artifacts \
# | jq -r '.artifacts[].id' \
# | xargs -I{} curl -s -X DELETE "${headers[@]}" ${api_url}/artifacts/{}
#
# trial-stdio:
# runs-on: ${{ matrix.os }}
#
# strategy:
# fail-fast: false
# matrix:
# os:
# - macos-latest
# - ubuntu-latest
#
# steps:
# - name: Show stdio
# run: |
# echo 'altscreen on' >screenrc
# screen -dmLU -c screenrc -S show-stdio bash -c 'sleep 3 & lsof -p $!'
# while screen -list 2>/dev/null | grep -qs show-stdio; do sleep 1; done
# cat screenlog.0