-
-
Notifications
You must be signed in to change notification settings - Fork 1
132 lines (128 loc) · 4.24 KB
/
ci.yml
File metadata and controls
132 lines (128 loc) · 4.24 KB
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
name: Continuous integration
on: [push, pull_request]
env:
CRATE_NAME: tailwindcss-to-rust
GITHUB_TOKEN: ${{ github.token }}
RUST_BACKTRACE: 1
jobs:
test:
name: Test - ${{ matrix.platform.os_name }} with rust ${{ matrix.toolchain }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- os_name: Linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os_name: macOS
os: macOS-latest
target: x86_64-apple-darwin
- os_name: Windows
os: windows-latest
target: x86_64-pc-windows-msvc
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v2
- name: Cache cargo & target directories
uses: Swatinem/rust-cache@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: ${{ matrix.toolchain }}
override: true
- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
args: --target=${{ matrix.platform.target }}
- name: Run install-dev-tools.sh
shell: bash
run: |
set -e
mkdir $HOME/bin
./dev/bin/install-dev-tools.sh
- name: Add $HOME/bin to $PATH
shell: bash
run: |
echo "$HOME/bin" >> $GITHUB_PATH
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --target=${{ matrix.platform.target }} --workspace
# Copied from https://github.com/urbica/martin/blob/master/.github/workflows/ci.yml
release:
name: Release - ${{ matrix.platform.os_name }}
if: startsWith( github.ref, 'refs/tags/tailwindcss-to-rust-v' )
needs: [test]
strategy:
matrix:
platform:
- os_name: Linux-x86_64
os: ubuntu-20.04
target: x86_64-unknown-linux-musl
bin: tailwindcss-to-rust
name: tailwindcss-to-rust-Linux-x86_64-musl.tar.gz
cross: true
- os_name: Windows
os: windows-latest
target: x86_64-pc-windows-msvc
bin: tailwindcss-to-rust.exe
name: tailwindcss-to-rust-Windows-x86_64.zip
cross: false
- os_name: macOS-x86_64
os: macOS-latest
target: x86_64-apple-darwin
bin: tailwindcss-to-rust
name: tailwindcss-to-rust-Darwin-x86_64.tar.gz
cross: false
- os_name: macOS-aarch64
os: macOS-latest
target: aarch64-apple-darwin
bin: tailwindcss-to-rust
name: tailwindcss-to-rust-Darwin-aarch64.tar.gz
cross: false
runs-on: ${{ matrix.platform.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.platform.target }}
- name: Build binary
uses: actions-rs/cargo@v1
with:
command: build
args: --package tailwindcss-to-rust --release --target ${{ matrix.platform.target }}
- name: Package as archive
shell: bash
run: |
if [[ "${{ matrix.platform.cross }}" == "false" ]]; then
# strip doesn't work with non-native binaries on Linux, AFAICT.
strip target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}
fi
cd target/${{ matrix.platform.target }}/release
if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then
7z a ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
else
tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
fi
cd -
- name: Generate SHA-256
if: matrix.platform.os == 'macOS-latest'
run: shasum -a 256 ${{ matrix.platform.name }}
- name: Publish GitHub release
uses: softprops/action-gh-release@v1
with:
draft: true
files: "tailwindcss-to-rust*"
body_path: generator/Changes.md