Commit Graph

29 Commits

Author SHA1 Message Date
Thomas Eizinger
d26df944c0 ci: reference GitHub actions by hash (#7724)
To improve supply-chain security, reference all GitHub actions using the
hash of the released tag. GitHub recommends to do this for third-party
actions
(https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#using-third-party-actions).
In order to make our CI more deterministic, I opted to do it for all our
actions. This means any change to our workflow configuration requires a
source code change and thus passing CI on our end.

Dependabot will automatically issue PRs for these actions and update the
comment with the new version next to them.

Resolves: #2497.
2025-01-12 17:35:52 +00:00
Jamil
6f7f6a4f34 style: Enforce code style across all supported languages using Prettier (#7322)
This ensure that we run prettier across all supported filetypes to check
for any formatting / style inconsistencies. Previously, it was only run
for files in the website/ directory using a deprecated pre-commit
plugin.

The benefit to keeping this in our pre-commit config is that devs can
optionally run these checks locally with `pre-commit run --config
.github/pre-commit-config.yaml`.

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-11-13 00:19:15 +00:00
Reactor Scram
bfb3250ae2 chore(ci/rust): build and test more packages in Windows (#7036)
Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-10-15 21:22:27 +00:00
Reactor Scram
786fbc6689 chore(gui-client): delete GTK+ and Iced prototypes (#7035)
We don't need these since Tauri v2 looks like it's about to succeed, and
keeping packages outside of the workspace has been breaking dependabot
PRs
2024-10-15 15:29:11 +00:00
Reactor Scram
05a2b28d9f feat(rust/gui-client): add sentry.io error reporting (#6782)
Refs #6138 

Sentry is always enabled for now. In the near future we'll make it
opt-out per device and opt-in per org (see #6138 for details)

- Replaces the `crash_handling` module
- Catches panics in GUI process, tunnel daemon, and Headless Client
- Added a couple "breadcrumbs" to play with that feature
- User ID is not set yet
- Environment is set to the API URL, e.g. `wss://api.firezone.dev`
- Reports panics from the connlib async task
- Release should be automatically pulled from the Cargo version which we
automatically set in the version Makefile

Example screenshot of sentry.io with a caught panic:

<img width="861" alt="image"
src="https://github.com/user-attachments/assets/c5188d86-10d0-4d94-b503-3fba51a21a90">
2024-09-27 16:34:54 +00:00
Reactor Scram
8ae1eb7721 chore(ci): alphabetize Windows packages (#6824)
Also add `firezone-logging` which slipped through

This is factored out from #6782
2024-09-26 22:13:50 +00:00
Reactor Scram
b06f2e30e9 chore(rust/gui-client): Iced prototype (#6606)
Adds a prototype `iced` GUI client to the workspace. This needs more
work before we can swap it in and replace the Tauri client.

Refs #4883 

<img width="683" alt="image"
src="https://github.com/user-attachments/assets/b2c85224-fb7f-4f3e-a2e0-3b184e971dda">
2024-09-19 15:31:50 +00:00
Reactor Scram
5eab912f60 refactor(rust/gui-client): begin isolating Tauri from our code (#6593)
This moves about 2/3rds of the code from `firezone-gui-client` to
`firezone-gui-client-common`.

I tested it in aarch64 Windows and cycled through sign-in and sign-out
and closing and re-opening the GUI process while the IPC service stays
running. IPC and updates each get their own MPSC channel in this, so I
wanted to be sure it didn't break.

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-09-05 17:42:45 +00:00
Thomas Eizinger
50d6b865a1 refactor(connlib): move Tun implementations out of firezone-tunnel (#5903)
The different implementations of `Tun` are the last platform-specific
code within `firezone-tunnel`. By introducing a dedicated crate and a
`Tun` trait, we can move this code into (platform-specific) leaf crates:

- `connlib-client-android`
- `connlib-client-apple`
- `firezone-bin-shared`

Related: #4473.

---------

Co-authored-by: Not Applicable <ReactorScram@users.noreply.github.com>
2024-07-24 01:10:50 +00:00
Reactor Scram
78f1c7c519 test(firezone-tunnel/windows): Test Windows upload speed in CI (#5607)
Closes #5601
It looks like we can hit 100+ Mbps in theory. This covers Wintun, Tokio,
and Windows OS overhead. It doesn't cover the cryptography or anything
in connlib itself.

The code is kinda messy but I'm not sure how to clean it up so I'll just
leave it for review.

This test should fail if there's any regressions in #5598.

It fails if any packet is dropped or if the speed is under 100 Mbps

```[tasklist]
### Tasks
- [x] Use `ip_packet::make`
- [x] Switch to `cargo bench`
- [x] Extract windows ARM PR
- [x] Clean up wintun.dll install code
- [x] Re-request review
```
2024-07-10 19:09:45 +00:00
Reactor Scram
d0f68fc133 test(gui-client): multi-process smoke test for GUI + IPC service (#5672)
```[tasklist]
### Tasks
- [x] Check the GUI saves its settings file
- [x] Check the IPC service writes the device ID to disk
- [x] Check the GUI writes a log file (skipped - we already check if the exported zip has any files in it)
- [x] Run the crash file through `minidump-stackwalk`
- [x] Reach feature parity with the original smoke tests
- [x] Ready for review
- [x] Finish #5452
- [ ] Start on #5453 
```
2024-07-04 21:10:31 +00:00
Thomas Eizinger
839292b1e3 ci: use sccache for building Tauri clients (#5617)
Using sccache results in a more efficient cache usage. GitHub's built-in
cache appears to grow over time and takes ~3minutes to download for the
Windows Tauri builds where it is ~2GB large.

Whilst researching bad performance on Windows runners in general, I came
across the hint to disable Windows defender which appears to slow things
down massively in the case of sccache which performs many small network
downloads and file writes.

This PR harmonizes our cache usage and prefers sccache over GitHub's
cache for everything apart from `cross` builds. The runtimes are either
roughly the same or noticeably better. Overally, the GUI smoke tests are
usually among the last ones to finish, meaning these changes should have
an overall net-positive impact on CI time.


|[`main`](https://github.com/firezone/firezone/actions/runs/9707704927)|[`head`](https://github.com/firezone/firezone/actions/runs/9709368060)|
|---|---|
|![Screenshot from 2024-06-28
17-55-14](https://github.com/firezone/firezone/assets/5486389/63433f24-d6de-4651-8bd8-ed1eb4b5b445)|![Screenshot
from 2024-06-28
17-59-33](https://github.com/firezone/firezone/assets/5486389/b82dd643-dd48-4c7f-9322-6bd45ab0fa70)|
|![Screenshot from 2024-06-28
17-55-17](https://github.com/firezone/firezone/assets/5486389/bc06fdb7-744a-4232-8e4f-c9bd7fd3c278)|![Screenshot
from 2024-06-28
17-59-39](https://github.com/firezone/firezone/assets/5486389/0b0b5207-7d77-4ed4-94d9-1306878e552a)|
|![Screenshot from 2024-06-28
17-55-21](https://github.com/firezone/firezone/assets/5486389/a2187475-8678-4c6b-afef-a96575943c98)|![Screenshot
from 2024-06-28
17-59-44](https://github.com/firezone/firezone/assets/5486389/90e9d335-536e-472a-846c-7ae0edf336fc)|
|![Screenshot from 2024-06-28
17-55-28](https://github.com/firezone/firezone/assets/5486389/a239f4f9-8c3b-4742-8b20-22e903082310)|![Screenshot
from 2024-06-28
17-59-50](https://github.com/firezone/firezone/assets/5486389/be718857-e217-464a-b4e2-515e5ad4c48c)|
|![Screenshot from 2024-06-28
17-55-33](https://github.com/firezone/firezone/assets/5486389/25b2ff75-c5d2-46f0-ab7e-702f2202e3c7)|![Screenshot
from 2024-06-28
17-59-55](https://github.com/firezone/firezone/assets/5486389/7e1ca3a8-dabc-4501-99bc-ff7993886e8f)|
|![Screenshot from 2024-06-28
17-55-37](https://github.com/firezone/firezone/assets/5486389/121a943d-db08-484a-8450-a0b8ca35cd10)|![Screenshot
from 2024-06-28
18-01-51](https://github.com/firezone/firezone/assets/5486389/d1cc137f-0898-4fdb-9798-e473195346a8)|
2024-06-28 22:28:21 +00:00
Reactor Scram
3a67eacfbe refactor(linux-client): replace client-tunnel with headless-client which is the same thing (#4516)
Unfortunately I had to keep `linux-client` to get the compatibility
tests to pass. #4578 aims to remove that package.

Please add to this list if you think of anything:

```[tasklist]
# Things that may break that CI/CD won't catch
- [ ] Github release artifacts
- [ ] Knowledge base 
- [ ] Docker images
- [ ] Docker containers
- [ ] Existing `linux-client` users
- [ ] Anything that downloads ghcr artifacts
- [ ] Nix (Not sure if it's built in CI. It had a merge conflict)
```

Refs #4515, and #3712, #3782

I think this is what Thomas and I agreed on in Slack / Github

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-04-10 22:01:55 +00:00
Jamil
a58dd99e9f chore(ci): Scope GH rust cache per os type (#4504)
I suspect this is a cache issue:


https://github.com/firezone/firezone/actions/runs/8549331928/job/23424473070

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-04-04 16:47:51 +00:00
Reactor Scram
74a81b2a56 test(gui-client): unit test for Linux IPC (#4277)
(After GA)

This adds a unit test for the Unix domain sockets that I intend to use
for process splitting on Linux.

The length-prefixed encoding and decoding are copied from `subzone`, but
most of that code will not be re-used since it's Windows-specific and
also specific to a Chromium-like process model, which won't work for
Firezone.
2024-04-02 19:34:24 +00:00
Thomas Eizinger
8ce5e64a2c ci: add timeout to cache download from GitHub (#4207)
GitHub actions cache download sometimes gets stuck. See
https://github.com/firezone/firezone/actions/runs/8335503938/job/22811115560.
In my experience with `rust-libp2p`, this can be fixed using an explicit
timeout.

See
https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout.
2024-03-19 02:20:27 +00:00
Thomas Eizinger
be22e99380 ci: scope Rust cache by targets to be built (#4136) 2024-03-14 01:19:18 +00:00
Jamil
391150f0e1 chore(ci): Fix new issues in cd.yml (#4085)
Fixes some issues encountered after the merge of #4049 

- Fix performance tests to only run using base_ref and head_ref to avoid
dependence on `main`
- Fixes some typos
- Prevents a catch-22 condition where breaking compatibility meant we
wouldn't be able to deploy production
2024-03-12 02:06:19 +00:00
Jamil
6575e0ca26 chore(ci): Refactor CI to use prod images in staging and prevent accidental hotfix breakages (#4049)
- Runs release asset builds simultaneously with `deploy-staging`. Those
don't depend on each other.
- Prevents running some build workflows in CD because they're run
already in the PR and in the merge group, and the risk of semantic
conflict is negligible
- Run `release` assets in staging
- Adds `compatibility_tests`: **To successfully introduce a breaking
change in the control / data plane APIs, you must now "Merge as
Administrator"**
- Since `CI` is no longer run on `main`, caching needed to be refactored
to make sense again
- Since `CI` is no longer run on `main`, the Elixir
`migrations_and_seeds_test` had to be rewritten. This now tests
migrations using `git checkout` instead of importing `main`'s DB dump.
- Move tauri builds to its own workflow so we can trigger Linux and
Windows builds manually on an adhoc basis like we do for the Swift and
Kotlin builds
- Add a new `hotfix` workflow that will run `compatibility_tests` with
the latest published images
- Add `workflow_dispatch` to trigger `CD` manually for testing purposes
(cc @ReactorScram)


Refs #3995
2024-03-11 20:01:34 +00:00
Jamil
268e792f48 chore(ci): Use GH actions cache for Tauri builds (#3906)
Builds off #3905 and uses the GH actions cache for tauri builds in order
to get around the `crate-type` problem sccache has with Tauri apps.

Fixes #3456
2024-03-05 01:07:31 +00:00
Jamil
fd1618093d chore(ci): Configure rustc to use sccache (#3905)
Due to the counter-intuitive way input variables work, `sccache` may not
have been used during the Rust compilation steps.

refs #3456
2024-03-04 15:52:32 +00:00
Jamil
62ad3c022b chore(ci): Fix CI deprecation and workflow warnings (#3612) 2024-02-09 07:25:34 +00:00
Jamil
355029f88f chore(ci): Bump sccache; remove IPC debug build (#3468)
Attempt #1 to speed up slow builds:

- kotlin
- tauri

refs #3456
2024-01-31 23:39:54 +00:00
Jamil
b1738bdd46 feat(ci): Add e2e test bed (#3135)
- [x] Launch control plane via docker compose
- [x] Ensure all clients build
2024-01-16 01:57:41 +00:00
Jamil
56451a6601 Revert "fix(ci): Inherit secrets from calling workflow to allow contributors' PRs to run" (#3030)
Ended up not fixing the issue for inheriting secrets.

Reverts firezone/firezone#3028
2023-12-27 09:53:28 -06:00
Jamil
5b76c59470 fix(ci): Inherit secrets from calling workflow to allow contributors' PRs to run (#3028)
Attempting to fix the issue seen
[here](https://github.com/firezone/firezone/actions/runs/7331666670).
Unfortunately the docs aren't super clear on this so it may take some
trial and error.


https://docs.github.com/en/actions/using-workflows/reusing-workflows#using-inputs-and-secrets-in-a-reusable-workflow
2023-12-27 09:51:20 -06:00
Andrew Dryga
00bde6e785 Fix sccache 2023-10-24 08:43:37 -06:00
Andrew Dryga
66302a5063 Production environment (#2449) 2023-10-19 19:20:51 -06:00
Thomas Eizinger
5549044afe ci: use sccache for Rust (#2402)
Our caches in GitHub actions are hopelessly overflowing, plus for the
Kotlin and Swift jobs, we don't seem to be doing a particularly good job
at caching the build outputs because those jobs take forever.

Instead of using GitHub actions, this PR configures `sccache` for all
Rust compilation commands and uses a GCP bucket to store the artifacts.
This speeds up some of the builds a fair bit. Android now finishes in
~6minutes.

Apart from the self-hosted MacOS 14 runner, the Swift jobs are slow but
still a lot faster than what we currently have.

Windows seems to be quite slow at compiling / fetching artefacts which
is negatively impacted by this change because they now have to be
fetched from the bucket.

Overall, I think this is a net-positive though and should be much easier
to maintain going forward.

---------

Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2023-10-18 10:25:31 -07:00