Skip to content

Commit

Permalink
Added tests & docs
Browse files Browse the repository at this point in the history
  • Loading branch information
htngr committed May 4, 2024
1 parent d9c337b commit d018f35
Show file tree
Hide file tree
Showing 67 changed files with 11,709 additions and 1,024 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

94 changes: 94 additions & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: build-windows
on:
push:
tags:
- "v*.*.*"

permissions:
contents: read

jobs:
nix-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: cachix/cachix-action@v14
with:
name: nixos-devenv
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: |
nix build .#windows -L
cp result/bin/*.exe .
nix build .#store-wsl.config.build.tarball -L
cp result store.tar.gz
nix build .#machine-wsl.config.build.tarball -L
cp result machine.tar.gz
- uses: actions/upload-artifact@v4
with:
name: windows
path: |
*.exe
*.tar.gz
overwrite: true
if-no-files-found: error
windows:
runs-on: windows-latest
needs:
- nix-build
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
repository: 'aformatik/codchi-packaging'
ref: '${{ github.ref_name }}'
- uses: actions/download-artifact@v4
with:
name: windows
path: msix
- shell: bash
run: |
mkdir -p "msix/VFS/Common AppData/codchi/"
mv msix/store.tar.gz msix/machine.tar.gz "msix/VFS/Common AppData/codchi/"
- name: Parse Windows Version
uses: frabert/replace-string-action@v2
id: winver
with:
string: '${{ github.ref_name }}'
pattern: '^v(\d+).(\d+).(\d+)-?.*$'
replace-with: '$1.$2.$3.0'
- name: Insert version ${{ github.ref_name }} / ${{ steps.winver.outputs.replaced }}
env:
VERSION: ${{ github.ref_name }}
WINVER: ${{ steps.winver.outputs.replaced }}
shell: bash
run: |
for f in msix/{codchi.AppInstaller,AppxManifest.xml}; do
sed -i \
"s/@VERSION@/$WINVER/g
s/@VERSION_TAG@/$VERSION/g" \
$f
done
- run: |
& "${env:ProgramFiles(x86)}\Windows Kits\10\App Certification Kit\makeappx.exe" pack /o /d .\msix\ /p codchi.msix
- name: Azure Trusted Signing
uses: azure/trusted-signing-action@v0.3.16
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
endpoint: ${{ secrets.AZURE_ENDPOINT }}
code-signing-account-name: ${{ secrets.AZURE_CODE_SIGNING_NAME }}
certificate-profile-name: ${{ secrets.AZURE_CERT_PROFILE_NAME }}
files-folder: .
files-folder-filter: msix
file-digest: SHA256
- uses: softprops/action-gh-release@v2
with:
prerelease: true
fail_on_unmatched_files: true
files: |
codchi.msix
msix/codchi.AppInstaller
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
with:
name: nixos-devenv
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build .#checks.x86_64-linux.populate-cache
- run: nix build .#checks.x86_64-linux.populate-cache -L
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: website

on:
push:
paths:
- 'docs/website/**'
branches:
- 'master'

permissions:
contents: write
Expand All @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs/website
working-directory: docs
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
Expand All @@ -24,8 +24,8 @@ jobs:
with:
name: nixos-devenv
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build
- run: nix build -L
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/website/result/
folder: docs/result/
73 changes: 73 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: test
on:
workflow_run:
workflows: [build-windows]
types: [completed]
# pull_request:
# branches:
# - 'rust'
# workflow_dispatch: {}

# paths:
# - 'cli/**'

permissions:
contents: read

jobs:
setup:
runs-on: ubuntu-latest
outputs:
latest_version: ${{ steps.get-latest-version.outputs.latest_version }}
steps:
- uses: actions/checkout@v4
- name: Get latest versioned commit ${{ github.event.workflow_run.name }}
id: get-latest-version
run: |
# Fetch all the tags
git fetch --tags
# Get the latest commit matching the pattern 'v*.*.*'
echo "latest_version=$(git describe --tags --match "v*.*.*" $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT
windows:
needs: setup
if: ${{ github.event.workflow_run.name == 'build-windows' || github.event_name == 'push' }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Download assets from prerelease@${{ needs.setup.outputs.latest_version }}
uses: robinraju/release-downloader@v1.9
with:
tag: ${{ needs.setup.outputs.latest_version }}
- name: Install codchi.msix
run: |
Install-Module Pester -Force
Import-Module Pester -PassThru
Import-Module appx -UseWindowsPowerShell 2>&1
Add-AppxPackage codchi.msix -AllowUnsigned 2>&1
wsl --update --web-download 2>&1
wsl --set-default-version 2 2>&1
Invoke-Pester ./tests/windows.ps1 2>&1
# - if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 10
linux:
needs: setup
if: ${{ github.event.workflow_run.name == 'build-linux' || github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: canonical/setup-lxd@main
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Download assets from prerelease@${{ needs.setup.outputs.latest_version }}
uses: robinraju/release-downloader@v1.9
with:
tag: ${{ needs.setup.outputs.latest_version }}
- name: tests
run: |
cd codchi
nix develop . -c cargo run -- -vvv
# - if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 15
68 changes: 0 additions & 68 deletions .github/workflows/tests.yml.disabled

This file was deleted.

Loading

0 comments on commit d018f35

Please sign in to comment.