Skip to content

Commit 4ba38ac

Browse files
committed
Rewrite in Rust
1 parent 86be0fb commit 4ba38ac

16 files changed

+726
-196
lines changed

.github/actions/cargo/action.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
inputs:
2+
target:
3+
description: toolchain.target
4+
required: false
5+
6+
components:
7+
description: toolchain.components
8+
required: false
9+
10+
command:
11+
description: cargo.command
12+
required: true
13+
14+
args:
15+
description: cargo.args
16+
required: false
17+
18+
use-cross:
19+
description: cargo.use-cross
20+
required: false
21+
default: false
22+
23+
runs:
24+
using: composite
25+
26+
steps:
27+
- uses: actions-rs/toolchain@v1
28+
with:
29+
toolchain: nightly # for cargo-features = ["strip"]
30+
target: ${{ inputs.target }}
31+
override: true
32+
profile: minimal
33+
components: ${{ inputs.components }}
34+
35+
- uses: actions-rs/cargo@v1
36+
with:
37+
command: ${{ inputs.command }}
38+
args: ${{ inputs.args }}
39+
use-cross: ${{ inputs.use-cross }}

.github/workflows/check.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on: push
2+
3+
jobs:
4+
run:
5+
runs-on: ubuntu-latest
6+
7+
steps:
8+
- uses: actions/checkout@v2
9+
10+
- uses: ./.github/actions/cargo
11+
with:
12+
command: run
13+
args: -- --help
14+
15+
test:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- uses: ./.github/actions/cargo
22+
with:
23+
command: test
24+
25+
fmt:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- uses: actions/checkout@v2
30+
31+
- uses: ./.github/actions/cargo
32+
with:
33+
components: rustfmt
34+
command: fmt
35+
args: --check
36+
37+
clippy:
38+
runs-on: ubuntu-latest
39+
40+
steps:
41+
- uses: actions/checkout@v2
42+
43+
- uses: ./.github/actions/cargo
44+
with:
45+
components: clippy
46+
command: clippy

.github/workflows/release.yml

+21-18
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
11
on:
2-
push:
3-
tags:
4-
- '*'
5-
6-
permissions:
7-
contents: write
2+
release:
3+
types: [published]
84

95
jobs:
106
release:
117
runs-on: ubuntu-latest
128

9+
strategy:
10+
matrix:
11+
target:
12+
- aarch64-unknown-linux-gnu
13+
- armv7-unknown-linux-gnueabihf
14+
- i686-unknown-linux-gnu
15+
- x86_64-unknown-linux-gnu
16+
1317
steps:
14-
- run: |
15-
sudo apt update
16-
sudo apt install --assume-yes gcc-multilib
18+
- uses: actions/checkout@v2
1719

18-
- uses: actions/setup-go@v2
20+
- uses: ./.github/actions/cargo
1921
with:
20-
go-version: 1.17
22+
target: ${{ matrix.target }}
23+
command: build
24+
args: --release --target ${{ matrix.target }}
25+
use-cross: true
2126

22-
- uses: actions/checkout@v2
23-
with:
24-
fetch-depth: 0
27+
- run: echo "TARBALL=osm-${{ github.event.release.tag_name }}-${{ matrix.target }}.tar.xz" >> $GITHUB_ENV
28+
- run: tar caf $TARBALL --directory=target/${{ matrix.target }}/release osm
2529

26-
- uses: goreleaser/goreleaser-action@v2
30+
- uses: softprops/action-gh-release@v1
2731
with:
28-
args: release --rm-dist
29-
env:
30-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
files: ${{ env.TARBALL }}
33+
fail_on_unmatched_files: true

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/dist/
2-
/osm
1+
/target
2+
**/*.rs.bk

.goreleaser.yml

-12
This file was deleted.

0 commit comments

Comments
 (0)