Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 33 additions & 43 deletions .github/workflows/manual-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ on:
required: true
type: choice
options:
- alpha # Increase the alpha pre-version (x.y.z-alpha.M)
- beta # Increase the beta pre-version (x.y.z-beta.M)
- patch # Increase the patch version (x.y.z)
- minor # Increase the minor version (x.y.0)
- major # Increase the major version (x.0.0)
- alpha # Increase the alpha pre-version (x.y.z-alpha.M)
- beta # Increase the beta pre-version (x.y.z-beta.M)
- patch # Increase the patch version (x.y.z)
- minor # Increase the minor version (x.y.0)
- major # Increase the major version (x.0.0)
- release # Remove the pre-version, ie remove alpha/beta/rc (x.y.z)
- rc # Increase the rc pre-version (x.y.z-rc.M)

- rc # Increase the rc pre-version (x.y.z-rc.M)
jobs:
release:
runs-on: ubuntu-latest
Expand All @@ -26,71 +25,62 @@ jobs:
fetch-depth: 0
submodules: recursive
ssh-key: ${{ secrets.PUBLISHER_SSH_KEY }}

- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2

- uses: nixbuild/nix-quick-install-action@v30
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
gc-max-store-size-linux: 1G
- name: Install NodeJS v22
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'

- run: nix develop -c rainix-rs-prelude

- name: Run rainix-rs-test
run: nix develop -c rainix-rs-test

run: nix develop -c cargo test
- name: Build JS Bindings
run: nix develop -c build-js-bindings

run: nix develop -c build-js-bindings
- name: Run JS Tests
run: nix develop -c test-js-bindings

run: nix develop -c test-js-bindings
- name: Git Config
run: |
git config --global user.email "${{ secrets.CI_GIT_EMAIL }}"
git config --global user.name "${{ secrets.CI_GIT_USER }}"

- name: Publish to crates.io
run: nix develop -c cargo release --no-confirm --execute --no-tag --workspace ${{ inputs.version-level }}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

# set npm version to rust crate version
- name: Set Version
run: echo "NEW_VERSION=$(nix develop -c npm version $(node ./scripts/version.js) --no-git-tag-version)" >> $GITHUB_ENV

# Commit changes and tag
- name: Commit And Tag
run: |
git add "package.json"
git add "package-lock.json"
git commit -m "Release ${{ env.NEW_VERSION }}"
git tag ${{ env.NEW_VERSION }}

# Push the commit to remote
- name: Push Changes To Remote
run: |
git push origin
git push -u origin ${{ env.NEW_VERSION }}
run: "git push origin \ngit push -u origin ${{ env.NEW_VERSION }}\n"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Create npm package tarball to put in release files
- name: Create NPM Package Tarball
run: echo "NPM_PACKAGE=$(nix develop -c npm pack --silent)" >> $GITHUB_ENV

- name: Rename NPM Package Tarball
run: mv ${{ env.NPM_PACKAGE }} dotrain_npm_package_${{ env.NEW_VERSION }}.tgz

# publish to npm
- name: Publish To NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
access: public

# Create gitHub release with npm tarball
- name: Create GitHub Release
id: gh_release
Expand All @@ -101,16 +91,14 @@ jobs:
files: dotrain_npm_package_${{ env.NEW_VERSION }}.tgz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


release_bin:
name: Release dotrain cli ${{ matrix.platform }}_${{ matrix.arch }} bin
needs: release
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
include:
- runner: ubuntu-22.04
target: x86_64-unknown-linux-gnu
platform: linux
Expand All @@ -127,30 +115,32 @@ jobs:
target: aarch64-apple-darwin
platform: darwin
arch: arm64

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
ssh-key: ${{ secrets.PUBLISHER_SSH_KEY }}

- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2

- uses: nixbuild/nix-quick-install-action@v30
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
gc-max-store-size-linux: 1G
- name: Git Config
run: |
git config --global user.email "${{ secrets.CI_GIT_EMAIL }}"
git config --global user.name "${{ secrets.CI_GIT_USER }}"

- name: Pull Release Commit
run: git pull origin

- name: Build Bin
run: nix develop -c cargo build -r --features cli --bin dotrain --target "${{ matrix.target }}"

- run: cp ./target/${{ matrix.target }}/release/dotrain ./dotrain_cli_${{ needs.release.outputs.version }}_${{ matrix.platform }}_${{ matrix.arch }}

- name: Add Bin To Release
uses: softprops/action-gh-release@v2
with:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pr-assessment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
pull_request:
types:
- closed

jobs:
assess-pr-size-on-merge:
uses: rainlanguage/github-chore/.github/workflows/pr-assessment.yml@main
Expand Down
53 changes: 20 additions & 33 deletions .github/workflows/rainix.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,25 @@
name: Rainix CI
name: rainix-rs
on: [push]

jobs:
rainix:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
task: [rainix-rs-test, rainix-rs-artifacts]
include:
# We don't need to do rust static analysis on multiple platforms
- os: ubuntu-latest
task: rainix-rs-static
fail-fast: false
runs-on: ${{ matrix.os }}

static:
uses: rainlanguage/rainix/.github/workflows/rainix-rs-static.yaml@main
test:
uses: rainlanguage/rainix/.github/workflows/rainix-rs-test.yaml@main
js-bindings:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v30
with:
submodules: recursive
fetch-depth: 0

- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2

- run: nix develop -c rainix-rs-prelude

- name: Run ${{ matrix.task }}
run: nix develop -c ${{ matrix.task }}

- name: Build JS Bindings
run: nix develop -c build-js-bindings

- name: Run JS Tests
run: nix develop -c test-js-bindings

- name: Test JS Doc Generation
run: nix develop -c js-bindings-docs
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
gc-max-store-size-linux: 1G
- run: nix develop -c build-js-bindings
- run: nix develop -c test-js-bindings
- run: nix develop -c js-bindings-docs
2 changes: 1 addition & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ reorder_imports = false
reorder_modules = false
# group_imports = "StdExternalCrate"
# imports_layout = "HorizontalVertical"
# unstable_features = true
# unstable_features = true
Loading
Loading