Commit Graph

48 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
Thomas Eizinger
db2dd4a618 ci: pass SENTRY_AUTH_TOKEN explicit as input (#7503)
Secrets are not accessible within actions.
2024-12-13 04:47:47 +00:00
Thomas Eizinger
81f71cba62 fix(telemetry): use package@version notation for releases (#7466)
In order for Sentry to parse our releases as semver, they need to be in
the form of `package@version` [0]. Without this, the feature of "Mark
this issue as resolved in the _next_ version" doesn't work properly
because Sentry compares the versions as to when it first saw them vs
parsing the semver string itself. We test versions prior to releasing
them, meaning Sentry learns about a 1.4.0 version before it is actually
released. This causes false-positive "regressions" even though they are
fixed in a later (as per semver) release.

This create some redundancy with the different DSNs that we are already
using. I think it would make sense to consider merging the two projects
we have for the GUI client for example. That is really just one project
that happens to run as two binaries.

For all other projects, I think the separation still makes sense because
we e.g. may add Sentry to the "host" applications of Android and
MacOS/iOS as well. For those, we would reuse the DSN and thus funnel the
issues into the same Sentry project.

As per Sentry's docs, releases are organisation-wide and therefore need
a package identifier to be grouped correctly.

[0]:
https://docs.sentry.io/platforms/javascript/configuration/releases/#bind-the-version
2024-12-09 05:04:45 +00:00
Thomas Eizinger
f04bf6bd6d ci: create Sentry release on publish (#7362)
Explicitly creating the Sentry release allows us to associate the
commits since the last release with the new one. This might help us to
identify potential sources of regressions. For the current releases,
I've set them manually to ensure that this automation has something to
pick up on for the next release.

The releases will already exists prior to this because they are
automatically created when a client / gateway first logs in with a
certain version.

What this does it mark it as "finalized" and set the commit range
accordingly.

Resolves: #7358.

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-11-18 20:39:43 +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
4fe4001760 chore(rust/gui-client): migrate to Tauri v2 (#6996)
Closes #4883 

Refs #7005 

Adds support for Ubuntu 24.04, drops support for Ubuntu 20.04

Known issues:
- On Ubuntu 22.04, sometimes GNOME shows the wrong tray icon
- On Ubuntu 24.04, the first time you open the tray menu, GNOME takes a
long time to open the menu.

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-10-24 16:31:28 +00:00
Thomas Eizinger
21ab270ebc ci(android): be explicit about NDK version (#7119) 2024-10-22 02:38:44 +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
662a73115a ci: use Google's DockerHub mirror (#6195)
DockerHub has pretty low rate limits [0] for pulling images: Only 100
pulls / 6h. This can stall our CI which pulls several (base) images.

To not hurt our velocity, use Google's public mirror [1].

[0]: https://www.docker.com/increase-rate-limits/.
[1]:
https://cloud.google.com/artifact-registry/docs/pull-cached-dockerhub-images
2024-08-07 05:20:47 +00:00
Reactor Scram
78cca053a6 ci(client/tauri): upgrade pnpm from 8.x to 9.3 (#6114)
Closes #5859

The Git version was always showing `-modified` because the lockfile was
made by pnpm 9, and pnpm would modify it to work with pnpm 8.
2024-07-31 21:54:38 +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
Jamil
446d24a761 ci: Fix scoping dialyzer cache to elixir version (#5825)
This fixes a CI bug where the dialyzer cache was not being scoped to the
elixir version, causing cache issues that fail CI jobs.

This also performs some tidying up of the cache key to scope it by
runner arch too for elixir deps, and make clear what the cache key
references.

https://github.com/firezone/firezone/actions/runs/9877195625
2024-07-10 18:01:32 +00:00
Reactor Scram
e0326be807 ci(gui-client/linux): see if we can build the GUI Client for ARM (#5793)
This would make it a little easier to replicate prod issues on old
releases

```[tasklist]
### Tasks
- [x] Add comment to changelog
- [x] Check Vercel preview
- [x] Request review
- [x] Update arches link
- [x] `apt-get update`
- [x] Re-request review
```
2024-07-08 21:30:48 +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
04476880e7 ci: only set up runtime tauri deps for smoke tests (#5632)
Setting up Tauri's runtime dependencies takes about a minute and is
unnecessary for the Rust unit tests. The Rust Windows unit tests jobs
are amongst the slowest and thus impact the overall CI runtime.

See
https://github.com/firezone/firezone/actions/runs/9719218798/job/26828616349
for a recent run on `main`.

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-06-29 05:35:11 +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
Jamil
de38a3537d ci: Use offline evergreen installer (#5429)
May help to alleviate some flakiness regarding the `setup-tauri` action,
and speed up CI runs since the whole installer will be cached, not just
the bootstrapper stub.


https://github.com/firezone/firezone/actions/runs/9570220149/job/26384496768
2024-06-18 20:59:54 +00:00
Jamil
c3b5768f57 ci: cache webview installer (#4935)
https://github.com/firezone/firezone/actions/runs/9008970452/job/24752210427?pr=4928
2024-05-09 17:08:59 +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
Andrew Dryga
f3c8c734ab feat(portal): Filtering, Fulltext Search, Pagination, Preloads (#3751)
On the domain side this PR extends `Domain.Repo` with filtering,
pagination, and ordering, along with some convention changes are
removing the code that is not needed since we have the filtering now.
This required to touch pretty much all contexts and code, but I went
through all public functions and added missing tests to make sure
nothing will be broken.

On the web side I've introduced a `<.live_table />` which is as close as
possible to being a drop-in replacement for the regular `<.table />`
(but requires to structure the LiveView module differently due to
assigns anyways). I've updated all the listing tables to use it.
2024-03-16 13:27:48 -06:00
Thomas Eizinger
be22e99380 ci: scope Rust cache by targets to be built (#4136) 2024-03-14 01:19:18 +00:00
Jamil
1a348b2ada chore(ci): Add setup-elixir composite action (#4067)
Pulled out of #4049
2024-03-12 19:41:06 +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
Reactor Scram
fd31152106 refactor(ci): enable Linux do-nothing GUI builds (but not tests) in CI/CD, extract scripts for that (#3735)
Builds a do-nothing `return 0` Linux client to make sure the CI/CD
scripts are set up and producing AppImage / deb bundles as expected.


![image](https://github.com/firezone/firezone/assets/13400041/7d2d8f02-adde-4b1b-89ec-02aaf112ac48)

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-02-23 17:57:39 +00:00
Reactor Scram
bee2dabf4c refactor(ci): extract setup-tauri action and generalize Windows builds (#3702)
This prevents duplication for different Tauri jobs like building the
release packages vs testing a debug build with mock keyring.

```[tasklist]
- [ ] Fix branch protection rules for changed tests
```

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-02-22 01:59:47 +00:00
Reactor Scram
4c0b685978 chore(ci): update Node to 20 in the Windows CI jobs (#3611)
Fixes warnings for using pnpm for the Windows smoke test and release
build
2024-02-09 18:07:24 +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
Andrew Dryga
2f5ec1a6b8 Change workload identity pool name 2023-10-06 09:59:13 -06:00
Thomas Eizinger
9a41983447 ci: optimize caching further (#2246)
This patch-set aims to make several improvements to our CI caching:

1. Use of registry as build cache: Pushes a separate image to our docker
registry at GCP that contains the cache layers. This happens for every
PR & main. As a result, we can restore from **both** which should make
repeated runs of CI on an individual PR faster and give us a good
baseline cache for new PRs from `main`. See
https://docs.docker.com/build/ci/github-actions/cache/#registry-cache
for details. As a nice side-effect, this allows us to use the 10 GB we
have on GitHub actions for other jobs.
2. We make better use of `restore-keys` by also attempting to restore
the cache if the fingerprint of our lockfiles doesn't match. This is
useful for CI runs that upgrade dependencies. Those will restore a cache
that is still useful although doesn't quite match. That is better[^1]
than not hitting the cache at all.
3. There were two tiny bugs in our Swift and Android builds:
a. We used `rustup show` in the wrong directory and thus did not
actually install the toolchain properly.
b. We used `shared-key` instead of `key` for the
https://github.com/Swatinem/rust-cache action and thus did not
differentiate between jobs properly.
5. Our Dockerfile for Rust had a bug where it did not copy in the
`rust-toolchain.toml` file in the `chef` layer and thus also did not use
the correctly toolchain.
6. We remove the dedicated gradle cache because the build action already
comes with a cache configuration:
https://github.com/firezone/firezone/actions/runs/6416847209/job/17421412150#step:10:25

[^1]: Over time, this may mean that our caches grow a bit. In an ideal
world, we automatically remove files from the caches that haven't been
used in a while. The cache action we use for Rust does that
automatically:
https://github.com/Swatinem/rust-cache?tab=readme-ov-file#cache-details.
As a workaround, we can just purge all caches every now and then.

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2023-10-05 06:26:56 -07:00