Skip to content

Commit

Permalink
chore: init
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobLinCool committed May 16, 2023
0 parents commit 96b7fe5
Show file tree
Hide file tree
Showing 27 changed files with 5,582 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb


# Added by cargo

/target
**/.env
**/.DS_Store
wasm/*.wasm
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
JWT_SECRET=SECRET_TOKEN
PORT=33000
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
31 changes: 31 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build Docker Image

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Copy .env file
run: cp .env.example .env

- name: Build and Push
run: docker buildx bake --set "*.platform=linux/arm64/v8,linux/amd64" --push
88 changes: 88 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Release

on:
push:
tags:
- "v[0-9]+.*"

permissions:
contents: write

jobs:
create_release:
runs-on: ubuntu-latest
steps:
- uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false

release_assets:
needs: create_release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- build: linux-x64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: "compilet-linux-amd64"
- build: linux-arm64
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact_name: "compilet-linux-arm64"
- build: macos-x64
os: macos-latest
target: x86_64-apple-darwin
artifact_name: "compilet-darwin-amd64"
- build: macos-arm64
os: macos-latest
target: aarch64-apple-darwin
artifact_name: "compilet-darwin-arm64"
- build: windows-x64
os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: "compilet-windows-amd64"
- build: linux-musl-x64
os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact_name: "compilet-linux-musl-amd64"
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
target: ${{ matrix.target }}

- name: Install musl-tools
run: sudo apt update && sudo apt install -y musl-tools
if: matrix.build == 'linux-musl-x64'

- name: Install gcc-aarch64-linux-gnu
run: sudo apt update && sudo apt install -y gcc-aarch64-linux-gnu
if: matrix.build == 'linux-arm64'

- name: Build
run: cargo build --release --target ${{ matrix.target }}

- name: Upload to Release
uses: svenstaro/upload-release-action@v2
if: matrix.os != 'windows-latest'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/compilet
asset_name: ${{ matrix.artifact_name }}
tag: ${{ github.ref }}

- name: Upload to Release (Windows)
uses: svenstaro/upload-release-action@v2
if: matrix.os == 'windows-latest'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.target }}/release/compilet.exe
asset_name: ${{ matrix.artifact_name }}.exe
tag: ${{ github.ref }}
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Check Formatting
run: cargo fmt --all --check
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb


# Added by cargo

/target
**/.env
**/.DS_Store
wasm/*.wasm
Loading

0 comments on commit 96b7fe5

Please sign in to comment.