-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (96 loc) · 3.43 KB
/
ci.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
name: CI
on:
- push
- pull_request
- workflow_dispatch
permissions:
contents: read
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
jobs:
# test:
# name: ${{ matrix.cmd.name }} (Rust ${{ matrix.rust }})
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# rust:
# - stable
# cmd:
# - name: Test
# run: cargo test --locked
# - name: Clippy
# run: cargo clippy --locked --tests -- -D warnings
# timeout-minutes: 45
# steps:
# - uses: actions/checkout@v4
# - name: Setup rust
# run: |
# rustup toolchain install ${{ matrix.rust }} --profile minimal --no-self-update
# - name: ${{ matrix.cmd.name }}
# run: ${{ matrix.cmd.run }}
build:
name: Build for ${{ matrix.target.name }}
runs-on: ${{ matrix.target.runs-on }}
strategy:
fail-fast: false
matrix:
target:
- name: Linux (x86_64)
runs-on: ubuntu-latest
target: x86_64-unknown-linux-gnu
pre-build: |
sudo apt-get install -y libudev-dev
# - name: Windows (x86_64)
# runs-on: windows-latest
# target: x86_64-pc-windows-msvc
# ext: .exe
# - name: MacOS (x86_64)
# runs-on: macos-latest
# target: x86_64-apple-darwin
# - name: MacOS (arm64)
# runs-on: macos-latest
# target: aarch64-apple-darwin
timeout-minutes: 45
# env:
# RUSTFLAGS: -C target-feature=+crt-static
steps:
# - uses: actions/checkout@v4
# - name: Setup rust
# run: |
# rustup toolchain install stable --target ${{ matrix.target.target }} --profile minimal --no-self-update
# - name: Install build dependencies
# run: ${{ matrix.target.pre-build }}
# if: ${{ matrix.target.pre-build }}
# - name: Build for ${{ matrix.target.name }}
# run: cargo build --locked --release --target ${{ matrix.target.target }}
# - name: Run for ${{ matrix.target.name }}
# run: cargo run --locked --release --target ${{ matrix.target.target }}
# - name: Check file
# run: |
# file target/${{ matrix.target.target }}/release/rust-github-actions-test${{ matrix.target.ext }}
# stat target/${{ matrix.target.target }}/release/rust-github-actions-test${{ matrix.target.ext }}
# - uses: actions/upload-artifact@v4
# with:
# name: rust-github-actions-test.${{ matrix.target.target }}${{ matrix.target.ext }}
# path: target/${{ matrix.target.target }}/release/rust-github-actions-test${{ matrix.target.ext }}
# if-no-files-found: error
- uses: actions/github-script@v7
id: upload-release-asset
env:
ASSET_NAME: rust-github-actions-test.${{ matrix.target.target }}${{ matrix.target.ext }}
ASSET_PATH: target/${{ matrix.target.target }}/release/rust-github-actions-test${{ matrix.target.ext }}
with:
script: |
const { env } = process;
const file = fs.readFileSync(env.ASSET_PATH);
console.log(file.length);
const foo = await github.repos.getRelease({
tag: 'latest',
});
# await github.repos.uploadReleaseAsset({
# url: uploadUrl,
# name: env.ASSET_NAME,
# file,
# });