Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 9613c55

Browse files
Enhanced GitHub Actions
1 parent 6a4a747 commit 9613c55

File tree

9 files changed

+233
-52
lines changed

9 files changed

+233
-52
lines changed

.github/workflows/ci.yaml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
9+
env:
10+
IMAGE_NAME: crypticcp/frontend
11+
DOCKER_PLATFORMS: linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
12+
13+
jobs:
14+
15+
lint:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- uses: actions/setup-node@v2
22+
with:
23+
node-version: 14
24+
25+
- uses: actions/cache@v2
26+
with:
27+
path: ~/.npm
28+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
29+
restore-keys: |
30+
${{ runner.os }}-node-
31+
32+
- run: npm ci
33+
34+
- run: npm run lint
35+
36+
test:
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- uses: actions/checkout@v2
41+
42+
- uses: actions/setup-node@v2
43+
with:
44+
node-version: 14
45+
46+
- uses: actions/cache@v2
47+
with:
48+
path: ~/.npm
49+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
50+
restore-keys: |
51+
${{ runner.os }}-node-
52+
53+
- run: npm ci
54+
55+
- run: npm run test -- --no-watch --no-progress --browsers=ChromeHeadless
56+
57+
build:
58+
needs: [ lint, test ]
59+
runs-on: ubuntu-latest
60+
61+
steps:
62+
- uses: actions/checkout@v2
63+
64+
- uses: actions/setup-node@v2
65+
with:
66+
node-version: 14
67+
68+
- uses: actions/cache@v2
69+
with:
70+
path: ~/.npm
71+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
72+
restore-keys: |
73+
${{ runner.os }}-node-
74+
75+
- run: npm ci
76+
77+
- run: npm run build:ci -- --output-path=./dist
78+
79+
- uses: actions/upload-artifact@v2
80+
with:
81+
name: frontend
82+
path: dist
83+
84+
docker:
85+
needs: build
86+
runs-on: ubuntu-latest
87+
88+
steps:
89+
- uses: actions/checkout@v2
90+
91+
- name: Docker meta
92+
id: docker_meta
93+
uses: crazy-max/ghaction-docker-meta@v1
94+
with:
95+
tag-edge: true
96+
images: |
97+
${{ env.IMAGE_NAME }}
98+
tag-semver: |
99+
{{version}}
100+
{{major}}.{{minor}}
101+
102+
- uses: docker/setup-qemu-action@v1
103+
- uses: docker/setup-buildx-action@v1
104+
105+
- name: Cache Docker layers
106+
uses: actions/cache@v2
107+
with:
108+
path: /tmp/.buildx-cache
109+
key: ${{ runner.os }}-buildx-${{ github.sha }}
110+
restore-keys: |
111+
${{ runner.os }}-buildx-
112+
113+
- name: Login to Docker Hub
114+
uses: docker/login-action@v1
115+
with:
116+
username: ${{ secrets.DOCKERHUB_USERNAME }}
117+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
118+
119+
- uses: actions/download-artifact@v2
120+
with:
121+
name: frontend
122+
path: frontend
123+
124+
- name: Build
125+
uses: docker/build-push-action@v2
126+
with:
127+
context: .
128+
file: ./Dockerfile.github-actions
129+
platforms: ${{ env.DOCKER_PLATFORMS }}
130+
push: ${{ github.event_name != 'pull_request' }}
131+
tags: ${{ steps.docker_meta.outputs.tags }}
132+
labels: ${{ steps.docker_meta.outputs.labels }}
133+
cache-from: type=local,src=/tmp/.buildx-cache
134+
cache-to: type=local,dest=/tmp/.buildx-cache-new
135+
136+
- name: Move cache
137+
run: |
138+
rm -rf /tmp/.buildx-cache
139+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
140+
141+
- name: Check manifest
142+
if: ${{ github.event_name != 'pull_request' }}
143+
run: |
144+
docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.docker_meta.outputs.version }}

.github/workflows/codeql-analysis.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
name: "CodeQL"
8+
9+
on:
10+
push:
11+
branches: [ master ]
12+
pull_request:
13+
# The branches below must be a subset of the branches above
14+
branches: [ master ]
15+
schedule:
16+
- cron: '21 20 * * 0'
17+
18+
jobs:
19+
analyze:
20+
name: Analyze
21+
runs-on: ubuntu-latest
22+
23+
#strategy:
24+
# fail-fast: false
25+
# matrix:
26+
# language: [ 'javascript' ]
27+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
28+
# Learn more:
29+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v2
34+
35+
# Initializes the CodeQL tools for scanning.
36+
- name: Initialize CodeQL
37+
uses: github/codeql-action/init@v1
38+
with:
39+
languages: javascript #${{ matrix.language }}
40+
# If you wish to specify custom queries, you can do so here or in a config file.
41+
# By default, queries listed here will override any specified in a config file.
42+
# Prefix the list here with "+" to use these queries and those in the config file.
43+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
44+
45+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
46+
# If this step fails, then you should remove it and run the build manually (see below)
47+
#- name: Autobuild
48+
# uses: github/codeql-action/autobuild@v1
49+
50+
# ℹ️ Command-line programs to run using the OS shell.
51+
# 📚 https://git.io/JvXDl
52+
53+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
54+
# and modify them (or add more) to build your code if your project
55+
# uses a compiled language
56+
57+
#- run: |
58+
# make bootstrap
59+
# make release
60+
61+
- name: Perform CodeQL Analysis
62+
uses: github/codeql-action/analyze@v1

.github/workflows/cryptic-frontend-ci.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

Dockerfile.github-actions

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM nginx:stable-alpine
2+
3+
EXPOSE 80
4+
5+
COPY nginx/nginx.conf /etc/nginx/
6+
COPY nginx/default.conf /etc/nginx/conf.d/
7+
8+
RUN rm -rf /usr/share/nginx/html/*
9+
10+
COPY ./frontend/ /usr/share/nginx/html
11+
RUN chown -R nginx:nginx /usr/share/nginx/html/
12+
13+
COPY docker-write-api-file.sh /docker-entrypoint.d/
14+
15+
RUN chmod +x /docker-entrypoint.d/docker-write-api-file.sh && apk add jq
16+
17+
CMD ["nginx", "-g", "daemon off;"]

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"ng": "ng",
66
"start": "ng serve",
77
"build": "ng build",
8+
"build:ci": "ng build --prod",
89
"test": "ng test",
910
"lint": "ng lint",
1011
"e2e": "ng e2e"

src/app/desktop/windows/terminal/terminal-states.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ export class DefaultTerminalState extends CommandTerminalState {
190190
working_dir: string = Path.ROOT; // UUID of the working directory
191191

192192
constructor(protected websocket: WebsocketService, private settings: SettingsService, private fileService: FileService,
193-
private domSanitizer: DomSanitizer, protected windowDelegate: WindowDelegate, protected activeDevice: Device,
194-
protected terminal: TerminalAPI, public promptColor: string = null) {
193+
private domSanitizer: DomSanitizer, protected windowDelegate: WindowDelegate, protected activeDevice: Device,
194+
protected terminal: TerminalAPI, public promptColor: string = null) {
195195
super();
196196
}
197197

@@ -1609,9 +1609,9 @@ export class BruteforceTerminalState extends ChoiceTerminalState {
16091609
};
16101610

16111611
constructor(terminal: TerminalAPI,
1612-
private domSanitizer: DomSanitizer,
1613-
private callback: (response: boolean) => void,
1614-
private startSeconds: number = 0) {
1612+
private domSanitizer: DomSanitizer,
1613+
private callback: (response: boolean) => void,
1614+
private startSeconds: number = 0) {
16151615
super(terminal);
16161616

16171617
this.intervalHandle = setInterval(() => {

src/app/desktop/windows/wallet-app/wallet-app-edit/wallet-app-edit.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class WalletAppEditComponent {
1717
correctKey: boolean;
1818
error: boolean;
1919
@Output()
20-
private close: EventEmitter<void> = new EventEmitter<void>();
20+
private performClose: EventEmitter<void> = new EventEmitter<void>();
2121

2222
constructor(
2323
private walletAppService: WalletAppService
@@ -39,7 +39,7 @@ export class WalletAppEditComponent {
3939
if (!data) {
4040
setTimeout(() => this.error = false, 5 * 1000);
4141
} else {
42-
this.close.emit();
42+
this.performClose.emit();
4343
}
4444
});
4545
}

src/app/desktop/windows/wallet-app/wallet-app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</div>
99
<hr>
1010
<div>
11-
<app-wallet-app-edit (close)="walletEdit = false"></app-wallet-app-edit>
11+
<app-wallet-app-edit (performClose)="walletEdit = false"></app-wallet-app-edit>
1212
</div>
1313
</div>
1414
<div *ngIf="!walletEdit && wallet" class="wallet-transaction-list">

src/polyfills.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import 'zone.js/dist/zone'; // Included with Angular CLI.
2727
* Web Animations `@angular/platform-browser/animations`
2828
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
2929
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
30-
**/
30+
*/
3131
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
3232

3333
/**

0 commit comments

Comments
 (0)