-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add CI for compiling and formatting #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
halfcyan
wants to merge
7
commits into
Ultramarine-Linux:master
Choose a base branch
from
halfcyan:cypress/build-ci
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
92421af
feat: add CI for compiling and formatting
halfcyan 1dd48d4
lmao
halfcyan a19c756
fix artifact name and install test deps
halfcyan 6bdf4f6
hmm
halfcyan 77d8fe7
maybe?
halfcyan 3efaf31
please work this time lmao
halfcyan 19cca77
add dependabot for actions
halfcyan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,8 @@ | ||
| version: 2 | ||
| updates: | ||
| # Maintain GitHub Actions | ||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
| open-pull-requests-limit: 5 |
This file contains hidden or 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,105 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| RELEASEVER: "44" | ||
|
|
||
| jobs: | ||
| format: | ||
| name: Check Nim formatting | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Install Nim | ||
| uses: jiro4989/setup-nim-action@cb1fc1270b117457dd0d9f610ec981fad3369cec # v2.3.0 | ||
| with: | ||
| nim-version: "2.2.10" | ||
|
|
||
| - name: Check formatting | ||
| run: ./scripts/check-format.sh | ||
|
|
||
| build: | ||
| name: Build application | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Install system dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install --no-install-recommends -y \ | ||
| libadwaita-1-dev \ | ||
| libgtk-4-dev \ | ||
| pkg-config | ||
|
|
||
| - name: Install Nim | ||
| uses: jiro4989/setup-nim-action@cb1fc1270b117457dd0d9f610ec981fad3369cec # v2.3.0 | ||
| with: | ||
| nim-version: "2.2.10" | ||
|
|
||
| - name: Build | ||
| run: nimble build --define:releasever=${RELEASEVER} --verbose | ||
|
|
||
| - name: Prepare build artifact | ||
| run: | | ||
| if [[ ! -x ./umswitch ]]; then | ||
| candidate=$(find . "$HOME/.nimble/bin" \ | ||
| -type f -name umswitch -not -path './umswitch' \ | ||
| -print -quit 2>/dev/null || true) | ||
| if [[ -z "$candidate" ]]; then | ||
| echo "umswitch binary was not produced. Build outputs:" >&2 | ||
| find . "$HOME/.nimble/bin" -maxdepth 4 -type f -print 2>/dev/null | sort >&2 | ||
| exit 1 | ||
| fi | ||
| cp "$candidate" ./umswitch | ||
| fi | ||
| test -x ./umswitch | ||
| file ./umswitch | ||
|
|
||
| - name: Upload binary | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: umswitch | ||
| path: umswitch | ||
| if-no-files-found: error | ||
|
|
||
| test: | ||
| name: Compile tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Install Nim | ||
| uses: jiro4989/setup-nim-action@cb1fc1270b117457dd0d9f610ec981fad3369cec # v2.3.0 | ||
| with: | ||
| nim-version: "2.2.10" | ||
|
|
||
| - name: Install test dependencies | ||
| run: | | ||
| mkdir -p /tmp/hop-test-deps | ||
| printf 'version = "0.0.1"\nauthor = "CI"\ndescription = "CI test dependencies"\nlicense = "MIT"\nrequires "fungus == 0.1.19"\n' > /tmp/hop-test-deps/testdeps.nimble | ||
| cd /tmp/hop-test-deps | ||
| nimble install -y | ||
|
|
||
| - name: Compile test program | ||
| run: | | ||
| nim c --hints:off \ | ||
| --path:$HOME/.nimble/pkgs2/fungus-* \ | ||
| --path:$HOME/.nimble/pkgs2/micros-* \ | ||
| test.nim | ||
This file contains hidden or 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,23 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| repo_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) | ||
| tmp_dir=$(mktemp -d) | ||
| trap 'rm -rf "$tmp_dir"' EXIT | ||
|
|
||
| status=0 | ||
| while IFS= read -r -d '' file; do | ||
| formatted="$tmp_dir/$(basename "$file")" | ||
| nimpretty --out:"$formatted" "$repo_root/$file" >/dev/null | ||
| nimpretty "$formatted" >/dev/null | ||
| if ! diff -u "$repo_root/$file" "$formatted"; then | ||
| status=1 | ||
| fi | ||
| done < <(git -C "$repo_root" ls-files -z -- '*.nim') | ||
|
|
||
| if [[ "$status" -ne 0 ]]; then | ||
| echo "Formatting check failed. Run nimpretty on the files above." >&2 | ||
| exit "$status" | ||
| fi | ||
|
|
||
| echo "All Nim files are formatted." |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this