Skip to content

Commit 35d09c2

Browse files
authored
Merge branch 'rust-serverless:master' into master
2 parents 4de5bf9 + 764b9d1 commit 35d09c2

File tree

7 files changed

+74
-2
lines changed

7 files changed

+74
-2
lines changed

.github/workflows/check.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Check
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 4 * * 3'
7+
8+
jobs:
9+
check:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
name: Check Rust Version
14+
- run: make check
15+
create_issue:
16+
runs-on: ubuntu-latest
17+
needs: check
18+
if: always() && (needs.check.result == 'failure')
19+
steps:
20+
- run: gh issue create --title "Time to update to Rust" --body "Build update for next version of Rust" --label "enhancement" -R $GITHUB_REPOSITORY
21+
env:
22+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
23+

.github/workflows/main.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,38 @@ on:
66
- master
77

88
jobs:
9+
scan:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: Build
14+
env:
15+
REPO: ${{ github.repository }}
16+
shell: bash
17+
run: |
18+
echo "docker_repo=${{ env.REPO }}" >> $GITHUB_ENV
19+
make build
20+
- name: Trivy vulnerability scanner
21+
uses: aquasecurity/trivy-action@0.0.20
22+
with:
23+
image-ref: '${{ env.docker_repo }}:latest'
24+
format: 'table'
25+
exit-code: '1'
26+
ignore-unfixed: true
27+
vuln-type: 'os,library'
28+
severity: 'CRITICAL,HIGH'
929
test:
1030
runs-on: ubuntu-latest
1131
steps:
1232
- uses: actions/checkout@v1
33+
- name: Build
34+
shell: bash
35+
run: make build
1336
- name: Test
1437
run: make test
1538
publish:
16-
needs: [test]
39+
needs: [scan, test]
40+
if: github.repository == 'rust-serverless/lambda-rust'
1741
runs-on: ubuntu-latest
1842
steps:
1943
- uses: actions/checkout@v1

.github/workflows/nightly.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ jobs:
3434
steps:
3535
- run: gh issue create --title "Nightly publication failed" --body "Nightly publication failed" --label "bug" -R $GITHUB_REPOSITORY
3636
env:
37-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
37+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
38+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
tests/test-*/test-out.log
22
target
33
.DS_Store
4+
.vscode

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
FROM docker.io/lambci/lambda:build-provided.al2
33

44
ARG RUST_VERSION=1.54.0
5+
RUN yum -y update
6+
RUN yum -y remove kernel-devel-4.14.203-156.332.amzn2
57
RUN yum install -y jq openssl-devel
68
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
79
| CARGO_HOME=/cargo RUSTUP_HOME=/rustup sh -s -- -y --profile minimal --default-toolchain $RUST_VERSION
810
ADD build.sh /usr/local/bin/
11+
ADD latest.sh /usr/local/bin/
912
VOLUME ["/code"]
1013
WORKDIR /code
1114
ENTRYPOINT ["/usr/local/bin/build.sh"]

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@ debug: build
2525
-v ${HOME}/.cargo/git:/cargo/git \
2626
--entrypoint=/bin/bash \
2727
$(REPO):$(TAG)
28+
29+
check:
30+
$(DOCKER) run --rm \
31+
--entrypoint=/usr/local/bin/latest.sh \
32+
$(REPO)

latest.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash -eux
2+
3+
export CARGO_HOME="/cargo"
4+
export RUSTUP_HOME="/rustup"
5+
6+
# shellcheck disable=SC1091
7+
source /cargo/env
8+
9+
rustup toolchain install stable --profile=minimal
10+
STABLE=$(rustup check | grep stable | grep -E "[0-9]+\.[0-9]+\.[0-9]+" -o)
11+
DEFAULT=$(rustup show | grep -m 1 default | grep -E "[0-9]+\.[0-9]+\.[0-9]+" -o)
12+
13+
if [ "${STABLE}" == "${DEFAULT}" ]; then exit 0
14+
else exit 1
15+
fi

0 commit comments

Comments
 (0)