-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (143 loc) · 6.9 KB
/
artifacts.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Artifacts
on:
push:
branches:
- main
release:
types:
- published
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
binary_linux:
runs-on: ubuntu-20.04
steps:
- name: Allow the workflow to access the files of the repository
uses: actions/checkout@v3
with:
submodules: true
- name: Update Rustup and select the target architectures
run: rustup update && rustup target add aarch64-unknown-linux-gnu
- name: Update the system and install the aarch64 compiler
run: |
sudo apt update && sudo apt install -y g++-aarch64-linux-gnu
echo -e "\n\n[target.aarch64-unknown-linux-gnu]\nlinker = \"aarch64-linux-gnu-gcc\"" >> .cargo/config.toml
- name: Use an intelligent Rust cache for building the project
uses: Swatinem/rust-cache@v2
- name: Build the release version of `shex-rs` for the x86 architecture
run: cargo build --release
- name: Build the release version of `shex-rs` for the aarch64 architecture
run: cargo build --release --target aarch64-unknown-linux-gnu
env:
BINDGEN_EXTRA_CLANG_ARGS: --sysroot /usr/aarch64-linux-gnu
- name: Upload the generated Artifact for it to be stored in its corresponding release (x86)
uses: actions/upload-artifact@v3
with:
name: ${{ vars.BINARY_NAME }}_x86_64_linux_gnu
path: target/release/${{ vars.BINARY_NAME }}
- name: Upload the generated Artifact for it to be stored in its corresponding release (aarch64)
uses: actions/upload-artifact@v3
with:
name: ${{ vars.BINARY_NAME }}_aarch64-linux_gnu
path: target/aarch64-unknown-linux-gnu/release/${{ vars.BINARY_NAME }}
- name: Rename the binary according to the version and architecture
run: mv target/release/${{ vars.BINARY_NAME }} ${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_x86_64_linux_gnu
if: github.event_name == 'release'
- name: Rename the binary according to the version and architecture
run: mv target/aarch64-unknown-linux-gnu/release/${{ vars.BINARY_NAME }} ${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_aarch64_linux_gnu
if: github.event_name == 'release'
- name: Upload the generated binaries to their corresponding release
uses: softprops/action-gh-release@v1
with:
files: |
${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_x86_64_linux_gnu
${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_aarch64_linux_gnu
if: github.event_name == 'release'
binary_mac:
runs-on: macos-latest
env:
DEVELOPER_DIR: '/Applications/Xcode.app/Contents/Developer'
SDKROOT: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk'
MACOSX_DEPLOYMENT_TARGET: '10.14'
steps:
- name: Allow the workflow to access the files of the repository
uses: actions/checkout@v3
with:
submodules: true
- name: Update Rustup and select the target architectures
run: rustup update && rustup target add aarch64-apple-darwin
- name: Use an intelligent Rust cache for building the project
uses: Swatinem/rust-cache@v2
- name: Build the release version of `shex-rs` for the x86 architecture
run: cargo build --release
- name: Build the release version of `shex-rs` for the aarch64 architecture
run: cargo build --release --target aarch64-apple-darwin
- name: Upload the generated Artifact for it to be stored in its corresponding release (x86)
uses: actions/upload-artifact@v3
with:
name: ${{ vars.BINARY_NAME }}_x86_64_apple
path: target/release/${{ vars.BINARY_NAME }}
- name: Upload the generated Artifact for it to be stored in its corresponding release (aarch64)
uses: actions/upload-artifact@v3
with:
name: ${{ vars.BINARY_NAME }}_aarch64_apple
path: target/aarch64-apple-darwin/release/${{ vars.BINARY_NAME }}
- name: Rename the binary according to the version and architecture
run: mv target/release/${{ vars.BINARY_NAME }} ${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_x86_64_apple
if: github.event_name == 'release'
- name: Rename the binary according to the version and architecture
run: mv target/aarch64-apple-darwin/release/${{ vars.BINARY_NAME }} ${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_aarch64_apple
if: github.event_name == 'release'
- name: Upload the generated binaries to their corresponding release
uses: softprops/action-gh-release@v1
with:
files: |
${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_x86_64_apple
${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_aarch64_apple
if: github.event_name == 'release'
binary_windows:
runs-on: windows-latest
steps:
- name: Allow the workflow to access the files of the repository
uses: actions/checkout@v3
with:
submodules: true
- name: Update Rustup
run: rustup update
- name: Use an intelligent Rust cache for building the project
uses: Swatinem/rust-cache@v2
- name: Remove the MySys64 libraries and utilities
run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse
- name: Build the release version of `shex-rs` for the x86 architecture
run: cargo build --release
- name: Upload the generated Artifact for it to be stored in its corresponding release (x86)
uses: actions/upload-artifact@v3
with:
name: ${{ vars.BINARY_NAME }}_x86_64_windows_msvc
path: target/release/${{ vars.BINARY_NAME }}.exe
- name: Rename the binary according to the version and architecture
run: mv target/release/${{ vars.BINARY_NAME }}.exe ${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_x86_64_windows_msvc.exe
if: github.event_name == 'release'
- name: Upload the generated binary to its corresponding release
uses: softprops/action-gh-release@v1
with:
files: ${{ vars.BINARY_NAME }}_${{ github.event.release.tag_name }}_x86_64_windows_msvc.exe
if: github.event_name == 'release'
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.DOCKER_CONTAINER }}:latest