Skip to content

Add ads

Add ads #12

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- '**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions: {}
defaults:
run:
shell: bash
jobs:
phar:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: none
tools: box:4
- uses: ramsey/composer-install@v3
with:
composer-options: --no-dev --prefer-dist
- run: box compile
- uses: actions/upload-artifact@v4
with:
name: composer-semver.phar
path: phar/composer-semver
if-no-files-found: error
build:
needs: phar
strategy:
matrix:
runs-on:
- ubuntu-24.04-arm
- ubuntu-24.04
- macos-15
- macos-15-intel
runs-on: ${{ matrix.runs-on }}
steps:
- name: Set OS environment variable
run: echo OS="$(uname -s)" >> $GITHUB_ENV
- run: echo "${OS}"
- name: Set ARCH environment variable
run: |
arch="$(uname -m)"
test "${arch}" = "aarch64" && arch="arm64"
test "${arch}" = "x86_64" && arch="amd64"
echo ARCH="${arch}" >> $GITHUB_ENV
- run: echo "$ARCH"
- name: Set SPC_OS environment variable
run: |
spc_os="${OS}"
test "${OS}" = "Darwin" && spc_os="macos"
test "${OS}" = "Linux" && spc_os="linux"
echo SPC_OS="${spc_os}" >> $GITHUB_ENV
- run: echo "${SPC_OS}"
- name: Set SPC_ARCH environment variable
run: |
spc_arch="${ARCH}"
test "${spc_arch}" = "arm64" && spc_arch="aarch64"
test "${spc_arch}" = "amd64" && spc_arch="x86_64"
echo "SPC_ARCH=${spc_arch}" >> $GITHUB_ENV
- run: echo "${SPC_ARCH}"
- name: Install spc
run: |
gh release download --repo crazywhalecc/static-php-cli --pattern "${PATTERN}" --output spc.tar.gz && \
mkdir -p /tmp/spc && \
tar -xvf spc.tar.gz --directory /tmp/spc && \
echo "/tmp/spc" >> "$GITHUB_PATH"
env:
PATTERN: spc-${{ env.SPC_OS }}-${{ env.SPC_ARCH }}.tar.gz
GH_TOKEN: ${{ github.token }}
- uses: actions/checkout@v5
with:
sparse-checkout: |
craft.yml
sparse-checkout-cone-mode: false
- uses: actions/download-artifact@v5
with:
name: composer-semver.phar
path: phar
- run: spc craft
env:
GITHUB_TOKEN: ${{ github.token }}
- run: mkdir -p out
- run: spc micro:combine phar/composer-semver --output out/composer-semver
- uses: actions/upload-artifact@v4
with:
name: composer-semver_${{ env.OS }}_${{ env.ARCH }}
path: out/composer-semver
if-no-files-found: error
nfpm:
needs: build
runs-on: ubuntu-24.04-arm
steps:
- name: Set VERSION environment variable
run: echo VERSION="${TAGISH#v}" >> $GITHUB_ENV
env:
TAGISH: ${{ github.ref_type == 'tag' && github.ref_name || format('v0.0.0-{0}+{1}', github.run_number, github.sha) }}
- run: echo "${VERSION}"
- name: Download nfpm
run: gh release download --repo goreleaser/nfpm --pattern 'nfpm_*_arm64.deb' --output nfpm.deb
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Install nfpm
run: sudo dpkg -i nfpm.deb
- uses: actions/checkout@v5
with:
sparse-checkout: |
nfpm.yaml
README.md
LICENSE
sparse-checkout-cone-mode: false
- uses: actions/download-artifact@v5
with:
pattern: composer-semver_Linux_*
path: dist
- run: mkdir -p deb
- name: Creates packages
run: |
for arch in ${ARCHS}; do
echo "::group::==> ${arch}"
DIST_DIR="dist/composer-semver_Linux_${arch}" \
ARCH="${arch}" nfpm package --packager deb --target "deb/composer-semver_Linux_${arch}.deb"
echo "::endgroup::"
done
env:
DIST_DIR: dist
ARCHS: "arm64 amd64"
- uses: actions/upload-artifact@v4
with:
name: deb
path: deb/*.deb
if-no-files-found: error
test-linux:
needs: nfpm
strategy:
matrix:
runs-on:
- ubuntu-24.04-arm
- ubuntu-24.04
runs-on: ${{ matrix.runs-on }}
env:
GOFLAGS: '-mod=mod'
steps:
- name: Set ARCH environment variable
run: |
arch="$(uname -m)"
test "${arch}" = "aarch64" && arch="arm64"
test "${arch}" = "x86_64" && arch="amd64"
echo ARCH="${arch}" >> $GITHUB_ENV
- run: echo "$ARCH"
- uses: actions/download-artifact@v5
with:
name: deb
path: deb
- run: sudo dpkg -i "deb/composer-semver_Linux_${ARCH}.deb"
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Print composer-semver binary path
run: go test -count=1 -v ./internal
- run: go test -count=1 ./...
test-darwin:
needs: build
strategy:
matrix:
runs-on:
- macos-15
- macos-15-intel
runs-on: ${{ matrix.runs-on }}
env:
GOFLAGS: '-mod=mod'
steps:
- name: Set ARCH environment variable
run: |
arch="$(uname -m)"
test "${arch}" = "aarch64" && arch="arm64"
test "${arch}" = "x86_64" && arch="amd64"
echo ARCH="${arch}" >> $GITHUB_ENV
- run: echo "$ARCH"
- uses: actions/checkout@v5
- uses: actions/download-artifact@v5
with:
name: composer-semver_Darwin_${{ env.ARCH }}
path: out
- name: Grant composer-semver binary execute permission
run: chmod +x out/composer-semver
- name: Add composer-semver binary to PATH
run: echo "${WORKSPACE}/out" >> "$GITHUB_PATH"
env:
WORKSPACE: ${{ github.workspace }}
- uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Print composer-semver binary path
run: go test -count=1 -v ./internal
- run: go test -count=1 ./...
dispatch:
if: github.event_name == 'push' && github.ref_type == 'tag'
needs:
- test-linux
- test-darwin
permissions:
actions: write
runs-on: ubuntu-24.04
steps:
- name: Dispatch Release Workflow
run: |
gh workflow run release.yml \
--repo "${REPO}" \
--ref "${REF}" \
-f version="${VERSION}" \
-f run_id="${RUN_ID}"
env:
REPO: ${{ github.repository }}
REF: ${{ github.ref }}
VERSION: ${{ github.ref_name }}
RUN_ID: ${{ github.run_id }}
GH_TOKEN: ${{ github.token }}