Skip to content

Commit 017a9de

Browse files
ci: simplify actions
1 parent f30f4fd commit 017a9de

File tree

5 files changed

+91
-50
lines changed

5 files changed

+91
-50
lines changed

.github/actions/setup/action.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Setup MoonBit"
2+
description: "Setup MoonBit CLI in your GitHub Actions workflow"
3+
inputs:
4+
version:
5+
description: "The version of MoonBit CLI to install (default: latest). Other option: nightly"
6+
required: false
7+
default: "latest"
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Install MoonBit CLI on *nix
12+
if: runner.os != 'Windows'
13+
shell: bash
14+
run: |
15+
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash -s "${{ inputs.version }}"
16+
echo "$HOME/.moon/bin" >> $GITHUB_PATH
17+
18+
- name: Install MoonBit CLI on Windows
19+
if: runner.os == 'Windows'
20+
shell: powershell
21+
env:
22+
MOONBIT_INSTALL_VERSION: ${{ inputs.version }}
23+
run: |
24+
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser; irm https://cli.moonbitlang.com/install/powershell.ps1 | iex
25+
"C:\Users\runneradmin\.moon\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
26+
27+
- name: Verify installation
28+
shell: bash
29+
run: |
30+
moon version --all
31+
32+
- name: Update Registry
33+
shell: bash
34+
run: |
35+
moon update

.github/workflows/check.yml

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,38 +15,19 @@ jobs:
1515
strategy:
1616
matrix:
1717
os:
18-
- name: ubuntu-latest
19-
path: ubuntu_x86_64
20-
- name: macos-latest
21-
path: mac_intel
22-
- name: macos-14
23-
path: mac_m1
24-
- name: windows-latest
18+
- ubuntu-latest
19+
- macos-latest
20+
- windows-latest
2521
backend: [wasm, wasm-gc, js]
26-
runs-on: ${{ matrix.os.name }}
27-
continue-on-error: ${{ matrix.os.name == 'macos-14' }}
22+
runs-on: ${{ matrix.os }}
2823
steps:
2924
- uses: actions/checkout@v4
3025

3126
- name: install
32-
if: ${{ matrix.os.name != 'windows-latest' }}
33-
run: |
34-
/bin/bash -c "$(curl -fsSL https://cli.moonbitlang.com/install/unix.sh)"
35-
echo "$HOME/.moon/bin" >> $GITHUB_PATH
36-
37-
- name: install on windows
38-
if: ${{ matrix.os.name == 'windows-latest' }}
39-
run: |
40-
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser; irm https://cli.moonbitlang.com/install/powershell.ps1 | iex
41-
"C:\Users\runneradmin\.moon\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
42-
43-
- name: moon version
44-
run: |
45-
moon version --all
46-
moonrun --version
27+
uses: ./.github/actions/setup
4728

4829
- name: moon check and test
49-
if: ${{ matrix.os.name != 'windows-latest' }}
30+
if: ${{ runner.os != 'Windows' }}
5031
run: |
5132
moon update
5233
failed_directories=()
@@ -72,13 +53,13 @@ jobs:
7253
fi
7354
7455
- name: check result size
75-
if: ${{ matrix.os.name != 'windows-latest' }}
56+
if: ${{ runner.os != 'Windows' }}
7657
run: |
7758
find ./target -name '*.wasm' | xargs ls -lh
7859
find ./target -name '*.js' | xargs ls -lh
7960
8061
- name: moon check and test on windows
81-
if: ${{ matrix.os.name == 'windows-latest' }}
62+
if: ${{ runner.os == 'Windows' }}
8263
run: |
8364
moon update
8465
$failed_directories = @()
@@ -103,7 +84,7 @@ jobs:
10384
}
10485
10586
- name: check result size on windows
106-
if: ${{ matrix.os.name == 'windows-latest' }}
87+
if: ${{ runner.os == 'Windows' }}
10788
run: |
10889
Get-ChildItem -Path ".\target" -Recurse -Filter "*.wasm" | ForEach-Object { "{0} ({1} bytes)" -f $_.FullName, $_.Length }
10990
Get-ChildItem -Path ".\target" -Recurse -Filter "*.js" | ForEach-Object { "{0} ({1} bytes)" -f $_.FullName, $_.Length }
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Reference: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment
2+
name: "Copilot Setup Steps"
3+
4+
# Automatically run the setup steps when they are changed to allow for easy validation, and
5+
# allow manual testing through the repository's "Actions" tab
6+
on:
7+
workflow_dispatch:
8+
push:
9+
paths:
10+
- .github/workflows/copilot-setup-steps.yml
11+
pull_request:
12+
paths:
13+
- .github/workflows/copilot-setup-steps.yml
14+
15+
jobs:
16+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
17+
copilot-setup-steps:
18+
runs-on: ubuntu-latest
19+
20+
# Set the permissions to the lowest permissions possible needed for your steps.
21+
# Copilot will be given its own token for its operations.
22+
permissions:
23+
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
24+
contents: read
25+
26+
# You can define any steps you want, and they will run before the agent starts.
27+
# If you do not check out your code, Copilot will do this for you.
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v5
31+
32+
- name: Set up MoonBit
33+
run: |
34+
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
35+
echo "$HOME/.moon/bin" >> $GITHUB_PATH
36+
37+
- name: Update MoonBit dependencies
38+
run: |
39+
moon version --all
40+
moon update
41+

.github/workflows/next-check.yml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,16 @@ jobs:
1515
strategy:
1616
matrix:
1717
os:
18-
- name: ubuntu-latest
19-
- name: macos-latest
20-
- name: macos-14
21-
- name: windows-latest
18+
- ubuntu-latest
19+
- macos-latest
20+
- windows-latest
2221
backend: [wasm, wasm-gc, js]
23-
runs-on: ${{ matrix.os.name }}
24-
continue-on-error: ${{ matrix.os.name == 'macos-14' }}
22+
runs-on: ${{ matrix.os }}
2523
steps:
2624
- uses: actions/checkout@v4
2725

2826
- name: install
29-
if: ${{ matrix.os.name != 'windows-latest' }}
30-
run: |
31-
/bin/bash -c "$(curl -fsSL https://cli.moonbitlang.com/install/unix.sh)"
32-
echo "$HOME/.moon/bin" >> $GITHUB_PATH
33-
34-
- name: install on windows
35-
if: ${{ matrix.os.name == 'windows-latest' }}
36-
run: |
37-
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser; irm https://cli.moonbitlang.com/install/powershell.ps1 | iex
38-
"C:\Users\runneradmin\.moon\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
39-
40-
- name: moon version
41-
run: |
42-
moon version --all
43-
moonrun --version
27+
uses: ./.github/actions/setup
4428

4529
- name: Set up Python
4630
uses: actions/setup-python@v4

.github/workflows/tour-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: check language tour
22

33
on:
44
pull_request:
5-
branches: main
5+
branches: ['main']
66

77
jobs:
88
check:

0 commit comments

Comments
 (0)