Skip to content

Commit cdbbbdb

Browse files
committed
Added github workflows. Needs refinements
1 parent c78421b commit cdbbbdb

2 files changed

Lines changed: 201 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
- staging
6+
- develop
7+
8+
name: Continuous integration
9+
10+
jobs:
11+
build:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [windows-latest, macos-latest, ubuntu-latest]
16+
rust:
17+
- stable
18+
- beta
19+
- nightly
20+
fail-fast: false
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
25+
- name: Install Rust toolchain
26+
uses: actions-rs/toolchain@v1
27+
with:
28+
profile: minimal
29+
toolchain: ${{ matrix.rust }}
30+
override: true
31+
components: rustfmt, clippy
32+
33+
- name: Cargo build
34+
uses: actions-rs/cargo@v1
35+
with:
36+
command: build
37+
args: --release --all
38+
39+
- name: Upload Artifact (Linux/MacOS)
40+
uses: actions/upload-artifact@v1
41+
if: matrix.rust == 'stable' && matrix.os != 'windows-latest'
42+
with:
43+
name: juno-${{matrix.os}}
44+
path: target/release/juno
45+
46+
- name: Upload Artifact (Windows)
47+
uses: actions/upload-artifact@v1
48+
if: matrix.rust == 'stable' && matrix.os == 'windows-latest'
49+
with:
50+
name: juno-${{matrix.os}}
51+
path: target/release/juno.exe
52+
53+
release-master: # Publish release on push to master
54+
if: github.ref == 'refs/heads/master'
55+
runs-on: ubuntu-latest
56+
needs: build
57+
steps:
58+
- uses: actions/checkout@v2
59+
- run: git fetch --all --tags
60+
61+
- name: Check Release Version
62+
uses: thebongy/version-check@v1
63+
with:
64+
file: Cargo.toml
65+
tagFormat: v${version}
66+
id: version_check
67+
68+
- name: Download Windows Artifact
69+
uses: actions/download-artifact@v1
70+
with:
71+
name: juno-windows-latest
72+
path: release/windows
73+
74+
- name: Download MacOS Artifact
75+
uses: actions/download-artifact@v1
76+
with:
77+
name: juno-macos-latest
78+
path: release/macos
79+
80+
- name: Download Linux Artifact
81+
uses: actions/download-artifact@v1
82+
with:
83+
name: juno-ubuntu-latest
84+
path: release/linux
85+
86+
- name: Rename Artifacts
87+
run: |
88+
mv release/windows/juno.exe release/windows/juno-${{steps.version_check.outputs.releaseVersion}}-windows.exe
89+
mv release/macos/juno release/macos/juno-${{steps.version_check.outputs.releaseVersion}}-macos
90+
mv release/linux/juno release/linux/juno-${{steps.version_check.outputs.releaseVersion}}-linux
91+
92+
- name: Publish Release
93+
uses: softprops/action-gh-release@v1
94+
with:
95+
files: release/**/*
96+
tag_name: ${{steps.version_check.outputs.releaseVersion}}
97+
prerelease: false
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100+
101+
102+
release-staging:
103+
if: github.ref == 'refs/heads/staging'
104+
runs-on: ubuntu-latest
105+
needs: build
106+
steps:
107+
- uses: actions/checkout@v2
108+
- run: git fetch --all --tags
109+
110+
- name: Check Release Version
111+
uses: thebongy/version-check@v1
112+
with:
113+
file: Cargo.toml
114+
tagFormat: v${version}-beta
115+
id: version_check
116+
117+
- name: Download Windows Artifact
118+
uses: actions/download-artifact@v1
119+
with:
120+
name: juno-windows-latest
121+
path: release/windows
122+
123+
- name: Download MacOS Artifact
124+
uses: actions/download-artifact@v1
125+
with:
126+
name: juno-macos-latest
127+
path: release/macos
128+
129+
- name: Download Linux Artifact
130+
uses: actions/download-artifact@v1
131+
with:
132+
name: juno-ubuntu-latest
133+
path: release/linux
134+
135+
- name: Rename Artifacts
136+
run: |
137+
mv release/windows/juno.exe release/windows/juno-${{steps.version_check.outputs.releaseVersion}}-windows.exe
138+
mv release/macos/juno release/macos/juno-${{steps.version_check.outputs.releaseVersion}}-macos
139+
mv release/linux/juno release/linux/juno-${{steps.version_check.outputs.releaseVersion}}-linux
140+
141+
- name: Publish Release
142+
uses: softprops/action-gh-release@v1
143+
with:
144+
files: release/**/*
145+
tag_name: ${{steps.version_check.outputs.releaseVersion}}
146+
prerelease: true
147+
env:
148+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
149+

.github/workflows/pr.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- master
5+
- staging
6+
- develop
7+
name: Continuous integration (PR)
8+
jobs:
9+
version-check:
10+
if: github.base_ref == 'staging' || github.base_ref == 'master'
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- run: git fetch --all --tags
16+
17+
- name: Check Release Version (staging)
18+
if: github.base_ref == 'staging'
19+
uses: thebongy/version-check@v1
20+
with:
21+
file: package.json
22+
tagFormat: v${version}-beta
23+
id: version_check_staging
24+
25+
- name: Check Release Version (master)
26+
if: github.base_ref == 'master'
27+
uses: thebongy/version-check@v1
28+
with:
29+
file: package.json
30+
tagFormat: v${version}
31+
id: version_check_master
32+
build:
33+
runs-on: ${{ matrix.os }}
34+
strategy:
35+
matrix:
36+
os: [windows-latest, macos-latest, ubuntu-latest]
37+
node:
38+
- stable
39+
- lts
40+
fail-fast: false
41+
steps:
42+
- uses: actions/checkout@v2
43+
44+
- name: Install dependencies
45+
uses: actions-rs/cargo@v1
46+
with:
47+
command: npm ci
48+
49+
- name: Publish to npm
50+
uses: actions-rs/cargo@v1
51+
with:
52+
command: npm publish

0 commit comments

Comments
 (0)