From e184fc449c6c0b23ec954be890ec1852b551f0d5 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 22 Dec 2021 20:25:25 -0800 Subject: [PATCH 1/4] Configure GitHub Actions --- .github/workflows/build.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5a289e9 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,29 @@ +name: cargo + +on: [push, pull_request] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + options: + - '' + - --features x11 + - --features gnome + - --features sway + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: build + args: --release ${{ matrix.options }} From ad27efb32d38675208c2163b1d82ce386ee1bfbd Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 22 Dec 2021 20:26:55 -0800 Subject: [PATCH 2/4] Avoid double builds for my own PRs --- .github/workflows/build.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5a289e9..f15a21a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,10 +1,17 @@ name: cargo - -on: [push, pull_request] - +on: + push: + branches: + - master + pull_request: + types: + - opened + - synchronize + - reopened + schedule: + - cron: '00 15 * * *' # 7:00 PST (-8), 8:00 PDT (-7) env: CARGO_TERM_COLOR: always - jobs: build: runs-on: ubuntu-latest From 5f9eda24794a11c610691fbfceae9a0b5f414533 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 22 Dec 2021 20:29:34 -0800 Subject: [PATCH 3/4] Introduce caching --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f15a21a..44c449a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,6 +30,7 @@ jobs: profile: minimal toolchain: stable override: true + - uses: Swatinem/rust-cache@v1 - uses: actions-rs/cargo@v1 with: command: build From 5e137d4128763394205ed6348a557bd6e1e1075a Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 22 Dec 2021 20:32:42 -0800 Subject: [PATCH 4/4] Check rustfmt --- .github/workflows/build.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 44c449a..eaf957e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,3 +35,16 @@ jobs: with: command: build args: --release ${{ matrix.options }} + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: -- --check