ghcup-hs/.github/workflows/release.yaml

519 lines
15 KiB
YAML
Raw Permalink Normal View History

2022-10-20 12:37:50 +00:00
name: Build and release
on:
push:
2022-10-20 12:37:50 +00:00
branches:
- master
tags:
- 'v*'
2022-10-20 12:37:50 +00:00
pull_request:
branches:
- master
2022-11-22 11:41:44 +00:00
schedule:
- cron: '0 2 * * *'
2023-07-07 14:36:09 +00:00
env:
CABAL_CACHE_DISABLE: ${{ vars.CABAL_CACHE_DISABLE }}
CABAL_CACHE_NONFATAL: yes
jobs:
2022-12-18 13:52:51 +00:00
build-linux:
name: Build linux binary
2022-10-20 12:37:50 +00:00
runs-on: ${{ matrix.os }}
env:
2023-07-02 04:34:04 +00:00
CABAL_VER: 3.10.1.0
2022-10-20 12:37:50 +00:00
JSON_VERSION: "0.0.7"
2022-11-22 11:41:44 +00:00
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
2022-12-15 16:21:53 +00:00
S3_HOST: ${{ secrets.S3_HOST }}
2022-10-20 12:37:50 +00:00
strategy:
2022-11-22 11:41:44 +00:00
fail-fast: true
2022-10-20 12:37:50 +00:00
matrix:
include:
- os: ubuntu-latest
ARTIFACT: "i386-linux-ghcup"
GHC_VER: 8.10.7
ARCH: 32
- os: ubuntu-latest
ARTIFACT: "x86_64-linux-ghcup"
GHC_VER: 8.10.7
ARCH: 64
steps:
2022-10-20 12:37:50 +00:00
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: 'true'
2022-11-22 11:41:44 +00:00
- if: matrix.ARCH == '32'
2022-10-20 12:37:50 +00:00
name: Run build (32 bit linux)
2022-11-22 11:41:44 +00:00
uses: docker://hasufell/i386-alpine-haskell:3.12
2022-10-20 12:37:50 +00:00
with:
args: sh .github/scripts/build.sh
env:
2022-10-20 12:37:50 +00:00
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: Alpine
2022-11-22 11:41:44 +00:00
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
2022-12-15 16:21:53 +00:00
S3_HOST: ${{ env.S3_HOST }}
2022-10-20 12:37:50 +00:00
2022-11-22 11:41:44 +00:00
- if: matrix.ARCH == '64'
2022-10-20 12:37:50 +00:00
name: Run build (64 bit linux)
2022-11-22 11:41:44 +00:00
uses: docker://hasufell/alpine-haskell:3.12
with:
2022-10-20 12:37:50 +00:00
args: sh .github/scripts/build.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: Alpine
2022-11-22 11:41:44 +00:00
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
2022-12-15 16:21:53 +00:00
S3_HOST: ${{ env.S3_HOST }}
2022-11-22 11:41:44 +00:00
- if: always()
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
./out/*
build-arm:
name: Build ARM binary
runs-on: ${{ matrix.os }}
env:
2023-07-02 04:34:04 +00:00
CABAL_VER: 3.10.1.0
2022-11-22 11:41:44 +00:00
JSON_VERSION: "0.0.7"
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
2022-12-15 16:21:53 +00:00
S3_HOST: ${{ secrets.S3_HOST }}
2022-11-22 11:41:44 +00:00
strategy:
fail-fast: true
matrix:
include:
2023-05-02 11:01:40 +00:00
- os: [self-hosted, Linux, ARM64]
2022-11-22 11:41:44 +00:00
ARTIFACT: "armv7-linux-ghcup"
2023-01-12 16:03:12 +00:00
GHC_VER: 9.2.2
2022-11-22 11:41:44 +00:00
ARCH: ARM
2023-01-14 13:00:32 +00:00
- os: [self-hosted, Linux, ARM64]
2022-11-22 11:41:44 +00:00
ARTIFACT: "aarch64-linux-ghcup"
2023-02-23 15:07:46 +00:00
GHC_VER: 9.2.6
2022-11-22 11:41:44 +00:00
ARCH: ARM64
steps:
2023-02-19 10:11:00 +00:00
- uses: docker://arm64v8/debian:10
2022-11-22 11:41:44 +00:00
name: Cleanup (aarch64 linux)
with:
2023-01-02 11:59:43 +00:00
args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
2022-10-20 12:37:50 +00:00
2022-11-22 11:41:44 +00:00
- name: git config
run: |
git config --global --get-all safe.directory | grep '^\*$' || git config --global --add safe.directory "*"
shell: bash
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: 'true'
- if: matrix.ARCH == 'ARM'
2023-02-19 10:11:00 +00:00
uses: docker://hasufell/arm32v7-debian-haskell:10
2022-11-22 11:41:44 +00:00
name: Run build (armv7 linux)
with:
args: sh .github/scripts/build.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: Ubuntu
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
2022-12-15 16:21:53 +00:00
S3_HOST: ${{ env.S3_HOST }}
2022-11-22 11:41:44 +00:00
- if: matrix.ARCH == 'ARM64'
2023-02-19 10:11:00 +00:00
uses: docker://hasufell/arm64v8-debian-haskell:10
2022-11-22 11:41:44 +00:00
name: Run build (aarch64 linux)
with:
args: sh .github/scripts/build.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: Ubuntu
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
2022-12-15 16:21:53 +00:00
S3_HOST: ${{ env.S3_HOST }}
2022-11-22 11:41:44 +00:00
- if: always()
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
./out/*
build-macwin:
name: Build binary (Mac/Win)
runs-on: ${{ matrix.os }}
env:
2023-07-02 04:34:04 +00:00
CABAL_VER: 3.10.1.0
2022-11-22 11:41:44 +00:00
MACOSX_DEPLOYMENT_TARGET: 10.13
JSON_VERSION: "0.0.7"
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
2022-12-15 16:21:53 +00:00
S3_HOST: ${{ secrets.S3_HOST }}
2022-11-22 11:41:44 +00:00
strategy:
fail-fast: false
matrix:
include:
2023-01-14 13:00:32 +00:00
- os: [self-hosted, macOS, ARM64]
2022-11-22 11:41:44 +00:00
ARTIFACT: "aarch64-apple-darwin-ghcup"
2023-02-23 15:07:46 +00:00
GHC_VER: 9.2.6
2022-11-22 11:41:44 +00:00
ARCH: ARM64
- os: macOS-11
2022-11-22 11:41:44 +00:00
ARTIFACT: "x86_64-apple-darwin-ghcup"
2023-02-23 15:07:46 +00:00
GHC_VER: 9.2.6
2022-11-22 11:41:44 +00:00
ARCH: 64
- os: windows-latest
ARTIFACT: "x86_64-mingw64-ghcup"
GHC_VER: 8.10.7
ARCH: 64
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: 'true'
2023-01-14 13:00:32 +00:00
- if: matrix.ARCH == 'ARM64' && runner.os == 'macOS'
name: Run build
run: |
bash .github/scripts/brew.sh git coreutils llvm@11 autoconf automake
export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$HOME/.brew/opt/llvm@11/bin:$PATH"
export CC="$HOME/.brew/opt/llvm@11/bin/clang"
export CXX="$HOME/.brew/opt/llvm@11/bin/clang++"
export LD=ld
export AR="$HOME/.brew/opt/llvm@11/bin/llvm-ar"
export RANLIB="$HOME/.brew/opt/llvm@11/bin/llvm-ranlib"
bash .github/scripts/build.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: na
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ env.S3_HOST }}
HOMEBREW_CHANGE_ARCH_TO_ARM: 1
- if: matrix.ARCH == '64' && runner.os == 'macOS'
name: Run build (windows/mac)
run: |
bash .github/scripts/brew.sh coreutils
export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$PATH"
bash .github/scripts/build.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: na
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
S3_HOST: ${{ env.S3_HOST }}
HOMEBREW_CHANGE_ARCH_TO_ARM: 1
- if: runner.os == 'Windows'
name: Run build (windows/mac)
run: |
bash .github/scripts/brew.sh git coreutils autoconf automake
bash .github/scripts/build.sh
2022-10-20 12:37:50 +00:00
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: na
2022-11-22 11:41:44 +00:00
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
2022-12-15 16:21:53 +00:00
S3_HOST: ${{ env.S3_HOST }}
2022-11-22 11:41:44 +00:00
HOMEBREW_CHANGE_ARCH_TO_ARM: 1
2022-10-20 12:37:50 +00:00
- if: always()
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
./out/*
2022-12-18 13:52:51 +00:00
test-linux:
2022-11-22 11:41:44 +00:00
name: Test linux
2022-12-18 13:52:51 +00:00
needs: "build-linux"
runs-on: ${{ matrix.os }}
env:
2023-07-02 04:34:04 +00:00
CABAL_VER: 3.10.1.0
2022-10-20 12:37:50 +00:00
JSON_VERSION: "0.0.7"
strategy:
matrix:
2022-10-20 12:37:50 +00:00
include:
- os: ubuntu-latest
ARTIFACT: "i386-linux-ghcup"
GHC_VER: 8.10.7
ARCH: 32
DISTRO: Alpine
- os: ubuntu-latest
ARTIFACT: "x86_64-linux-ghcup"
GHC_VER: 8.10.7
ARCH: 64
DISTRO: Alpine
- os: ubuntu-latest
ARTIFACT: "x86_64-linux-ghcup"
GHC_VER: 8.10.7
ARCH: 64
DISTRO: Ubuntu
2022-11-22 11:41:44 +00:00
steps:
- name: Checkout code
2022-10-20 12:37:50 +00:00
uses: actions/checkout@v3
with:
2022-10-20 12:37:50 +00:00
submodules: 'true'
2022-10-20 12:37:50 +00:00
- uses: actions/download-artifact@v3
with:
name: artifacts
path: ./out
2022-11-22 11:41:44 +00:00
- if: matrix.ARCH == '32' && matrix.DISTRO == 'Alpine'
name: Run test (32 bit linux Alpine)
uses: docker://hasufell/i386-alpine-haskell:3.12
2022-10-20 12:37:50 +00:00
with:
args: sh .github/scripts/test.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: ${{ matrix.DISTRO }}
2022-11-22 11:41:44 +00:00
- if: matrix.ARCH == '64' && matrix.DISTRO == 'Alpine'
name: Run test (64 bit linux Alpine)
uses: docker://hasufell/alpine-haskell:3.12
2022-10-20 12:37:50 +00:00
with:
args: sh .github/scripts/test.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: ${{ matrix.DISTRO }}
2022-11-22 11:41:44 +00:00
- if: matrix.DISTRO != 'Alpine'
name: Run test (64 bit linux)
2023-01-14 13:00:32 +00:00
run: |
sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl gzip
sh .github/scripts/test.sh
2022-10-20 12:37:50 +00:00
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: ${{ matrix.DISTRO }}
2022-11-22 11:41:44 +00:00
2023-01-02 12:47:49 +00:00
- if: failure()
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: testfiles
path: |
./test/golden/unix/GHCupInfo*json
2022-11-22 11:41:44 +00:00
test-arm:
name: Test ARM
needs: "build-arm"
runs-on: ${{ matrix.os }}
env:
2023-07-02 04:34:04 +00:00
CABAL_VER: 3.10.1.0
2022-11-22 11:41:44 +00:00
JSON_VERSION: "0.0.7"
strategy:
matrix:
include:
2023-05-02 11:01:40 +00:00
- os: [self-hosted, Linux, ARM64]
2022-11-22 11:41:44 +00:00
ARTIFACT: "armv7-linux-ghcup"
2023-01-12 16:03:12 +00:00
GHC_VER: 9.2.2
2022-11-22 11:41:44 +00:00
ARCH: ARM
DISTRO: Ubuntu
2023-01-14 13:00:32 +00:00
- os: [self-hosted, Linux, ARM64]
2022-11-22 11:41:44 +00:00
ARTIFACT: "aarch64-linux-ghcup"
2023-02-23 15:07:46 +00:00
GHC_VER: 9.2.6
2022-11-22 11:41:44 +00:00
ARCH: ARM64
DISTRO: Ubuntu
steps:
2023-02-19 10:11:00 +00:00
- uses: docker://arm64v8/debian:10
2022-11-22 11:41:44 +00:00
name: Cleanup (aarch64 linux)
with:
2023-01-02 11:59:43 +00:00
args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
2022-10-20 12:37:50 +00:00
2022-11-22 11:41:44 +00:00
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: 'true'
- uses: actions/download-artifact@v3
with:
name: artifacts
path: ./out
- if: matrix.ARCH == 'ARM'
2023-02-19 10:11:00 +00:00
uses: docker://hasufell/arm32v7-debian-haskell:10
2023-01-01 13:40:04 +00:00
name: Run test (armv7 linux)
2022-11-22 11:41:44 +00:00
with:
2023-01-02 11:59:43 +00:00
args: sh .github/scripts/test.sh
2022-11-22 11:41:44 +00:00
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: Ubuntu
- if: matrix.ARCH == 'ARM64'
2023-02-19 10:11:00 +00:00
uses: docker://hasufell/arm64v8-debian-haskell:10
2023-01-01 13:40:04 +00:00
name: Run test (aarch64 linux)
2022-11-22 11:41:44 +00:00
with:
2023-01-02 11:59:43 +00:00
args: sh .github/scripts/test.sh
2022-11-22 11:41:44 +00:00
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: Ubuntu
2023-01-02 12:47:49 +00:00
- if: failure()
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: testfiles
path: |
./test/golden/unix/GHCupInfo*json
2022-11-22 11:41:44 +00:00
test-macwin:
name: Test Mac/Win
needs: "build-macwin"
runs-on: ${{ matrix.os }}
env:
2023-07-02 04:34:04 +00:00
CABAL_VER: 3.10.1.0
2022-11-22 11:41:44 +00:00
MACOSX_DEPLOYMENT_TARGET: 10.13
JSON_VERSION: "0.0.7"
strategy:
matrix:
include:
2023-01-14 13:00:32 +00:00
- os: [self-hosted, macOS, ARM64]
2022-11-22 11:41:44 +00:00
ARTIFACT: "aarch64-apple-darwin-ghcup"
2023-02-23 15:07:46 +00:00
GHC_VER: 9.2.6
2022-11-22 11:41:44 +00:00
ARCH: ARM64
DISTRO: na
- os: macOS-11
2022-11-22 11:41:44 +00:00
ARTIFACT: "x86_64-apple-darwin-ghcup"
2023-02-23 15:07:46 +00:00
GHC_VER: 9.2.6
2022-11-22 11:41:44 +00:00
ARCH: 64
DISTRO: na
- os: windows-latest
ARTIFACT: "x86_64-mingw64-ghcup"
GHC_VER: 8.10.7
ARCH: 64
DISTRO: na
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: 'true'
- uses: actions/download-artifact@v3
with:
name: artifacts
path: ./out
2023-01-14 13:00:32 +00:00
- if: runner.os == 'macOS'
name: Run test
run: |
bash .github/scripts/brew.sh coreutils
export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$PATH"
bash .github/scripts/test.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: ${{ matrix.DISTRO }}
HOMEBREW_CHANGE_ARCH_TO_ARM: 1
- if: runner.os != 'macOS'
name: Run test
2022-10-20 12:37:50 +00:00
run: bash .github/scripts/test.sh
env:
ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }}
GHC_VER: ${{ matrix.GHC_VER }}
DISTRO: ${{ matrix.DISTRO }}
2022-11-22 11:41:44 +00:00
HOMEBREW_CHANGE_ARCH_TO_ARM: 1
2023-01-02 12:47:49 +00:00
- if: failure() && runner.os == 'Windows'
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: testfiles
path: |
./test/golden/windows/GHCupInfo*json
- if: failure() && runner.os != 'Windows'
name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: testfiles
path: |
./test/golden/unix/GHCupInfo*json
2022-10-20 12:37:50 +00:00
hls:
name: hls
2022-12-18 13:52:51 +00:00
needs: build-linux
2022-10-20 12:37:50 +00:00
runs-on: ubuntu-latest
env:
GHC_VERSION: "8.10.7"
HLS_TARGET_VERSION: "1.8.0.0"
2023-01-14 13:00:32 +00:00
CABAL_VERSION: "3.8.1.0"
2022-10-20 12:37:50 +00:00
JSON_VERSION: "0.0.7"
ARTIFACT: "x86_64-linux-ghcup"
DISTRO: Ubuntu
2022-11-22 11:41:44 +00:00
ARCH: 64
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
2022-12-15 16:21:53 +00:00
S3_HOST: ${{ secrets.S3_HOST }}
2022-10-20 12:37:50 +00:00
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: 'true'
2022-10-20 12:37:50 +00:00
- uses: actions/download-artifact@v3
with:
name: artifacts
path: ./out
2022-10-20 12:37:50 +00:00
- name: Run hls build
2023-01-14 13:00:32 +00:00
run: |
sudo apt-get install -y libnuma-dev zlib1g-dev libgmp-dev libgmp10 libssl-dev liblzma-dev libbz2-dev git wget lsb-release software-properties-common gnupg2 apt-transport-https gcc autoconf automake build-essential curl gzip
sh .github/scripts/hls.sh
2022-10-20 12:37:50 +00:00
release:
name: release
2022-12-18 13:52:51 +00:00
needs: ["test-linux", "test-arm", "test-macwin", "hls"]
2022-10-20 12:37:50 +00:00
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
2022-10-20 12:37:50 +00:00
name: artifacts
path: ./out
2022-10-20 12:37:50 +00:00
- name: Release
uses: softprops/action-gh-release@v1
with:
2022-10-20 12:37:50 +00:00
draft: true
files: |
./out/*