forked from tpoechtrager/osxcross
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (67 loc) · 2.82 KB
/
main.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
name: macOS cross compiler
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches:
- $default-branch
- dev/*
pull_request:
branches:
- $default-branch
env:
MACOS_SDK_VERSION: 12.3
CI_REGISTRY: docker.io
CI_REGISTRY_USER: ${{ secrets.CI_REGISTRY_USER }}
CI_REGISTRY_PASSWORD: ${{ secrets.CI_REGISTRY_PASSWORD }}
jobs:
build-cross-compiler:
name: Build Cross Compiler
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Prepare for build
run: |
GITHUB_REPOSITORY=${{ github.repository }}
echo "GITHUB_REPOSITORY=$GITHUB_REPOSITORY" >>"$GITHUB_ENV"
# shellcheck disable=SC2129
echo "OUT_TARBALL_PATH=$PWD/${GITHUB_REPOSITORY##*/}.tar.xz" >>"$GITHUB_ENV"
shell: bash
- name: Building ...
run: |
cat <<'EOF' >"$PWD/action-ci-build.sh"
MACOS_CROSS_COMPILER="/workspace/${GITHUB_REPOSITORY##*/}"
cd "$MACOS_CROSS_COMPILER" || exit
# picked this version as they work well with godot-rust, feel free to change
# git checkout 7c090bd8cd4ad28cf332f1d02267630d8f333c19
(cd tarballs && curl -L -O https://gitlab.com/website107/fserv/-/raw/main/txz/MacOSX$MACOS_SDK_VERSION.sdk.tar.xz)
UNATTENDED=yes OSX_VERSION_MIN=10.10 CLANG_VERSION=17.0.0 ./build.sh
cd "$MACOS_CROSS_COMPILER" || exit
mv target "${GITHUB_REPOSITORY##*/}"
tar -cJf "${GITHUB_REPOSITORY##*/}.tar.xz" "${GITHUB_REPOSITORY##*/}"
EOF
exec docker run -v "$PWD:/workspace/${GITHUB_REPOSITORY##*/}" \
-e GITHUB_REPOSITORY="$GITHUB_REPOSITORY" \
-e MACOS_SDK_VERSION=$MACOS_SDK_VERSION \
--entrypoint=bash "lcjuves/macos-cross-compiler-builder" -ex "/workspace/${GITHUB_REPOSITORY##*/}/action-ci-build.sh"
shell: bash
- name: Publish compiler artifact
uses: softprops/action-gh-release@v1
with:
name: macOS Cross Compiler
tag_name: mac-os-cross-compiler
prerelease: false
files: |
${{ env.OUT_TARBALL_PATH }}
- name: Publish rustaceans docker image
if: ${{ github.repository == 'LcJuves/macos-cross-compiler' }}
run: |
git clone --depth 1 -b main https://gitlab.com/LcJuves/podock.git
cd podock/rustaceans || exit
mv $OUT_TARBALL_PATH .
docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
docker build -t "$CI_REGISTRY_USER/rustaceans:jit" -f jit.Dockerfile .
docker push "$CI_REGISTRY_USER/rustaceans:jit"
docker build -t "$CI_REGISTRY_USER/rustaceans" .
docker push "$CI_REGISTRY_USER/rustaceans"
shell: bash