Skip to content

Commit

Permalink
open source
Browse files Browse the repository at this point in the history
moon was originally developed starting in May 2023 at the International Digital
Economy Academy. This commit cleans up the history and squashes it into one
commit in preparation for open-sourcing.

Co-authored-by: Rynco Maekawa <[email protected]>
Co-authored-by: Young-Flash <[email protected]>
  • Loading branch information
3 people committed Jul 23, 2024
0 parents commit 3144551
Show file tree
Hide file tree
Showing 880 changed files with 27,823 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
xtask = "run --package xtask --"
121 changes: 121 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: CD

on:
workflow_dispatch:
push:
branches:
- main

jobs:
build:
strategy:
matrix:
os: [macos-latest, macos-13, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
- name: Cargo cache
uses: actions/cache@v4
with:
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
path: ~/.cargo/registry
- name: Build
run: cargo build --release

- name: Setup Rclone
uses: AnimMouse/setup-rclone@v1
with:
rclone_config: ${{ secrets.RCLONE_CONFIG }}

- name: Upload(Unix)
if: ${{ matrix.os != 'windows-latest' }}
run: |
version=$(echo "$GITHUB_SHA" | cut -c 1-9)
rclone copy target/release/moon "aws:${{ secrets.AWS_BUCKET_NAME }}/bleeding-moon/$version/$(uname -s)-$(uname -m)/"
mkdir tmp && cp target/release/moon tmp/moon
rclone copy tmp/ "aliyun:${{ secrets.ALIYUN_BUCKET_NAME }}/bleeding-moon/$version/$(uname -s)-$(uname -m)/"
- name: Upload(Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
$version = "$env:GITHUB_SHA".Substring(0, 9)
rclone copyto -L .\target\release\moon.exe "aws:${{ secrets.AWS_BUCKET_NAME }}/bleeding-moon/$version/Windows-x86_64/moon.exe"
- name: Checkout moonc-version (macos-latest)
if: ${{ matrix.os == 'macos-latest' }}
uses: actions/checkout@v4
with:
ref: moonc-version-dont-delete
path: moonc-version-dont-delete

- name: Copy moonc-version file to workspace (macos-latest)
if: ${{ matrix.os == 'macos-latest' }}
run: |
cp moonc-version-dont-delete/moonc-version .
- name: Bleeding Release (macos-latest)
if: ${{ matrix.os == 'macos-latest' }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
run: |
rm -rf tmp-bins
mkdir tmp-bins
mooncVersion=$(cat moonc-version | cut -c 1-9)
rclone copy "aws:${{ secrets.AWS_BUCKET_NAME }}/bleeding-moonc/$mooncVersion/$(uname -s)-$(uname -m)/" ./tmp-bins/
moonrunVersion=4bb74ba5f
rclone copy "aws:${{ secrets.AWS_BUCKET_NAME }}/bleeding-moonrun/$moonrunVersion/$(uname -s)-$(uname -m)/moonrun" ./tmp-bins/
cp -L ./target/release/moon ./tmp-bins/
pushd tmp-bins && shasum -a 256 -- * >../moonbit-darwin-aarch64.sha256 && popd
tar czf ./moonbit-darwin-aarch64.tar.gz --directory=./tmp-bins .
aws s3 cp ./moonbit-darwin-aarch64.tar.gz s3://cli.moonbitlang.com/binaries/bleeding/moonbit-darwin-aarch64.tar.gz
aws s3 cp ./moonbit-darwin-aarch64.sha256 s3://cli.moonbitlang.com/binaries/bleeding/moonbit-darwin-aarch64.sha256
aws cloudfront create-invalidation --distribution-id E1KQYZEVEB0TAY --paths "/*"
ubuntu-build:
runs-on: ubuntu-latest
container:
image: ubuntu:16.04
steps:
- name: Install dependencies
run: |
apt update && apt install -y software-properties-common curl unzip build-essential git
- name: Checkout
run: |
git clone --depth 1 "https://${{ secrets.MOON_CLONE_PAT }}@github.com/moonbitlang/moon.git" "$GITHUB_WORKSPACE"
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf "https://sh.rustup.rs" | sh -s -- -y
echo ~/.cargo/bin >> $GITHUB_PATH
- name: Rust Version
run: |
cargo version
rustc --version
- run: |
git config --global --add safe.directory "$(pwd)"
git status
- name: Build
run: cargo build --release

- name: Setup Rclone
env:
RCLONE_CONFIG_PLAIN: ${{ secrets.RCLONE_CONFIG_PLAIN }}
run: |
curl https://rclone.org/install.sh | bash
mkdir -p ~/.config/rclone
echo "$RCLONE_CONFIG_PLAIN" > ~/.config/rclone/rclone.conf
- name: Upload
run: |
version="$(echo "$GITHUB_SHA" | cut -c 1-9)"
echo "$version"
rclone copy target/release/moon "aws:${{ secrets.AWS_BUCKET_NAME }}/bleeding-moon/$version/$(uname -s)-$(uname -m)/"
mkdir tmp && cp target/release/moon tmp/moon
rclone copy tmp/ "aliyun:${{ secrets.ALIYUN_BUCKET_NAME }}/bleeding-moon/$version/$(uname -s)-$(uname -m)/"
35 changes: 35 additions & 0 deletions .github/workflows/check-merge-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check for Merge Commits

on:
pull_request:
branches: main

jobs:
check-merge-commit:
runs-on: ubuntu-latest

steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Get all commit messages
id: get-commit-messages
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;
const commits = await github.rest.pulls.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
per_page: 100
});
const commitMessages = commits.data.map(commit => commit.commit.message);
const hasMergeCommit = commitMessages.some(message => message.startsWith('Merge branch') || message.startsWith('Merge pull request'));
if (hasMergeCommit) {
core.setFailed('Pull request contains merge commit(s).');
}
- name: Check for merge commits
if: failure()
run: echo "This pull request contains merge commit(s) and has been marked as failed."
Loading

0 comments on commit 3144551

Please sign in to comment.