Skip to content

Commit 82caa55

Browse files
authored
more GitHub Actions enablement (#3982)
2 parents 5e667d3 + 02428c7 commit 82caa55

File tree

5 files changed

+207
-15
lines changed

5 files changed

+207
-15
lines changed

.cargo/config

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[alias]
2+
t = "test-all"
3+
ta = "test-all"
4+
test-all = "test --manifest-path rustfmt-core/Cargo.toml"
5+
6+
test-bin = "test --manifest-path rustfmt-core/rustfmt-bin/Cargo.toml"
7+
tb = "test-bin"
8+
9+
test-config = "test --manifest-path rustfmt-core/rustfmt-config/Cargo.toml"
10+
tc = "test-config"
11+
12+
test-emitter = "test --manifest-path rustfmt-core/rustfmt-emitter/Cargo.toml"
13+
te = "test-emitter"
14+
15+
test-lib = "test --manifest-path rustfmt-core/rustfmt-lib/Cargo.toml"
16+
tl = "test-lib"
17+
18+
i = "install --path . --force --locked"

.github/workflows/integration.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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+
fail-fast: false
10+
matrix:
11+
integration: [
12+
bitflags,
13+
chalk,
14+
crater,
15+
error-chain,
16+
glob,
17+
log,
18+
mdbook,
19+
packed_simd,
20+
rust-semverver,
21+
stdsimd,
22+
tempdir,
23+
futures-rs,
24+
rust-clippy,
25+
failure,
26+
]
27+
include:
28+
# Allowed Failures
29+
# Actions doesn't yet support explicitly marking matrix legs as allowed failures
30+
# https://github.community/t5/GitHub-Actions/continue-on-error-allow-failure-UI-indication/td-p/37033
31+
# https://github.community/t5/GitHub-Actions/Why-a-matrix-step-will-be-canceled-if-another-one-failed/td-p/30920
32+
# Instead, leverage `continue-on-error`
33+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error
34+
#
35+
# Using old rustfmt configuration option
36+
- integration: rand
37+
allow-failure: true
38+
# Keep this as an allowed failure as it's fragile to breaking changes of rustc.
39+
- integration: rust-clippy
40+
allow-failure: true
41+
# Using old rustfmt configuration option
42+
- integration: packed_simd
43+
allow-failure: true
44+
# calebcartwright (2019-12-24)
45+
# Keeping this as an allowed failure since it was flagged as such in the TravisCI config, even though
46+
# it appears to have been passing for quite some time.
47+
# Original comment was: temporal build failure due to breaking changes in the nightly compiler
48+
- integration: rust-semverver
49+
allow-failure: true
50+
# Can be moved back to include section after https://github.com/rust-lang-nursery/failure/pull/298 is merged
51+
- integration: failure
52+
allow-failure: true
53+
54+
steps:
55+
- name: checkout
56+
uses: actions/checkout@v2
57+
58+
# Run build
59+
- name: setup
60+
uses: actions-rs/toolchain@v1
61+
with:
62+
toolchain: nightly-x86_64-unknown-linux-gnu
63+
target: x86_64-unknown-linux-gnu
64+
override: true
65+
profile: minimal
66+
default: true
67+
- name: run integration tests
68+
env:
69+
INTEGRATION: ${{ matrix.integration }}
70+
run: ./ci/integration.sh
71+
continue-on-error: ${{ matrix.allow-failure == true }}

.github/workflows/linux.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
fail-fast: false
10+
matrix:
11+
target: [
12+
x86_64-unknown-linux-gnu,
13+
]
14+
channel: [ nightly ]
15+
cfg-release-channel: [
16+
beta,
17+
nightly,
18+
]
19+
20+
env:
21+
CFG_RELEASE_CHANNEL: ${{ matrix.cfg-release-channel }}
22+
23+
steps:
24+
- name: checkout
25+
uses: actions/checkout@v2
26+
27+
# Run build
28+
- name: setup
29+
uses: actions-rs/toolchain@v1
30+
with:
31+
toolchain: ${{ matrix.channel }}-${{ matrix.target }}
32+
target: ${{ matrix.target }}
33+
override: true
34+
profile: minimal
35+
default: true
36+
- name: build
37+
run: |
38+
rustc -Vv
39+
cargo -V
40+
cargo build --manifest-path rustfmt-core/Cargo.toml --workspace
41+
42+
- name: test
43+
run: cargo test-all
44+
- name: test ignored
45+
run: cargo test-all -- --ignored

.github/workflows/mac.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
steps:
19+
- name: checkout
20+
uses: actions/checkout@v2
21+
22+
# Run build
23+
- name: setup
24+
uses: actions-rs/toolchain@v1
25+
with:
26+
toolchain: ${{ matrix.channel }}-${{ matrix.target }}
27+
target: ${{ matrix.target }}
28+
override: true
29+
profile: minimal
30+
default: true
31+
- name: build
32+
run: |
33+
rustc -Vv
34+
cargo -V
35+
cargo build --manifest-path rustfmt-core/Cargo.toml --workspace
36+
37+
- name: test
38+
run: cargo test-all
39+
- name: test ignored
40+
run: cargo test-all -- --ignored

.github/workflows/windows.yml

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on: [push, pull_request]
44
jobs:
55
test:
66
runs-on: windows-latest
7+
name: (${{ matrix.target }}, ${{ matrix.channel }})
78
strategy:
89
fail-fast: false
910
matrix:
@@ -14,6 +15,10 @@ jobs:
1415
x86_64-pc-windows-msvc,
1516
]
1617
channel: [ nightly ]
18+
include:
19+
- channel: nightly
20+
target: i686-pc-windows-gnu
21+
mingw-7z-path: mingw
1722

1823
steps:
1924
# The Windows runners have autocrlf enabled by default
@@ -22,6 +27,7 @@ jobs:
2227
run: git config --global core.autocrlf false
2328
- name: checkout
2429
uses: actions/checkout@v2
30+
2531
# The Windows runners do not (yet) have a proper msys/mingw environment
2632
# pre-configured like AppVeyor does, though they will likely be added in the future.
2733
# https://github.com/actions/virtual-environments/issues/30
@@ -32,16 +38,33 @@ jobs:
3238
# package and numworks/setup-msys2 action.
3339
# https://github.com/rust-lang/rust/blob/master/src/ci/scripts/install-mingw.sh#L59
3440
# https://github.com/rust-lang/rustup/blob/master/appveyor.yml
35-
- name: install mingw32
41+
#
42+
# Use GitHub Actions cache support to avoid downloading the .7z file every time
43+
# to be cognizant of the AWS egress cost impacts
44+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
45+
- name: cache mingw.7z
46+
id: cache-mingw
47+
with:
48+
path: ${{ matrix.mingw-7z-path }}
49+
key: ${{ matrix.channel }}-${{ matrix.target }}-mingw
50+
uses: actions/cache@v1
51+
if: matrix.target == 'i686-pc-windows-gnu' && matrix.channel == 'nightly'
52+
- name: download mingw.7z
3653
run: |
3754
# Disable the download progress bar which can cause perf issues
3855
$ProgressPreference = "SilentlyContinue"
39-
Invoke-WebRequest https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z -OutFile mingw.7z
40-
7z x -y mingw.7z -oC:\msys64 | Out-Null
41-
del mingw.7z
56+
md -Force ${{ matrix.mingw-7z-path }}
57+
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
58+
if: matrix.target == 'i686-pc-windows-gnu' && matrix.channel == 'nightly' && steps.cache-mingw.outputs.cache-hit != 'true'
59+
shell: powershell
60+
- name: install mingw32
61+
run: |
62+
7z x -y ${{ matrix.mingw-7z-path }}/mingw.7z -oC:\msys64 | Out-Null
4263
echo ::add-path::C:\msys64\mingw32\bin
43-
if: matrix.target == 'i686-pc-windows-gnu'
64+
if: matrix.target == 'i686-pc-windows-gnu' && matrix.channel == 'nightly'
4465
shell: powershell
66+
67+
# Run build
4568
- name: setup
4669
uses: actions-rs/toolchain@v1
4770
with:
@@ -54,17 +77,12 @@ jobs:
5477
run: |
5578
rustc -Vv
5679
cargo -V
57-
cargo build
80+
cargo build --manifest-path rustfmt-core/Cargo.toml --workspace
5881
shell: cmd
82+
5983
- name: test
60-
run: cargo test
61-
shell: cmd
62-
- name: 'test ignored'
63-
run: cargo test -- --ignored
64-
shell: cmd
65-
- name: 'test rustfmt-core'
66-
run: cargo test --manifest-path rustfmt-core/Cargo.toml
84+
run: cargo test-all
6785
shell: cmd
68-
- name: 'test rustfmt-core ignored'
69-
run: cargo test --manifest-path rustfmt-core/Cargo.toml -- --ignored
86+
- name: test ignored
87+
run: cargo test-all -- --ignored
7088
shell: cmd

0 commit comments

Comments
 (0)