-
Notifications
You must be signed in to change notification settings - Fork 100
152 lines (135 loc) · 4.77 KB
/
go.yaml
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Go
env:
WORKING_DIRECTORY: bindings/c
MACOSX_DEPLOYMENT_TARGET: '10.13'
on:
workflow_dispatch:
permissions: write-all
jobs:
build:
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: 'x86_64-apple-darwin'
- host: macos-latest
target: 'aarch64-apple-darwin'
- host: ubuntu-latest
target: 'x86_64-unknown-linux-gnu'
- host: ubuntu-latest
target: 'aarch64-unknown-linux-gnu'
- host: windows-latest
target: 'x86_64-pc-windows-msvc'
name: ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}
defaults:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
target: ${{ matrix.settings.target }}
- uses: marcopolo/cargo@master
with:
use-cross: true
working-directory: bindings/c
args: --release --all-features --target=${{ matrix.settings.target }} --locked
command: build
- name: List folder
if: ${{ matrix.settings.target != 'x86_64-pc-windows-msvc' }}
run: ls -lh ../../target/${{ matrix.settings.target }}/release
- name: List folder Windows
if: ${{ matrix.settings.target == 'x86_64-pc-windows-msvc' }}
run: dir ..\..\target\${{ matrix.settings.target }}\release
- name: Upload artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.settings.target != 'x86_64-pc-windows-msvc' }}
with:
name: ${{ matrix.settings.target }}
path: target/${{ matrix.settings.target }}/release/libzen_ffi.a
if-no-files-found: error
- name: Upload artifact Windows
uses: actions/upload-artifact@v4
if: ${{ matrix.settings.target == 'x86_64-pc-windows-msvc' }}
with:
name: ${{ matrix.settings.target }}
path: target/${{ matrix.settings.target }}/release/zen_ffi.lib
if-no-files-found: error
copy-common:
name: Upload common file
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: common
path: bindings/c/zen_engine.h
if-no-files-found: error
release:
name: Release
runs-on: ubuntu-latest
needs:
- build
- copy-common
steps:
- name: Checkout zen-go
uses: actions/checkout@v3
with:
repository: gorules/zen-go
persist-credentials: false
token: ${{ secrets.PAT }}
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Move artifacts
run: |
mv artifacts/aarch64-apple-darwin/libzen_ffi.a deps/darwin_arm64/
mv artifacts/x86_64-apple-darwin/libzen_ffi.a deps/darwin_amd64/
mv artifacts/aarch64-unknown-linux-gnu/libzen_ffi.a deps/linux_arm64/
mv artifacts/x86_64-unknown-linux-gnu/libzen_ffi.a deps/linux_amd64/
mv artifacts/x86_64-pc-windows-msvc/zen_ffi.lib deps/windows_amd64/libzen_ffi.lib
mv artifacts/common/zen_engine.h zen_engine.h
rm -rf artifacts
- name: Set branch name
run: |
echo "BRANCH_NAME=chore/${{ github.run_id }}-${{ github.run_attempt }}" >> $GITHUB_ENV
- run: git config -l
- name: Commit
run: |
BRANCH_NAME="${{ env.BRANCH_NAME }}"
git checkout -b $BRANCH_NAME
# Setup the committers identity.
git config user.email "[email protected]"
git config user.name "Bot GoRules"
git config http.postBuffer 524288000
git config http.lowSpeedTime 600
# Commit the changes and push the feature branch to origin
git add .
git commit -m "chore: update deps"
- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: gorules/zen-go
github_token: ${{ secrets.PAT }}
branch: ${{ env.BRANCH_NAME }}
- name: Create PR
run: |
BRANCH_NAME="${{ env.BRANCH_NAME }}"
# Store the PAT in a file that can be accessed by the
# GitHub CLI.
echo "${{ secrets.PAT }}" > token.txt
# Authorize GitHub CLI for the current repository and
# create a pull-requests containing the updates.
echo "Authorizing for PR"
gh auth login --with-token < token.txt
gh pr create \
--body "" \
--title "chore: update deps" \
--head "$BRANCH_NAME" \
--base "master"