Skip to content

feat(gh workflows) : ci mac intel #3

feat(gh workflows) : ci mac intel

feat(gh workflows) : ci mac intel #3

Workflow file for this run

name : Build
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.ref_name }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
verify-flake:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/common-setup
with:
cachix_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Check Nix flake
run: nix flake check --all-systems
build-for-linux_x86_64:
name: build for linux_x86_64
runs-on: ubuntu-20.04
needs: [verify-flake]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/common-setup
with:
cachix_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build termusix for x86_64-unknown-linux-gnu
run: |
nix build .#termusix_x86_64-linux --show-trace --log-lines 10000
./result/bin/termusix --version
nix develop --command ./scripts/export-linux-bin.sh termusix ./binaries
- name : upload packages termusix-x86_64-linux
uses : actions/upload-artifact@v4
with :
name : termusix-x86_64-linux
path : binaries/termusix-x86_64-linux
build-for-arm-linux-and-windows:
name: build for linux arm and windows
runs-on: ubuntu-20.04
needs: [verify-flake]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/common-setup
with:
cachix_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build termusix for aarch64-unknown-linux-gnu
run: |
nix build .#termusix_aarch64-linux --show-trace --log-lines 10000
cp ./result/bin/termusix binaries/termusix-aarch64-linux
- name : upload packages termusix-aarch64-linux
uses : actions/upload-artifact@v4
with :
name : termusix-aarch64-linux
path : binaries/termusix-aarch64-linux
- name: Build termusix for x86_64-pc-windows-gnu
run: |
nix build .#termusix_x86_64-windows --show-trace --log-lines 10000
cp ./result/bin/termusix.exe binaries/termusix-x86_64-windows.exe
- name : upload packages termusix-x86_64-windows
uses : actions/upload-artifact@v4
with :
name : termusix-x86_64-windows
path : binaries/termusix-x86_64-windows.exe
build-for-apple-intel:
name: build for x86_64-apple-darwin
runs-on: macos-13
needs: [verify-flake]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/common-setup
with:
cachix_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build termusix for x86_64-apple-darwin
run: |
nix build .#termusix_x86_64-apple --show-trace --log-lines 10000
./result/bin/termusix --version
cp ./result/bin/termusix binaries/termusix-x86_64-apple
- name : upload packages termusix-x86_64-apple
uses : actions/upload-artifact@v4
with :
name : termusix-x86_64-apple
path : binaries/*
- name: tar the package for mac-intel
run: |
mkdir -p tar_folder
nix build .#tar-darwin-x86_64 --show-trace --log-lines 10000
cp ./result/* tar_folder/
- name: upload packages termusix-aarch64-apple
uses: actions/upload-artifact@v4
with:
name: termusix-x86_64-apple-tar
path: tar_folder/*
build-for-apple-arm:
name: build for apple Mac
runs-on: macos-latest
needs: [build-for-apple-intel]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/common-setup
with:
cachix_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build termusix for aarch64-apple-darwin
run: |
nix build .#termusix_aarch64-apple --show-trace --log-lines 10000
./result/bin/termusix --version
cp ./result/bin/termusix binaries/termusix-aarch64-apple
- name: upload packages termusix-aarch64-apple
uses: actions/upload-artifact@v4
with:
name: termusix-aarch64-apple
path: binaries/termusix-aarch64-apple
- name: tar the package for mac-arm
run: |
mkdir -p tar_arm
nix build .#tar-darwin-arm --show-trace --log-lines 10000
cp ./result/* tar_arm/
- name: upload packages termusix-aarch64-apple
uses: actions/upload-artifact@v4
with:
name: termusix-aarch64-apple-tar
path: tar_arm/*
- name: download tar artifact from darwin intel
uses: actions/download-artifact@v4
with:
name: termusix-x86_64-apple-tar
path: tar_intel
- name: calulate sha of tar intel
run: |
first_tar_gz=$(ls tar_intel/*.tar.gz | head -n 1)
if [ -z "$first_tar_gz" ]; then
echo "No .tar.gz file found in artifacts directory"
exit 1
fi
checksum=$(shasum -a 256 "$first_tar_gz" | awk '{print $1}')
echo "checksum_intel=$checksum" >> $GITHUB_ENV
- name: calulate sha of tar arm
run: |
first_tar_gz=$(ls tar_arm/*.tar.gz | head -n 1)
if [ -z "$first_tar_gz" ]; then
echo "No .tar.gz file found in artifacts directory"
exit 1
fi
checksum=$(shasum -a 256 "$first_tar_gz" | awk '{print $1}')
echo "checksum_arm=$checksum" >> $GITHUB_ENV
- name: get version of app
run: |
nix build .#get_termusix_version_darwin
version=$(cat result/version.txt)
echo "version_termusix=$version" >> $GITHUB_ENV
- name: build the ruby file
run: |
shaArm=${{ env.checksum_arm }}
shaIntel=${{ env.checksum_intel }}
version=${{ env.version_termusix }}
echo "checksum_arm=$shaArm"
echo "checksum_intel=$shaIntel"
echo "version=$version"
nix develop --command ./scripts/pack_homebrew.sh $shaArm $shaIntel $version
cat rb_build/termusix.rb
- name: upload ruby file
uses: actions/upload-artifact@v4
with:
name: homebrew-pack-termusix
path: rb_build/termusix.rb
test-from-latest-ubuntu:
name : test for linux_x86_64
runs-on: ubuntu-latest
needs: build-for-linux_x86_64
steps:
- uses: actions/download-artifact@v4
with:
name: termusix-x86_64-linux
- name: set permissions on package
run: chmod +x termusix-x86_64-linux
- name: Ensure the command runs
run: ./termusix-x86_64-linux --version
test-from-apple-arm:
name : test for apple ARM
runs-on: macos-latest
needs: build-for-apple-arm
steps:
- uses: actions/download-artifact@v4
with:
name: termusix-aarch64-apple
- name: set permissions on package
run: chmod +x termusix-aarch64-apple
- name: Ensure the command runs
run: ./termusix-aarch64-apple --version
test-from-apple-x86_64:
name : test for x86_64-apple-darwin
runs-on: macos-13
needs: build-for-apple-intel
steps:
- uses: actions/download-artifact@v4
with:
name: termusix-x86_64-apple
- name: set permissions on package
run: chmod +x termusix-x86_64-apple
- name: Ensure the command runs
run: ./termusix-x86_64-apple --version
test-from-windows:
name : test for windows
runs-on: windows-latest
needs: build-for-arm-linux-and-windows
steps:
- uses: actions/download-artifact@v4
with:
name: termusix-x86_64-windows
- name: Ensure the command runs
run: ./termusix-x86_64-windows.exe --version
make-release-group:
runs-on: ubuntu-latest
needs:
- test-from-latest-ubuntu
- test-from-apple-arm
- test-from-apple-x86_64
- test-from-windows
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release
pattern: termusix-*
merge-multiple: true
- name : List all packages
run : ls -R
- uses: actions/upload-artifact@v4
with:
name: release
path: release