Skip to content

Commit ee69c73

Browse files
ci: backport GHA workflows
1 parent c47fccc commit ee69c73

File tree

5 files changed

+356
-0
lines changed

5 files changed

+356
-0
lines changed

.github/workflows/integration.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: integration
2+
on: [push, pull_request]
3+
4+
jobs:
5+
integration-tests:
6+
runs-on: ubuntu-latest
7+
name: ${{ matrix.integration }}
8+
strategy:
9+
# https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions#usage-limits
10+
# There's a limit of 60 concurrent jobs across all repos in the rust-lang organization.
11+
# In order to prevent overusing too much of that 60 limit, we throttle the
12+
# number of rustfmt jobs that will run concurrently.
13+
max-parallel: 4
14+
fail-fast: false
15+
matrix:
16+
integration: [
17+
bitflags,
18+
error-chain,
19+
log,
20+
mdbook,
21+
packed_simd,
22+
rust-semverver,
23+
tempdir,
24+
futures-rs,
25+
rust-clippy,
26+
failure,
27+
]
28+
include:
29+
# Allowed Failures
30+
# Actions doesn't yet support explicitly marking matrix legs as allowed failures
31+
# https://github.bestrui.topmunity/t5/GitHub-Actions/continue-on-error-allow-failure-UI-indication/td-p/37033
32+
# https://github.bestrui.topmunity/t5/GitHub-Actions/Why-a-matrix-step-will-be-canceled-if-another-one-failed/td-p/30920
33+
# Instead, leverage `continue-on-error`
34+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error
35+
#
36+
# Failing due to breaking changes in rustfmt 2.0 where empty
37+
# match blocks have trailing commas removed
38+
# https://github.com/rust-lang/rustfmt/pull/4226
39+
- integration: chalk
40+
allow-failure: true
41+
- integration: crater
42+
allow-failure: true
43+
- integration: glob
44+
allow-failure: true
45+
- integration: stdsimd
46+
allow-failure: true
47+
# Using old rustfmt configuration option
48+
- integration: rand
49+
allow-failure: true
50+
# Keep this as an allowed failure as it's fragile to breaking changes of rustc.
51+
- integration: rust-clippy
52+
allow-failure: true
53+
# Using old rustfmt configuration option
54+
- integration: packed_simd
55+
allow-failure: true
56+
# calebcartwright (2019-12-24)
57+
# Keeping this as an allowed failure since it was flagged as such in the TravisCI config, even though
58+
# it appears to have been passing for quite some time.
59+
# Original comment was: temporal build failure due to breaking changes in the nightly compiler
60+
- integration: rust-semverver
61+
allow-failure: true
62+
# Can be moved back to include section after https://github.com/rust-lang-nursery/failure/pull/298 is merged
63+
- integration: failure
64+
allow-failure: true
65+
66+
steps:
67+
- name: checkout
68+
uses: actions/checkout@v2
69+
70+
# Run build
71+
- name: setup
72+
uses: actions-rs/toolchain@v1
73+
with:
74+
toolchain: nightly-x86_64-unknown-linux-gnu
75+
target: x86_64-unknown-linux-gnu
76+
override: true
77+
profile: minimal
78+
default: true
79+
- name: run integration tests
80+
env:
81+
INTEGRATION: ${{ matrix.integration }}
82+
TARGET: x86_64-unknown-linux-gnu
83+
run: ./ci/integration.sh
84+
continue-on-error: ${{ matrix.allow-failure == true }}

.github/workflows/linux.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: linux
2+
on: [push, pull_request]
3+
4+
jobs:
5+
test:
6+
runs-on: ubuntu-latest
7+
name: (${{ matrix.target }}, ${{ matrix.channel }}, ${{ matrix.cfg-release-channel }})
8+
strategy:
9+
# https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions#usage-limits
10+
# There's a limit of 60 concurrent jobs across all repos in the rust-lang organization.
11+
# In order to prevent overusing too much of that 60 limit, we throttle the
12+
# number of rustfmt jobs that will run concurrently.
13+
max-parallel: 1
14+
fail-fast: false
15+
matrix:
16+
target: [
17+
x86_64-unknown-linux-gnu,
18+
]
19+
channel: [ nightly ]
20+
cfg-release-channel: [
21+
beta,
22+
nightly,
23+
]
24+
25+
env:
26+
CFG_RELEASE_CHANNEL: ${{ matrix.cfg-release-channel }}
27+
CFG_RELEASE: ${{ matrix.cfg-release-channel }}
28+
29+
steps:
30+
- name: checkout
31+
uses: actions/checkout@v2
32+
33+
# Run build
34+
- name: setup
35+
uses: actions-rs/toolchain@v1
36+
with:
37+
toolchain: ${{ matrix.channel }}-${{ matrix.target }}
38+
target: ${{ matrix.target }}
39+
override: true
40+
profile: minimal
41+
default: true
42+
43+
- name: cargo-make
44+
run: cargo install --force cargo-make
45+
46+
- name: build
47+
run: |
48+
rustc -Vv
49+
cargo -V
50+
cargo make build
51+
52+
- name: test
53+
run: cargo make test

.github/workflows/mac.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: mac
2+
on: [push, pull_request]
3+
4+
jobs:
5+
test:
6+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources
7+
# macOS Catalina 10.15
8+
runs-on: macos-latest
9+
name: (${{ matrix.target }}, ${{ matrix.channel }})
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
target: [
14+
x86_64-apple-darwin,
15+
]
16+
channel: [ nightly ]
17+
18+
env:
19+
CFG_RELEASE_CHANNEL: nightly
20+
CFG_RELEASE: nightly
21+
22+
steps:
23+
- name: checkout
24+
uses: actions/checkout@v2
25+
26+
# Run build
27+
- name: setup
28+
uses: actions-rs/toolchain@v1
29+
with:
30+
toolchain: ${{ matrix.channel }}-${{ matrix.target }}
31+
target: ${{ matrix.target }}
32+
override: true
33+
profile: minimal
34+
default: true
35+
36+
- name: cargo-make
37+
run: cargo install --force cargo-make
38+
39+
- name: build
40+
run: |
41+
rustc -Vv
42+
cargo -V
43+
cargo make build
44+
45+
- name: test
46+
run: cargo make test

.github/workflows/upload-assets.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: upload
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build-release:
9+
name: build-release
10+
strategy:
11+
matrix:
12+
build: [linux, macos, windows-gnu, windows-msvc]
13+
include:
14+
- build: linux
15+
os: ubuntu-latest
16+
rust: nightly
17+
- build: macos
18+
os: macos-latest
19+
rust: nightly
20+
- build: windows-gnu
21+
os: windows-latest
22+
rust: nightly-x86_64-gnu
23+
- build: windows-msvc
24+
os: windows-latest
25+
rust: nightly-x86_64-msvc
26+
runs-on: ${{ matrix.os }}
27+
steps:
28+
- uses: actions/checkout@v2
29+
30+
- name: Install Rust
31+
uses: actions-rs/toolchain@v1
32+
with:
33+
profile: minimal
34+
toolchain: ${{ matrix.rust }}
35+
override: true
36+
37+
- name: Install cargo-make
38+
uses: actions-rs/cargo@v1
39+
with:
40+
command: build
41+
args: --release
42+
43+
- name: Build release binaries
44+
uses: actions-rs/cargo@v1
45+
with:
46+
command: make
47+
args: release
48+
49+
- name: Build archive
50+
shell: bash
51+
run: |
52+
staging="rustfmt_${{ matrix.build }}_${{ github.event.release.tag_name }}"
53+
mkdir -p "$staging"
54+
55+
cp {README.md,Configurations.md,CHANGELOG.md,LICENSE-MIT,LICENSE-APACHE} "$staging/"
56+
57+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
58+
cp "target/release/{rustfmt.exe,cargo-fmt.exe,rustfmt-format-diff.exe,git-rustfmt.exe}" "$staging/"
59+
7z a "$staging.zip" "$staging"
60+
echo "::set-env name=ASSET::$staging.zip"
61+
else
62+
cp "target/release/{rustfmt,cargo-fmt,rustfmt-format-diff,git-rustfmt} "$staging/"
63+
tar czf "$staging.tar.gz" "$staging"
64+
echo "::set-env name=ASSET::$staging.tar.gz"
65+
fi
66+
67+
- name: Upload Release Asset
68+
uses: actions/upload-release-asset@v1
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
with:
72+
upload_url: ${{ github.event.release.upload_url }}
73+
asset_path: ${{ env.ASSET }}
74+
asset_name: ${{ env.ASSET }}
75+
asset_content_type: application/octet-stream

.github/workflows/windows.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: windows
2+
on: [push, pull_request]
3+
4+
jobs:
5+
test:
6+
runs-on: windows-latest
7+
name: (${{ matrix.target }}, ${{ matrix.channel }})
8+
strategy:
9+
# https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions#usage-limits
10+
# There's a limit of 60 concurrent jobs across all repos in the rust-lang organization.
11+
# In order to prevent overusing too much of that 60 limit, we throttle the
12+
# number of rustfmt jobs that will run concurrently.
13+
max-parallel: 1
14+
fail-fast: false
15+
matrix:
16+
target: [
17+
i686-pc-windows-gnu,
18+
i686-pc-windows-msvc,
19+
x86_64-pc-windows-gnu,
20+
x86_64-pc-windows-msvc,
21+
]
22+
channel: [ nightly ]
23+
include:
24+
- channel: nightly
25+
target: i686-pc-windows-gnu
26+
mingw-7z-path: mingw
27+
28+
env:
29+
CFG_RELEASE_CHANNEL: nightly
30+
CFG_RELEASE: nightly
31+
32+
steps:
33+
# The Windows runners have autocrlf enabled by default
34+
# which causes failures for some of rustfmt's line-ending sensitive tests
35+
- name: disable git eol translation
36+
run: git config --global core.autocrlf false
37+
- name: checkout
38+
uses: actions/checkout@v2
39+
40+
# The Windows runners do not (yet) have a proper msys/mingw environment
41+
# pre-configured like AppVeyor does, though they will likely be added in the future.
42+
# https://github.com/actions/virtual-environments/issues/30
43+
#
44+
# In the interim, this ensures mingw32 is installed and available on the PATH
45+
# for the i686-pc-windows-gnu target. This approach is used because it's common in
46+
# other rust projects and there are issues/limitations with the msys2 chocolatey nuget
47+
# package and numworks/setup-msys2 action.
48+
# https://github.com/rust-lang/rust/blob/master/src/ci/scripts/install-mingw.sh#L59
49+
# https://github.com/rust-lang/rustup/blob/master/appveyor.yml
50+
#
51+
# Use GitHub Actions cache support to avoid downloading the .7z file every time
52+
# to be cognizant of the AWS egress cost impacts
53+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
54+
- name: cache mingw.7z
55+
id: cache-mingw
56+
with:
57+
path: ${{ matrix.mingw-7z-path }}
58+
key: ${{ matrix.channel }}-${{ matrix.target }}-mingw
59+
uses: actions/cache@v1
60+
if: matrix.target == 'i686-pc-windows-gnu' && matrix.channel == 'nightly'
61+
- name: download mingw.7z
62+
run: |
63+
# Disable the download progress bar which can cause perf issues
64+
$ProgressPreference = "SilentlyContinue"
65+
md -Force ${{ matrix.mingw-7z-path }}
66+
Invoke-WebRequest https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z -OutFile ${{ matrix.mingw-7z-path }}/mingw.7z
67+
if: matrix.target == 'i686-pc-windows-gnu' && matrix.channel == 'nightly' && steps.cache-mingw.outputs.cache-hit != 'true'
68+
shell: powershell
69+
- name: install mingw32
70+
run: |
71+
7z x -y ${{ matrix.mingw-7z-path }}/mingw.7z -oC:\msys64 | Out-Null
72+
echo ::add-path::C:\msys64\mingw32\bin
73+
if: matrix.target == 'i686-pc-windows-gnu' && matrix.channel == 'nightly'
74+
shell: powershell
75+
76+
# Run build
77+
- name: setup
78+
uses: actions-rs/toolchain@v1
79+
with:
80+
toolchain: ${{ matrix.channel }}-${{ matrix.target }}
81+
target: ${{ matrix.target }}
82+
override: true
83+
profile: minimal
84+
default: true
85+
86+
- name: cargo-make
87+
run: cargo install --force cargo-make
88+
89+
- name: build
90+
run: |
91+
rustc -Vv
92+
cargo -V
93+
cargo make build
94+
shell: cmd
95+
96+
- name: test
97+
run: cargo make test
98+
shell: cmd

0 commit comments

Comments
 (0)