-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to using GitHub Actions as CI provider
GitLab has repeatedly messed with webhooks, repository mirroring, and CI itself in sinister ways that silently broke our CI from one day to the next, without any advance notice, acknowledgment, or even hint what they have done this time. On top of that, debugging their solution is a nightmare and time sink, because they provide virtually no insight into what is going on (at least not without involvement of third party services) and their API endpoints may just indicate success and still do nothing. This time it appears that they decided to remove "pull" mirroring from the free tier altogether, meaning that we can no longer keep code on GitLab in sync with that on GitHub, assuming it is being pushed to the latter. That renders their product entirely useless for our intents and purposes. To that end, this change switches over to using GitHub Actions as the CI provider. While there are some direct advantages to this switch, such as the much faster compilation and proper pull request integration, their artifact upload is unusable for our intents and purposes. Uploaded artifacts are seemingly always exposed as a zip archive and there is no way to link to the most recent artifact. For us that means that code coverage can no longer directly rely on generated HTML artifacts. As such, we have to switch over to relying on codecov.io as the service to which we upload collected data to be visualized. Furthermore, we start off with a reasonably simple CI script that covers all the steps we performed previously, but excludes all the advanced caching logic. The reason for this decision is that GitHub Actions workers are generally much faster and workflow duration is less of an issue. Should this change in the future or the program become significantly bigger, we can always revisit this decision.
- Loading branch information
Showing
6 changed files
with
96 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Copyright (C) 2022 Daniel Mueller <deso@posteo.net> | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
RUST_BACKTRACE: 1 | ||
# Build without debug information enabled to decrease compilation time | ||
# and binary sizes in CI. This option is assumed to only have marginal | ||
# effects on the generated code, likely only in terms of section | ||
# arrangement. See | ||
# https://doc.rust-lang.org/cargo/reference/environment-variables.html | ||
# https://doc.rust-lang.org/rustc/codegen-options/index.html#debuginfo | ||
RUSTFLAGS: '-C debuginfo=0' | ||
|
||
jobs: | ||
build: | ||
name: Build [${{ matrix.rust }}, ${{ matrix.profile }}] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
rust: [1.57.0, stable] | ||
profile: [dev, release] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
profile: minimal | ||
override: true | ||
- name: Build ${{ matrix.profile }} | ||
run: | | ||
cargo build --profile=${{ matrix.profile }} --lib --tests --all-features | ||
test: | ||
name: Test and coverage | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
- uses: actions-rs/tarpaulin@v0.1 | ||
with: | ||
version: latest | ||
args: --exclude-files=src/api/v2/de.rs | ||
out-type: Xml | ||
env: | ||
APCA_API_KEY_ID: ${{ secrets.APCA_API_KEY_ID }} | ||
APCA_API_SECRET_KEY: ${{ secrets.APCA_API_SECRET_KEY }} | ||
- name: Upload code coverage results | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: cobertura.xml | ||
clippy: | ||
name: Lint with clippy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
components: clippy | ||
override: true | ||
- run: cargo clippy --no-deps --all-targets --all-features --tests -- -A unknown_lints -D warnings | ||
rustfmt: | ||
name: Check code formatting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
components: rustfmt | ||
override: true | ||
- run: cargo +nightly fmt -- --check | ||
cargo-doc: | ||
name: Generate documentation | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
- run: cargo doc --no-deps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters