Skip to content

Commit

Permalink
misc: merge main (#572)
Browse files Browse the repository at this point in the history
* Merge remote-tracking branch 'upstream/main' into shuttle-next

* refactor: touch ups
  • Loading branch information
chesedo authored Jan 11, 2023
1 parent 5b033d0 commit 9697090
Show file tree
Hide file tree
Showing 29 changed files with 915 additions and 249 deletions.
158 changes: 81 additions & 77 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,27 @@ commands:
type: string
default: ""
steps:
- run:
name: Set git tag in the environment"
command: |
echo TAG=$(git describe --tags) >> $BASH_ENV
- run:
name: Make artifact
command: |
mkdir shuttle
mv target/<< parameters.target >>/release/cargo-shuttle<< parameters.suffix >> shuttle/cargo-shuttle<< parameters.suffix >>
mv LICENSE shuttle/
mv README.md shuttle/
mkdir artifacts
tar -cvzf artifacts/cargo-shuttle-${CIRCLE_TAG}-<< parameters.target >>.tar.gz shuttle
mkdir -p artifacts/<< parameters.target >>
cp $BASH_ENV artifacts/bash.env
tar -cvzf artifacts/<< parameters.target >>/cargo-shuttle-$TAG-<< parameters.target >>.tar.gz shuttle
# Persist the bash environment to the workspace as well, we need it for the release job.
# https://discuss.circleci.com/t/share-environment-variable-between-different-job/45647/4
- persist_to_workspace:
root: artifacts
paths:
- cargo-shuttle-${CIRCLE_TAG}-<< parameters.target >>.tar.gz
- << parameters.target >>/*
- bash.env

jobs:
workspace-fmt:
Expand Down Expand Up @@ -354,98 +362,94 @@ jobs:
steps:
- attach_workspace:
at: artifacts
- run:
name: "Set tag in environment"
command: |
cat artifacts/bash.env >> "$BASH_ENV"
rm artifacts/bash.env
- run:
name: "Publish Release on GitHub"
environment:
GITHUB_TOKEN: $GITHUB_TOKEN
# Since each binary is in a sub directory named after its target, we flatten
# the artifacts directory before passing it to ghr
command: |
find artifacts -mindepth 2 -type f -exec mv -t artifacts {} +
go install github.com/tcnksm/ghr@v0.16.0
ghr -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete -draft ${CIRCLE_TAG} artifacts/
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete -draft ${TAG} ./artifacts/
workflows:
version: 2
ci:
jobs:
- workspace-fmt
- workspace-clippy:
name: workspace-clippy-<< matrix.framework >>
requires:
- workspace-fmt
matrix:
parameters:
framework: ["web-actix-web", "web-axum", "web-rocket", "web-poem", "web-thruster", "web-tide", "web-tower","web-warp", "web-salvo", "bot-serenity"]
- check-standalone:
matrix:
parameters:
path:
- resources/aws-rds
- resources/persist
- resources/secrets
- resources/shared-db
- resources/static-folder
- service-test:
requires:
- workspace-clippy
- platform-test:
requires:
- workspace-clippy
matrix:
parameters:
crate: ["shuttle-deployer", "cargo-shuttle", "shuttle-codegen", "shuttle-common", "shuttle-proto", "shuttle-provisioner"]
- e2e-test:
requires:
- service-test
- platform-test
- check-standalone
filters:
branches:
only: production
- build-and-push:
requires:
- e2e-test
- workspace-fmt
- workspace-clippy:
name: workspace-clippy-<< matrix.framework >>
requires:
- workspace-fmt
matrix:
parameters:
framework: ["web-actix-web", "web-axum", "web-rocket", "web-poem", "web-thruster", "web-tide", "web-tower","web-warp", "web-salvo", "bot-serenity", "bot-poise"]
- check-standalone:
matrix:
parameters:
path:
- resources/aws-rds
- resources/persist
- resources/secrets
- resources/shared-db
- resources/static-folder
- service-test:
requires:
- workspace-clippy
- platform-test:
requires:
- workspace-clippy
matrix:
parameters:
crate: ["shuttle-deployer", "cargo-shuttle", "shuttle-codegen", "shuttle-common", "shuttle-proto", "shuttle-provisioner"]
- e2e-test:
requires:
- service-test
- platform-test
- check-standalone
filters:
branches:
only: production
- build-and-push:
requires:
- e2e-test
filters:
branches:
only: production
- build-binaries-linux:
name: build-binaries-x86_64
image: ubuntu-2204:2022.04.1
target: x86_64-unknown-linux-musl
resource_class: medium
filters:
branches:
only: production
- build-binaries-linux:
name: build-binaries-aarch64
image: ubuntu-2004:202101-01
target: aarch64-unknown-linux-musl
resource_class: arm.medium
filters:
branches:
only: production
- build-binaries-windows:
filters:
branches:
only: production
- build-binaries-linux:
name: build-binaries-x86_64
image: ubuntu-2204:2022.04.1
target: x86_64-unknown-linux-musl
resource_class: medium
- build-binaries-mac:
filters:
tags:
only: /^v.*/
branches:
only: production
- build-binaries-linux:
name: build-binaries-aarch64
image: ubuntu-2004:202101-01
target: aarch64-unknown-linux-musl
resource_class: arm.medium
filters:
tags:
only: /^v.*/
branches:
only: production
- build-binaries-windows:
filters:
tags:
only: /^v.*/
branches:
only: production
- build-binaries-mac:
filters:
tags:
only: /^v.*/
branches:
only: production
- publish-github-release:
only: production
- publish-github-release:
requires:
- build-binaries-x86_64
- build-binaries-aarch64
- build-binaries-windows
- build-binaries-mac
filters:
tags:
only: /^v.*/
branches:
only: production
only: production
23 changes: 21 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Build the required images with:
make images
```

> Note: The current [Makefile](https://github.com/shuttle-hq/shuttle/blob/main/Makefile) does not work on Windows systems, if you want to build the local environment on Windows you could use [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install).
> Note: The current [Makefile](https://github.com/shuttle-hq/shuttle/blob/main/Makefile) does not work on Windows systems by itself - if you want to build the local environment on Windows you could use [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install). Additional Windows considerations are listed at the bottom of this page.
The images get built with [cargo-chef](https://github.com/LukeMathWalker/cargo-chef) and therefore support incremental builds (most of the time). So they will be much faster to re-build after an incremental change in your code - should you wish to deploy it locally straight away.

Expand Down Expand Up @@ -109,7 +109,7 @@ cargo run --manifest-path ../../../Cargo.toml --bin cargo-shuttle -- logs
The steps outlined above starts all the services used by shuttle locally (ie. both `gateway` and `deployer`). However, sometimes you will want to quickly test changes to `deployer` only. To do this replace `make up` with the following:

```bash
docker-compose -f docker-compose.rendered.yml up provisioner
docker compose -f docker-compose.rendered.yml up provisioner
```

This prevents `gateway` from starting up. Now you can start deployer only using:
Expand Down Expand Up @@ -224,3 +224,22 @@ The rest are the following libraries:
- `e2e` just contains tests which starts up the `deployer` in a container and then deploys services to it using `cargo-shuttle`.

Lastly, the `user service` is not a folder in this repository, but is the user service that will be deployed by `deployer`.

## Windows Considerations
Currently, if you try to use 'make images' on Windows, you may find that the shell files cannot be read by Bash/WSL. This is due to the fact that Windows may have pulled the files in CRLF format rather than LF[^1], which causes problems with Bash as to run the commands, Linux needs the file in LF format.

Thankfully, we can fix this problem by simply using the `git config core.autocrlf` command to change how Git handles line endings. It takes a single argument:

```
git config --global core.autocrlf input
```

This should allow you to run `make images` and other Make commands with no issues.

If you need to change it back for whatever reason, you can just change the last argument from 'input' to 'true' like so:
```
git config --global core.autocrlf true
```
After you run this command, you should be able to checkout projects that are maintained using CRLF (Windows) again.

[^1]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_core_autocrlf
Loading

0 comments on commit 9697090

Please sign in to comment.