Skip to content

try to replace vmactions/freebsd-vm action with cross-platform-actions/action #514

try to replace vmactions/freebsd-vm action with cross-platform-actions/action

try to replace vmactions/freebsd-vm action with cross-platform-actions/action #514

Workflow file for this run

name: ci
on:
push:
branches: [main]
paths-ignore:
- "**.md"
pull_request:
branches: [main]
paths-ignore:
- "**.md"
release:
types: [published]
jobs:
ci:
name: ci
strategy:
matrix:
os: [ubuntu-20.04, macos-12]
runs-on: ${{ matrix.os }}
env:
TAG: "0.3.6"
AMD64_LINUX_GCC: amd64-linux-gcc
AMD64_LINUX_CLANG: amd64-linux-clang
AMD64_WINDOWS_MINGW: amd64-windows-mingw
AMD64_MACOSX_GCC: amd64-macosx-gcc
AMD64_FREEBSD_GCC: amd64-freebsd-gcc
ARTIFACT_DIR: .artifacts
ARTIFACT_RETENTION_DAYS: 5
steps:
- name: Get tag if tagged/released and set TAG env var
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
TAG=$(echo $GITHUB_REF | cut -d '/' -f3)
echo "TAG: $TAG"
if [[ $TAG == "v"* ]]; then
TAG="${TAG:1}"
fi
echo "TAG: $TAG"
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- name: Set up Linux
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y mingw-w64 rpm alien nuget
sudo apt remove -y jq
- name: Set up macOS
if: runner.os == 'macOS'
run: |
brew install coreutils tree autoconf automake libtool
brew uninstall jq
# --- Build ---
- name: Build on macOS-12 (${{ env.AMD64_FREEBSD_GCC }})
if: matrix.os == 'macos-12'
env:
PREFIX: ${{ env.AMD64_FREEBSD_GCC }}
CC: gcc
MAKE: gmake
RUN_TESTS: false
# uses: vmactions/freebsd-vm@v0 # https://github.com/vmactions/freebsd-vm
uses: cross-platform-actions/action@v0.21.0
with:
# mem: 2048
# release: 12.3
# envs: 'PREFIX CC MAKE RUN_TESTS ARTIFACT_DIR'
# usesh: true
# prepare: pkg install -y tree zip git autotools gmake lang/gcc
# run: |
# ./scripts/ci-build.sh
mem: 2048
operating_system: freebsd
version: '13.2'
envs: 'PREFIX CC MAKE RUN_TESTS ARTIFACT_DIR'
prepare: sudo pkg install -y tree zip git autotools gmake lang/gcc
run: |
./scripts/ci-build.sh
- name: Build on Linux (${{ env.AMD64_LINUX_GCC }})
if: runner.os == 'Linux'
env:
PREFIX: ${{ env.AMD64_LINUX_GCC }}
CC: gcc
MAKE: make
RUN_TESTS: true
shell: bash
run: |
./scripts/ci-build.sh
./scripts/ci-create-debian-package.sh
./scripts/ci-create-rpm-package.sh
- name: Build on Linux (${{ env.AMD64_LINUX_CLANG }})
if: runner.os == 'Linux'
env:
PREFIX: ${{ env.AMD64_LINUX_CLANG }}
CC: clang
MAKE: make
RUN_TESTS: true
shell: bash
run: |
./scripts/ci-build.sh
./scripts/ci-create-debian-package.sh
./scripts/ci-create-rpm-package.sh
- name: Build on Linux (${{ env.AMD64_WINDOWS_MINGW }})
if: runner.os == 'Linux'
env:
PREFIX: ${{ env.AMD64_WINDOWS_MINGW }}
CC: x86_64-w64-mingw32-gcc
MAKE: make
RUN_TESTS: false
CXX: x86_64-w64-mingw32-g++
CPP: x86_64-w64-mingw32-cpp
RANLIB: x86_64-w64-mingw32-ranlib
AR: x86_64-w64-mingw32-ar
NM: x86_64-w64-mingw32-nm
WINDRES: x86_64-w64-mingw32-windres
shell: bash
run: |
./scripts/ci-build.sh
./scripts/ci-create-nuget-package.sh
- name: Build on macOS (${{ env.AMD64_MACOSX_GCC }})
if: runner.os == 'macOS'
env:
PREFIX: ${{ env.AMD64_MACOSX_GCC }}
CC: gcc-11
MAKE: make
RUN_TESTS: false
shell: bash
run: |
./scripts/ci-build.sh
./$PREFIX/bin/zsv version
# --- Upload build artifacts ---
- name: Prepare build artifacts for upload
run: ./scripts/ci-prepare-artifacts-for-upload.sh
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.zip)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.zip
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.zip)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.zip
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.deb)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.deb
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.deb)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.deb
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.rpm)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.rpm
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.rpm)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.rpm
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_WINDOWS_MINGW }}.zip)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_WINDOWS_MINGW }}.zip
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_WINDOWS_MINGW }}.nupkg)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_WINDOWS_MINGW }}.nupkg
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_MACOSX_GCC }}.zip)
if: runner.os == 'macOS'
uses: actions/upload-artifact@v3
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_MACOSX_GCC }}.zip
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_FREEBSD_GCC }}.zip)
if: matrix.os == 'macos-12'
uses: actions/upload-artifact@v3
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_FREEBSD_GCC }}.zip
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.tar.gz)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_GCC }}.tar.gz
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.tar.gz)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_LINUX_CLANG }}.tar.gz
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_WINDOWS_MINGW }}.tar.gz)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_WINDOWS_MINGW }}.tar.gz
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_MACOSX_GCC }}.tar.gz)
if: runner.os == 'macOS'
uses: actions/upload-artifact@v3
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_MACOSX_GCC }}.tar.gz
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
- name: Upload (zsv-${{ env.TAG }}-${{ env.AMD64_FREEBSD_GCC }}.tar.gz)
if: matrix.os == 'macos-12'
uses: actions/upload-artifact@v3
env:
ARTIFACT_NAME: zsv-${{ env.TAG }}-${{ env.AMD64_FREEBSD_GCC }}.tar.gz
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIR }}/${{ env.ARTIFACT_NAME }}
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
if-no-files-found: error
# --- Upload release artifacts ---
- name: Upload release artifacts
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
files: |
${{ env.ARTIFACT_DIR }}/*.zip
${{ env.ARTIFACT_DIR }}/*.tar.gz
${{ env.ARTIFACT_DIR }}/*.deb
${{ env.ARTIFACT_DIR }}/*.rpm
${{ env.ARTIFACT_DIR }}/*.nupkg
# --- Update homebrew tap ---
- name: Update homebrew tap (liquidaty/homebrew-zsv)
if: ${{ startsWith(github.ref, 'refs/tags/v') && runner.os == 'macOS' }}
env:
HOMEBREW_TAP_DEPLOY_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
TAG: ${{ env.TAG }}
TRIPLET: ${{ env.AMD64_MACOSX_GCC }}
run: |
./scripts/ci-update-homebrew-tap.sh