-
-
Notifications
You must be signed in to change notification settings - Fork 2
158 lines (155 loc) · 4.53 KB
/
rust.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
153
154
155
156
157
158
name: Rust
on:
pull_request:
push:
branches:
- main
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run verify-version.sh
if: startsWith(github.ref, 'refs/tags/')
run: chmod +x scripts/verify-version.sh && scripts/verify-version.sh
- name: Setup
run: |
sudo apt-get update
sudo apt-get install -y mariadb-client
- name: Databases
run: docker compose up -d
- name: Run tests
run: cargo test --verbose
build-binary:
needs: [test]
strategy:
matrix:
include:
- os: linux
image: ubuntu-latest
arch: 386
setup: |
sudo apt-get install -qq gcc-i686-linux-gnu
sudo apt-get install -qq libssl-dev
sudo apt-get install -qq gcc-multilib
env: {}
- os: linux
image: ubuntu-latest
arch: amd64
env: {}
- os: linux
image: ubuntu-latest
arch: arm
setup: |
sudo apt-get install -qq gcc-arm-linux-gnueabi
sudo apt-get install -qq libssl-dev
env:
TARGET: aarch64-unknown-linux-gnu
- os: linux
image: ubuntu-latest
arch: arm64
setup: |
sudo apt-get install -qq gcc-aarch64-linux-gnu
sudo apt-get install -qq libssl-dev
env:
TARGET: aarch64-unknown-linux-gnu
- os: macos
image: macos-latest
arch: amd64
env:
TARGET: aarch64-apple-darwin
- os: macos
image: macos-latest
arch: arm64
env:
TARGET: x86_64h-apple-darwin
- os: windows
image: windows-latest
arch: amd64
env:
CC: cl.exe
CFLAGS: -x
TARGET: x86_64-pc-windows-msvc
name: Build (${{ matrix.os }}/${{ matrix.arch }})
runs-on: ${{ matrix.image }}
env: ${{ matrix.env }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup environment
run: ${{ matrix.setup }}
- name: Install compiler for Windows
if: ${{matrix.os == 'windows'}}
id: install_cc
uses: rlalik/setup-cpp-compiler@master
with:
compiler: latest
- if: ${{matrix.os == 'windows'}}
name: Setup MSVC
uses: ilammy/[email protected]
- name: Build
run: cargo build --release --verbose
- name: Rename package
if: ${{matrix.os != 'windows'}}
shell: bash
run: |
cp target/release/geni geni-${{matrix.os}}-${{matrix.arch}}
- name: Rename package
if: ${{matrix.os == 'windows'}}
shell: bash
run: |
cp target/release/geni.exe geni-${{matrix.os}}-${{matrix.arch}}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.arch }}
path: geni-${{matrix.os}}-${{matrix.arch}}
- name: Publish to release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: 'geni*'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-cargo:
needs: [build-binary]
runs-on: "ubuntu-latest"
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: "main"
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Crates.io Login
run: cargo login ${{secrets.CRATES_TOKEN}}
- name: Install cargo release
run: cargo install cargo-release
- name: Change tag name
run: |
TAG=${{ github.event.release.tag_name }}
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Publish version
run: cargo publish
test-github-actions:
runs-on: ubuntu-latest
needs: [build-binary]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- name: Databases
run: docker compose up -d
- name: create test migrations
run: bash scripts/test-migrations.sh
- name: Test migrations
uses: emilpriver/geni@main
with:
database_url: "mariadb://root:password@localhost:3307/development"