-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93d4c05
commit 80b81b1
Showing
28 changed files
with
2,190 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then | ||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8=" | ||
fi | ||
|
||
use flake . --impure --accept-flake-config | ||
|
||
# Include .env file if it exists locally. Use the .env file to load env vars that you don't want to commit to git | ||
if [ -f .env ] | ||
then | ||
set -o allexport | ||
source .env | ||
set +o allexport | ||
fi | ||
# Add your env vars here | ||
# | ||
# E.g. export AWS_ACCESS_KEY_ID="XXXXX" | ||
|
||
# SMTP config for local development. | ||
export SMTP_HOST="127.0.0.1" # On some computers may need `127.0.1.1` instead. | ||
export SMTP_PORT="1025" | ||
export SMTP_ENCRYPTION="Unencrypted" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
:set -XNoImplicitPrelude | ||
:def loadFromIHP \file -> (System.Environment.getEnv "IHP_LIB") >>= (\ihpLib -> readFile (ihpLib <> "/" <> file)) | ||
:loadFromIHP applicationGhciConfig | ||
import IHP.Prelude |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* text=auto eol=lf | ||
*.sql text | ||
*.hs text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Test and Deploy | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
env: | ||
ENV: "qa" | ||
PROJECT_NAME: myproject | ||
SSH_HOST: ${{ secrets.SSH_HOST }} | ||
SSH_USER: ${{ secrets.SSH_USER }} | ||
SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
NIXPKGS: "https://github.com/NixOS/nixpkgs/archive/51bcdc4cdaac48535dabf0ad4642a66774c609ed.tar.gz" | ||
|
||
jobs: | ||
tests: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: cachix/install-nix-action@v27 | ||
with: | ||
nix_path: nixpkgs=${{ env.NIXPKGS}} | ||
|
||
# Use the cachix cache for faster builds. | ||
- name: Cachix Init | ||
uses: cachix/cachix-action@v15 | ||
with: | ||
name: digitallyinduced | ||
skipPush: true | ||
|
||
# Install direnv, which also `direnv allow`s the project. | ||
- uses: HatsuneMiku3939/[email protected] | ||
with: | ||
direnvVersion: 2.32.3 | ||
|
||
- name: Run project and tests | ||
run: | | ||
# @see https://github.com/actions/runner-images/issues/2840#issuecomment-1284059930 | ||
# IHP - NixOS requires a lots of disk space. | ||
# Larger projects could easily run into unexpected failures. | ||
sudo rm -rf /usr/share/dotnet | ||
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | ||
# Build generated files. | ||
nix-shell --run "make build/Generated/Types.hs" | ||
# Start the project in the background. | ||
nix-shell --run "devenv up &" | ||
# Execute the tests. | ||
nix-shell --run "runghc $(make print-ghc-extensions) -i. -ibuild -iConfig Test/Main.hs" | ||
deploy: | ||
name: Deploy | ||
needs: tests | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup SSH | ||
run: | | ||
mkdir -p ~/.ssh | ||
echo "${{ env.SSH_KEY }}" > ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
ssh-keyscan -H ${{ env.SSH_HOST }} >> ~/.ssh/known_hosts | ||
echo -e "Host ${{ env.PROJECT_NAME}}-${{ env.ENV }}\n HostName ${{ env.SSH_HOST }}\n User ${{ env.SSH_USER }}\n IdentityFile ~/.ssh/id_rsa" > ~/.ssh/config | ||
chmod 600 ~/.ssh/config | ||
- uses: cachix/install-nix-action@v20 | ||
with: | ||
nix_path: nixpkgs=${{ env.NIXPKGS}} | ||
|
||
- name: Cachix Init | ||
uses: cachix/cachix-action@v12 | ||
with: | ||
name: digitallyinduced | ||
skipPush: true | ||
|
||
- uses: HatsuneMiku3939/direnv-action@v1 | ||
with: | ||
direnvVersion: 2.32.3 | ||
|
||
- name: Deploy | ||
run: | | ||
deploy-to-nixos ${{ env.PROJECT_NAME}}-${{ env.ENV }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.DS_Store | ||
.idea | ||
.env | ||
tmp | ||
result | ||
node_modules | ||
bin | ||
*.iml | ||
Generated | ||
dist | ||
dist-newstyle | ||
*.dyn_hi | ||
*.dyn_o | ||
*.hi | ||
*.o | ||
build | ||
gen | ||
del | ||
static/prod.* | ||
Config/client_session_key.aes | ||
|
||
# Ignore locally checked out IHP version | ||
IHP | ||
|
||
# devenv.sh | ||
.devenv* | ||
devenv.local.nix | ||
.direnv |
Oops, something went wrong.