Skip to content

Commit 0245cba

Browse files
Merge pull request #50 from ScopeLift/beta-release
Version: 0.1.0
2 parents a1441eb + 8588508 commit 0245cba

47 files changed

Lines changed: 3828 additions & 200 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions-rs/toolchain@v1
1616
with:
1717
profile: minimal
18-
toolchain: stable
18+
toolchain: nightly
1919
override: true
2020
- run: cargo --version --verbose
2121
- run: cargo build --release --all-features
@@ -27,7 +27,7 @@ jobs:
2727
- uses: actions-rs/toolchain@v1
2828
with:
2929
profile: minimal
30-
toolchain: stable
30+
toolchain: nightly
3131
override: true
3232
- uses: foundry-rs/foundry-toolchain@v1
3333
- run: cargo test --locked --all-features

.github/workflows/release-old.yml

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
name: Release Old
2+
on:
3+
workflow_dispatch:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
8+
env:
9+
BIN_NAME: scopelint
10+
PROJECT_NAME: scopelint
11+
REPO_NAME: ScopeLift/scopelint
12+
13+
jobs:
14+
dist:
15+
name: Dist
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: true # Fail other jobs if one fails.
19+
matrix:
20+
build: [x86_64-linux, aarch64-linux, x86_64-macos, x86_64-windows, aarch64-macos]
21+
include:
22+
- build: x86_64-linux
23+
os: ubuntu-20.04
24+
rust: stable
25+
target: x86_64-unknown-linux-gnu
26+
cross: true
27+
- build: aarch64-linux
28+
os: ubuntu-20.04
29+
rust: stable
30+
target: aarch64-unknown-linux-gnu
31+
cross: true
32+
- build: x86_64-macos
33+
os: macos-latest
34+
rust: stable
35+
target: x86_64-apple-darwin
36+
cross: true
37+
- build: x86_64-windows
38+
os: windows-2019
39+
rust: stable
40+
target: x86_64-pc-windows-msvc
41+
cross: true
42+
- build: aarch64-macos
43+
os: macos-latest
44+
rust: stable
45+
target: aarch64-apple-darwin
46+
cross: true
47+
48+
steps:
49+
- name: Checkout sources
50+
uses: actions/checkout@v3
51+
52+
- name: Install ${{ matrix.rust }} toolchain
53+
uses: actions-rs/toolchain@v1
54+
with:
55+
profile: minimal
56+
toolchain: ${{ matrix.rust }}
57+
target: ${{ matrix.target }}
58+
override: true
59+
60+
# Currently skipping tests because it fails with:
61+
# thread 'test_check_proj1_all_findings' panicked at 'Failed to execute command: Os { code: 2, kind: NotFound, message: "No such file or directory" }', tests/cli.rs:18:10
62+
# when run here, even though tests work fine in the other actions file.
63+
64+
# # We skip tests for M1 (arm64), because the binary is for M1 but the github runner is Intel,
65+
# # so it can't run the binary/tests. However, the Intel macOS can build the binaries for M1
66+
# # which is what happens here.
67+
# - name: Run cargo test
68+
# uses: actions-rs/cargo@v1
69+
# if: ${{ matrix.build != 'aarch64-macos' }}
70+
# with:
71+
# use-cross: ${{ matrix.cross }}
72+
# command: test
73+
# args: --release --locked --target ${{ matrix.target }}
74+
75+
- name: Build release binary
76+
uses: actions-rs/cargo@v1
77+
with:
78+
use-cross: ${{ matrix.cross }}
79+
command: build
80+
args: --release --locked --target ${{ matrix.target }}
81+
82+
- name: Strip release binary (linux and macos)
83+
if: matrix.build == 'x86_64-linux' || matrix.build == 'x86_64-macos'
84+
run: strip "target/${{ matrix.target }}/release/$BIN_NAME"
85+
86+
- name: Strip release binary (arm)
87+
if: matrix.build == 'aarch64-linux'
88+
run: |
89+
docker run --rm -v \
90+
"$PWD/target:/target:Z" \
91+
rustembedded/cross:${{ matrix.target }} \
92+
aarch64-linux-gnu-strip \
93+
/target/${{ matrix.target }}/release/$BIN_NAME
94+
95+
- name: Build archive
96+
shell: bash
97+
run: |
98+
mkdir dist
99+
if [ "${{ matrix.os }}" = "windows-2019" ]; then
100+
cp "target/${{ matrix.target }}/release/$BIN_NAME.exe" "dist/"
101+
else
102+
cp "target/${{ matrix.target }}/release/$BIN_NAME" "dist/"
103+
fi
104+
105+
- uses: actions/upload-artifact@v2.2.4
106+
with:
107+
name: bins-${{ matrix.build }}
108+
path: dist
109+
110+
publish:
111+
name: Publish
112+
needs: [dist]
113+
runs-on: ubuntu-latest
114+
steps:
115+
- name: Checkout sources
116+
uses: actions/checkout@v2
117+
with:
118+
submodules: false
119+
120+
- uses: actions/download-artifact@v2
121+
# with:
122+
# path: dist
123+
# - run: ls -al ./dist
124+
- run: ls -al bins-*
125+
126+
- name: Calculate tag name
127+
run: |
128+
name=dev
129+
if [[ $GITHUB_REF == refs/tags/v* ]]; then
130+
name=${GITHUB_REF:10}
131+
fi
132+
echo ::set-output name=val::$name
133+
echo TAG=$name >> $GITHUB_ENV
134+
id: tagname
135+
136+
- name: Build archive
137+
shell: bash
138+
run: |
139+
set -ex
140+
141+
rm -rf tmp
142+
mkdir tmp
143+
mkdir dist
144+
145+
for dir in bins-* ; do
146+
platform=${dir#"bins-"}
147+
unset exe
148+
if [[ $platform =~ "windows" ]]; then
149+
exe=".exe"
150+
fi
151+
pkgname=$PROJECT_NAME-$platform
152+
mkdir tmp/$pkgname
153+
# cp LICENSE README.md tmp/$pkgname
154+
mv bins-$platform/$BIN_NAME$exe tmp/$pkgname
155+
chmod +x tmp/$pkgname/$BIN_NAME$exe
156+
157+
if [ "$exe" = "" ]; then
158+
tar cJf dist/$pkgname.tar.xz -C tmp $pkgname
159+
else
160+
(cd tmp && 7z a -r ../dist/$pkgname.zip $pkgname)
161+
fi
162+
done
163+
164+
- name: Upload binaries to release
165+
uses: svenstaro/upload-release-action@v2
166+
with:
167+
repo_token: ${{ secrets.GITHUB_TOKEN }}
168+
file: dist/*
169+
file_glob: true
170+
tag: ${{ steps.tagname.outputs.val }}
171+
overwrite: true
172+
173+
- name: Extract version
174+
id: extract-version
175+
run: |
176+
printf "::set-output name=%s::%s\n" tag-name "${GITHUB_REF#refs/tags/}"
177+
178+
# Uncomment this section if you want to release your package to crates.io
179+
# Before publishing, make sure you have filled out the following fields:
180+
# license or license-file, description, homepage, documentation, repository, readme.
181+
# Read more: https://doc.rust-lang.org/cargo/reference/publishing.html
182+
- name: Install ${{ matrix.rust }} toolchain
183+
uses: actions-rs/toolchain@v1
184+
with:
185+
profile: minimal
186+
toolchain: stable
187+
target: ${{ matrix.target }}
188+
- run: cargo publish --token ${CRATES_TOKEN} --allow-dirty
189+
env:
190+
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}

0 commit comments

Comments
 (0)