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

461 lines
12 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 * * *'
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:
CABAL_VER: 3.6.2.0
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:
CABAL_VER: 3.6.2.0
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:
- os: [self-hosted, Linux, aarch64]
ARTIFACT: "armv7-linux-ghcup"
GHC_VER: 8.10.7
ARCH: ARM
- os: [self-hosted, Linux, aarch64]
ARTIFACT: "aarch64-linux-ghcup"
GHC_VER: 8.10.7
ARCH: ARM64
steps:
- uses: docker://arm64v8/ubuntu:focal
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'
uses: docker://hasufell/arm32v7-ubuntu-haskell:focal
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'
uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
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:
CABAL_VER: 3.6.2.0
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:
- os: [self-hosted, macOS, aarch64]
ARTIFACT: "aarch64-apple-darwin-ghcup"
GHC_VER: 9.2.5
ARCH: ARM64
- os: macOS-10.15
ARTIFACT: "x86_64-apple-darwin-ghcup"
GHC_VER: 9.2.5
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'
- name: Run build (windows/mac)
2022-10-20 12:37:50 +00:00
run: bash .github/scripts/build.sh
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-11-22 11:41:44 +00:00
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:
2022-10-20 12:37:50 +00:00
CABAL_VER: 3.6.2.0
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)
2022-10-20 12:37:50 +00:00
run: 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
APT_GET: "sudo apt-get"
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:
CABAL_VER: 3.6.2.0
JSON_VERSION: "0.0.7"
strategy:
matrix:
include:
- os: [self-hosted, Linux, aarch64]
ARTIFACT: "armv7-linux-ghcup"
GHC_VER: 8.10.7
ARCH: ARM
DISTRO: Ubuntu
- os: [self-hosted, Linux, aarch64]
ARTIFACT: "aarch64-linux-ghcup"
GHC_VER: 8.10.7
ARCH: ARM64
DISTRO: Ubuntu
steps:
- uses: docker://arm64v8/ubuntu:focal
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'
uses: docker://hasufell/arm32v7-ubuntu-haskell:focal
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'
uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
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:
CABAL_VER: 3.6.2.0
MACOSX_DEPLOYMENT_TARGET: 10.13
JSON_VERSION: "0.0.7"
strategy:
matrix:
include:
- os: [self-hosted, macOS, aarch64]
ARTIFACT: "aarch64-apple-darwin-ghcup"
GHC_VER: 9.2.5
ARCH: ARM64
DISTRO: na
- os: macOS-10.15
ARTIFACT: "x86_64-apple-darwin-ghcup"
GHC_VER: 9.2.5
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
- name: Run test (windows/mac)
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"
CABAL_VERSION: "3.6.2.0"
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
run: sh .github/scripts/hls.sh
2022-11-22 11:41:44 +00:00
env:
APT_GET: "sudo apt-get"
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/*