-
Notifications
You must be signed in to change notification settings - Fork 4
134 lines (129 loc) · 5.09 KB
/
build-test-cross.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: cross compile dotnet app
on:
# release:
# types:
# - published
workflow_dispatch:
push:
branches:
- "main"
pull_request:
branches:
- "**"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.x
- name: build dotnet executables
run: make build
- name: size of executables
run: make size
- name: file info
run: make file
- name: prep for distribution
run: make dist
- uses: actions/upload-artifact@v4
with:
path: dist/*
test:
defaults:
run:
shell: sh
needs: [build]
name: Test ${{ matrix.docker == true && matrix.alpine == true && 'linux-musl' || matrix.docker == true && matrix.alpine == false && 'linux' || matrix.os }}-${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
os: [
"macos-14",
"windows-latest",
"ubuntu-latest"
]
arch: ["amd64"]
alpine: [false]
include:
- os: "macos-14"
arch: "arm64"
- os: "ubuntu-latest"
arch: "arm64"
alpine: true
docker: true
- os: "ubuntu-latest"
arch: "amd64"
alpine: true
docker: true
- os: "ubuntu-latest"
arch: "arm64"
debian: true
docker: true
runs-on: ${{ matrix.os }}
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v4
- name: list and unpack artifacts
run: |
ls artifact/*
cd artifact && gunzip *.gz && cd ..
ls artifact/*
- name: Set up QEMU
if: matrix.arch == 'arm64' && matrix.docker == true
uses: docker/setup-qemu-action@v3
- name: test alpine ${{ matrix.arch }} package
if: ${{ matrix.alpine == true && matrix.arch == 'arm64' }}
run: docker run --platform=linux/${{ matrix.arch }} --rm -v $(pwd):/app alpine /bin/sh -c 'apk add --no-cache gcc icu && chmod +x ./app/artifact/explore-cli-linux-musl-arm64 && ./app/artifact/explore-cli-linux-musl-arm64 --version'
- name: test alpine ${{ matrix.arch }} package
if: ${{ matrix.alpine == true && matrix.arch == 'amd64' }}
run: docker run --platform=linux/${{ matrix.arch }} --rm -v $(pwd):/app alpine /bin/sh -c 'apk add --no-cache gcc icu && chmod +x ./app/artifact/explore-cli-linux-musl-x64 && ./app/artifact/explore-cli-linux-musl-x64 --version'
- name: test debian ${{ matrix.arch }} package
if: ${{ matrix.debian == true && matrix.arch == 'arm64' }}
run: docker run --platform=linux/${{ matrix.arch }} --rm -v $(pwd):/app debian /bin/bash -c 'apt update && apt install -y libicu-dev && chmod +x ./app/artifact/explore-cli-linux-arm64 && ./app/artifact/explore-cli-linux-arm64 --version'
- name: test debian ${{ matrix.arch }} package
if: ${{ matrix.debian == true && matrix.arch == 'amd64' }}
run: docker run --platform=linux/${{ matrix.arch }} --rm -v $(pwd):/app debian /bin/bash -c 'apt update && apt install -y libicu-dev && chmod +x ./app/artifact/explore-cli-linux-x64 && ./app/artifact/explore-cli-linux-x64 --version'
- name: test 'macos-14-arm'
if: ${{ matrix.os == 'macos-14' && matrix.arch == 'arm64' }}
run: chmod +x artifact/explore-cli-osx-arm64 && artifact/explore-cli-osx-arm64 --version
- name: test 'macos-14-amd'
if: ${{ matrix.os == 'macos-14' && matrix.arch == 'amd64' }}
run: chmod +x artifact/explore-cli-osx-x64 && artifact/explore-cli-osx-x64 --version
- name: test 'windows-latest'
if: ${{ matrix.os == 'windows-latest' }}
run: artifact/explore-cli-win-x64.exe --version
- name: test 'ubuntu-latest'
if: ${{ matrix.os == 'ubuntu-latest' && matrix.docker != true }}
run: chmod +x artifact/explore-cli-linux-x64 && artifact/explore-cli-linux-x64 --version
publish:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
# if: |
# startsWith(github.ref, 'refs/tags/v')
needs: [build,test]
steps:
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine Version
id: gitVersion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
configFilePath: ./.github/gitversion.yml
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Upload Release Assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifact/*
file_glob: true
tag: ${{ steps.gitversion.outputs.MajorMinorPatch }}