Skip to content

Commit 0009fca

Browse files
committed
Migrate from CircleCI to GitHub Actions
1 parent 6d869e1 commit 0009fca

File tree

3 files changed

+114
-148
lines changed

3 files changed

+114
-148
lines changed

.circleci/config.yml

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

.github/workflows/ci.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
6+
env:
7+
RUST_TOOLCHAIN: '1.91'
8+
9+
jobs:
10+
test:
11+
name: Build and Test
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Rust
18+
uses: actions-rust-lang/setup-rust-toolchain@v1
19+
with:
20+
toolchain: ${{ env.RUST_TOOLCHAIN }}
21+
cache: true
22+
23+
- name: Show versions
24+
run: rustc --version && cargo --version
25+
26+
- name: Build
27+
run: cargo build
28+
29+
- name: Run tests
30+
run: cargo test
31+
32+
clippy:
33+
name: Clippy
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v4
38+
39+
- name: Setup Rust
40+
uses: actions-rust-lang/setup-rust-toolchain@v1
41+
with:
42+
toolchain: ${{ env.RUST_TOOLCHAIN }}
43+
components: clippy
44+
cache: true
45+
46+
- name: Run clippy
47+
run: cargo clippy --all-targets --all-features -- -D warnings
48+
49+
fmt:
50+
name: Format Check
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v4
55+
56+
- name: Setup Rust
57+
uses: actions-rust-lang/setup-rust-toolchain@v1
58+
with:
59+
toolchain: ${{ env.RUST_TOOLCHAIN }}
60+
components: rustfmt
61+
cache: true
62+
63+
- name: Check formatting
64+
run: cargo fmt -- --check
65+
66+
audit:
67+
name: Security Audit
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: Checkout code
71+
uses: actions/checkout@v4
72+
73+
- name: Run cargo-audit
74+
uses: rustsec/audit-check@v2
75+
with:
76+
token: ${{ secrets.GITHUB_TOKEN }}
77+
78+
docker-publish:
79+
name: Build and Publish Docker Image
80+
runs-on: ubuntu-latest
81+
needs: [test, clippy, fmt]
82+
if: github.ref == 'refs/heads/main'
83+
steps:
84+
- name: Checkout code
85+
uses: actions/checkout@v4
86+
87+
- name: Extract version from Cargo.toml
88+
id: version
89+
run: |
90+
VERSION=$(grep "^version =" Cargo.toml | sed 's/.*"\([^"]*\)".*/\1/')
91+
echo "version=$VERSION" >> $GITHUB_OUTPUT
92+
echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
93+
94+
- name: Set up Docker Buildx
95+
uses: docker/setup-buildx-action@v3
96+
97+
- name: Login to Docker Hub
98+
uses: docker/login-action@v3
99+
with:
100+
username: ${{ secrets.DOCKER_USERNAME }}
101+
password: ${{ secrets.DOCKER_TOKEN }}
102+
103+
- name: Build and push
104+
uses: docker/build-push-action@v5
105+
with:
106+
context: .
107+
push: true
108+
no-cache: true
109+
tags: |
110+
dbrgn/xc-bot:${{ steps.version.outputs.branch }}
111+
dbrgn/xc-bot:${{ steps.version.outputs.version }}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# XC Bot
22

3-
[![CircleCI][circle-ci-badge]][circle-ci]
3+
[![CI][ci-badge]][ci]
44

55
A chat bot that notifies you about new paragliding cross-country flights
66
published on [XContest](https://www.xcontest.org/) as part of the Swiss [Cross
@@ -74,5 +74,5 @@ Licensed under the AGPL version 3 or later. See `LICENSE.md` file.
7474
along with this program. If not, see <https://www.gnu.org/licenses/>.
7575

7676
<!-- Badges -->
77-
[circle-ci]: https://circleci.com/gh/dbrgn/xc-bot/tree/main
78-
[circle-ci-badge]: https://circleci.com/gh/dbrgn/xc-bot/tree/main.svg?style=shield
77+
[ci]: https://github.com/dbrgn/xc-bot/actions/workflows/ci.yml
78+
[ci-badge]: https://github.com/dbrgn/xc-bot/actions/workflows/ci.yml/badge.svg

0 commit comments

Comments
 (0)