Skip to content

Commit f6a9566

Browse files
authored
Rewrite in Rust (#6)
* Initial commit for the rewrite in rust. * Update README.md - Started transition to Rust; not quite complete yet. * Fix shared state in actix handler and update fail checks - Add proper shared state in the actix handler, since the factory method for app_data is called on every worker! - Fixes #5 by failing if the time of last update is >2 minutes ago * Rename datafeed to vatsim - This makes more sense, since - f.e. - the status file is also queried from within this module. * Fix incorrect actix scope * add some convenience features for debugging * Bump to version 1.0.0, add healthcheck * Bump to 1.2.0 to avoid confusion with previous packages * Update docker-compose.yml to fix health check command * Update cargo to version 1.2.1 * Update prod.docker.yml * fix prod workflow only running on main branch * dev workflow creates images based on commit sha * fix typo * fix typo * Fix missing struct members * update workflows * fix qnh_i_hg type * fix atis_code being non-optional
1 parent 03e5bb3 commit f6a9566

32 files changed

Lines changed: 3523 additions & 1986 deletions

.dockerignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

.env.example

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/dev.prettier.yml

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,36 @@
1-
name: Code-Style Check
1+
name: Build dev image
22

3-
# Run only if a *.ts file has changed (i.e. anything relevant)
43
on:
5-
push:
6-
branches: [ "dev" ]
7-
paths:
8-
- "**.ts"
94
pull_request:
10-
branches: [ "dev" ]
11-
paths:
12-
- "**.ts"
5+
branches: [ "main" ]
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}
1310

1411
jobs:
15-
code-style-check:
12+
docker-image-build:
1613
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
1717

1818
steps:
19-
- name: Checkout
20-
uses: actions/checkout@v3
19+
- name: Extract commit SHA
20+
run:
21+
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
22+
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
2125

22-
- name: Prettier Check
23-
uses: creyD/prettier_action@v4.3
26+
- name: Docker Login
27+
uses: docker/login-action@v3
2428
with:
25-
dry: true
26-
prettier_options: "--check **/*.ts"
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Build and push Docker image
34+
run: |
35+
docker build --pull --build-arg COM_SHA=${{ env.SHORT_SHA }} -t ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.SHORT_SHA }} .
36+
docker push ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.SHORT_SHA }}

.github/workflows/prod.docker.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Docker CI/CD
1+
name: Build prod image
22

33
on:
44
push:
@@ -16,17 +16,21 @@ jobs:
1616
packages: write
1717

1818
steps:
19+
- name: Extract commit SHA
20+
run:
21+
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
22+
1923
- name: Checkout repository
20-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2125

2226
- name: Docker Login
23-
uses: docker/login-action@v2
27+
uses: docker/login-action@v3
2428
with:
2529
registry: ${{ env.REGISTRY }}
2630
username: ${{ github.actor }}
2731
password: ${{ secrets.GITHUB_TOKEN }}
2832

2933
- name: Build and push Docker image
3034
run: |
31-
docker build --pull -t ${{ env.REGISTRY }}/${{ github.repository }}:latest .
35+
docker build --pull --build-arg COM_SHA=${{ env.SHORT_SHA }} -t ${{ env.REGISTRY }}/${{ github.repository }}:latest .
3236
docker push ${{ env.REGISTRY }}/${{ github.repository }}:latest

.gitignore

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
1-
dist
2-
node_modules
3-
.idea
4-
.vscode
1+
# Generated by Cargo
2+
# will have compiled files and executables
3+
debug/
4+
target/
55

6-
.env
6+
# These are backup files generated by rustfmt
7+
**/*.rs.bk
8+
9+
# MSVC Windows builds of rustc generate these, which store debugging information
10+
*.pdb
11+
12+
# RustRover
13+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
14+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
15+
# and can be added to the global gitignore or merged into this file. For a more nuclear
16+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
17+
.idea/
18+
.vscode/

.prettierignore

Lines changed: 0 additions & 13 deletions
This file was deleted.

.prettierrc

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)